path: root/src/lib/elementary/elm_widget.c
diff options
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 14:00:43 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 14:50:31 +0900
commitd39bbc149113da5d842f30d046dc04302e54275b (patch)
treebf4fb87d6af59bfd2720a15293362a64ad7f3815 /src/lib/elementary/elm_widget.c
parentelm: Don't do anything before construction (diff)
elm: Create legacy widgets with elm_legacy_add
This will be used to solve issues around style_set: if the widget is legacy or pure eo we may need to select a different style. So in the constructor we need to know whether we are legacy or eo. Note that calling style_set in finalize only is too late as we would lose information such as efl_text_set() called inside efl_add().
Diffstat (limited to 'src/lib/elementary/elm_widget.c')
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index 26ec1563eb..022f1f3aba 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -53,6 +53,8 @@ typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data;
typedef struct _Elm_Label_Data Elm_Label_Data;
typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data;
+Eina_Bool _elm_legacy_add = EINA_FALSE;
struct _Elm_Event_Cb_Data
Elm_Event_Cb func;
@@ -2968,7 +2970,7 @@ elm_widget_theme_get(const Evas_Object *obj)
EOLIAN static Efl_Ui_Theme_Apply
_elm_widget_style_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *style)
- if (!sd->legacy && efl_finalized_get(obj))
+ if (!elm_widget_is_legacy(obj) && efl_finalized_get(obj))
ERR("Efl.Ui.Widget.style can only be set before finalize!");
@@ -5117,6 +5119,8 @@ _elm_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSE
Eo *parent = NULL;
sd->on_create = EINA_TRUE;
+ sd->legacy = _elm_legacy_add;
+ _elm_legacy_add = EINA_FALSE;
efl_canvas_group_clipped_set(obj, EINA_FALSE);
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
@@ -5170,6 +5174,7 @@ _elm_widget_legacy_ctor(Eo *obj, Elm_Widget_Smart_Data *sd)
efl_canvas_object_legacy_ctor(efl_super(obj, MY_CLASS));
sd->legacy = EINA_TRUE;
+ _elm_legacy_add = EINA_FALSE;
EOLIAN static void