elm_layout: Implement Efl.Text

This implements support for efl_text_set() for the default
part (NULL). This also adds support for efl_text_set(efl_part())
for layouts. This should cover a LOT of widgets :)

The next step is to remove Elm.Layout.text but it's used in too
many places at the moment. @herdsman!!
This commit is contained in:
Jean-Philippe Andre 2016-12-16 18:53:33 +09:00
parent 03eb4c6409
commit 584e17ae84
4 changed files with 51 additions and 3 deletions

View File

@ -1270,6 +1270,7 @@ _elm_layout_efl_container_content_count(Eo *eo_obj EINA_UNUSED, Elm_Layout_Smart
return eina_list_count(sd->subs); return eina_list_count(sd->subs);
} }
// FIXME: Remove from EO file, remove EOLIAN tag
EOLIAN static Eina_Bool EOLIAN static Eina_Bool
_elm_layout_text_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, const char *text) _elm_layout_text_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, const char *text)
{ {
@ -1326,7 +1327,7 @@ _elm_layout_text_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, const
return EINA_TRUE; return EINA_TRUE;
} }
EOLIAN static const char* EOLIAN static const char *
_elm_layout_text_get(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part) _elm_layout_text_get(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part)
{ {
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
@ -1337,6 +1338,18 @@ _elm_layout_text_get(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part)
return edje_object_part_text_get(wd->resize_obj, part); return edje_object_part_text_get(wd->resize_obj, part);
} }
EOLIAN static void
_elm_layout_efl_text_text_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *text)
{
_elm_layout_text_set(obj, sd, NULL, text);
}
EOLIAN static const char *
_elm_layout_efl_text_text_get(Eo *obj, Elm_Layout_Smart_Data *sd)
{
return _elm_layout_text_get(obj, sd, NULL);
}
static void static void
_layout_box_subobj_init(Elm_Layout_Smart_Data *sd, Elm_Layout_Sub_Object_Data *sub_d, const char *part, Evas_Object *child) _layout_box_subobj_init(Elm_Layout_Smart_Data *sd, Elm_Layout_Sub_Object_Data *sub_d, const char *part, Evas_Object *child)
{ {
@ -2048,6 +2061,18 @@ _elm_layout_efl_part_part(const Eo *obj, Elm_Layout_Smart_Data *sd,
return proxy; return proxy;
} }
EOLIAN static void
_elm_layout_internal_part_efl_text_text_set(Eo *obj, Elm_Part_Data *pd, const char *text)
{
ELM_PART_CALL(_elm_layout_text_set(pd->obj, pd->sd, pd->part, text));
}
EOLIAN static const char *
_elm_layout_internal_part_efl_text_text_get(Eo *obj, Elm_Part_Data *pd)
{
ELM_PART_RETURN_VAL(_elm_layout_text_get(pd->obj, pd->sd, pd->part));
}
ELM_PART_IMPLEMENT_DESTRUCTOR(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data) ELM_PART_IMPLEMENT_DESTRUCTOR(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data)
ELM_PART_IMPLEMENT_CONTENT_SET(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data) ELM_PART_IMPLEMENT_CONTENT_SET(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data)
ELM_PART_IMPLEMENT_CONTENT_GET(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data) ELM_PART_IMPLEMENT_CONTENT_GET(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data)

View File

@ -17,7 +17,7 @@ struct Elm.Layout_Part_Alias_Description
real_part: string; [[Target part name for the alias set on Elm.Layout_Part_Proxies_Description::real_part. An example of usage would be "default" on that field, with "elm.content.swallow" on this one]] real_part: string; [[Target part name for the alias set on Elm.Layout_Part_Proxies_Description::real_part. An example of usage would be "default" on that field, with "elm.content.swallow" on this one]]
} }
class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File) class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File, Efl.Text)
{ {
[[Elementary layout class]] [[Elementary layout class]]
legacy_prefix: elm_layout; legacy_prefix: elm_layout;
@ -358,6 +358,8 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File)
Efl.Container.content.get; Efl.Container.content.get;
Efl.Container.content_unset; Efl.Container.content_unset;
Efl.Part.part; Efl.Part.part;
Efl.Text.text.set;
Efl.Text.text.get;
} }
events { events {
theme,changed; [[Called when theme changed]] theme,changed; [[Called when theme changed]]

View File

@ -1,4 +1,4 @@
class Elm.Layout.Internal.Part (Efl.Object, Efl.Container) class Elm.Layout.Internal.Part (Efl.Object, Efl.Container, Efl.Text)
{ {
[[Elementary layout internal part class]] [[Elementary layout internal part class]]
data: Elm_Part_Data; data: Elm_Part_Data;
@ -7,5 +7,7 @@ class Elm.Layout.Internal.Part (Efl.Object, Efl.Container)
Efl.Container.content.set; Efl.Container.content.set;
Efl.Container.content.get; Efl.Container.content.get;
Efl.Container.content_unset; Efl.Container.content_unset;
Efl.Text.text.set;
Efl.Text.text.get;
} }
} }

View File

@ -127,6 +127,25 @@ EAPI Eina_Bool elm_layout_mmap_set(Eo *obj, const Eina_File *file, const char *g
*/ */
EAPI void elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group); EAPI void elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group);
/**
* @brief Set the text of the given part.
*
* @param[in] part The TEXT part where to set the text.
* @param[in] text The text to set.
*
* @return @c true on success, @c false otherwise
*/
EAPI Eina_Bool elm_layout_text_set(Evas_Object *obj, const char * part, const char *text);
/**
* @brief Get the text set in the given part.
*
* @param[in] part The TEXT part where to set the text.
*
* @return The text to set.
*/
EAPI const char *elm_layout_text_get(const Evas_Object *obj, const char * part);
/** /**
* @brief Append child to layout box part. * @brief Append child to layout box part.
* *