summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_widget.h
diff options
context:
space:
mode:
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.h
parent6cea4993e0ea7425a1dde2b38bcdb63687a7eaad (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 '')
-rw-r--r--src/lib/elementary/elm_widget.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index 82e17bc76d..aa5d11d123 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -809,11 +809,19 @@ _elm_widget_sub_object_redirect_to_top(Evas_Object *obj, Evas_Object *sobj)
809 return ret; 809 return ret;
810} 810}
811 811
812/* Internal hack to mark legacy objects as such before construction.
813 * No need for TLS: Only UI objects created in the main loop matter. */
814extern Eina_Bool _elm_legacy_add;
815#define elm_legacy_add(k, p, ...) ({ _elm_legacy_add = 1; \
816 efl_add(k, p, efl_canvas_object_legacy_ctor(efl_added), ##__VA_ARGS__); })
817
812static inline Eina_Bool 818static inline Eina_Bool
813elm_widget_is_legacy(const Eo *obj) 819elm_widget_is_legacy(const Eo *obj)
814{ 820{
815 Elm_Widget_Smart_Data *sd = (Elm_Widget_Smart_Data *) 821 Elm_Widget_Smart_Data *sd;
816 efl_data_scope_safe_get(obj, ELM_WIDGET_CLASS); 822
823 if (_elm_legacy_add) return EINA_TRUE;
824 sd = (Elm_Widget_Smart_Data *) efl_data_scope_safe_get(obj, ELM_WIDGET_CLASS);
817 return sd ? sd->legacy : EINA_FALSE; 825 return sd ? sd->legacy : EINA_FALSE;
818} 826}
819 827