elm_layout: Implement Efl.Text
authorJean-Philippe Andre <jp.andre@samsung.com>
Fri, 16 Dec 2016 09:53:33 +0000 (18:53 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Fri, 16 Dec 2016 09:53:33 +0000 (18:53 +0900)
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!!

src/lib/elementary/elm_layout.c
src/lib/elementary/elm_layout.eo
src/lib/elementary/elm_layout_internal_part.eo
src/lib/elementary/elm_layout_legacy.h

index b5d2f56cb8d6515ccda82f914eac09e07a18dee9..bf5ce99542612b98df26bc80569c9bc8de073a9f 100644 (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);
 }
 
+// FIXME: Remove from EO file, remove EOLIAN tag
 EOLIAN static Eina_Bool
 _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;
 }
 
-EOLIAN static const char*
+EOLIAN static const char *
 _elm_layout_text_get(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part)
 {
    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);
 }
 
+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
 _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;
 }
 
+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_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)
index 2a29f8aac52e2f22016260dfb891544cdcbaa845..6ce66464c0124a3217a8a6fde3108e6a77162a3d 100644 (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]]
 }
 
-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]]
    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_unset;
       Efl.Part.part;
+      Efl.Text.text.set;
+      Efl.Text.text.get;
    }
    events {
       theme,changed; [[Called when theme changed]]
index b8ec78953ec7092722a091bf558d2850b656a186..3d966de9b65a6e8957aea5f0cf53ae841aa00d72 100644 (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]]
    data: Elm_Part_Data;
@@ -7,5 +7,7 @@ class Elm.Layout.Internal.Part (Efl.Object, Efl.Container)
       Efl.Container.content.set;
       Efl.Container.content.get;
       Efl.Container.content_unset;
+      Efl.Text.text.set;
+      Efl.Text.text.get;
    }
 }
index c9654d23fe8e334978560281483a2fd7ba2b98a9..779907fad33950117232cf9f4d88f5f220094b0d 100644 (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);
 
+/**
+ * @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.
  *