summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-17 16:41:33 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-21 10:51:45 +0200
commit02ce09fbb47c6a64d22d23d511f520b8f8abbcae (patch)
tree56c78310f5f1866ade8e261c45fb49f0f1a8b945
parent6c9b020a0f8f40213040024e8b8af1a14c2faeb8 (diff)
elm_part_helper: emit changed events when content is changed
Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D8639
-rw-r--r--src/lib/elementary/elm_part_helper.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h
index 8f83f98c6f..30230e7007 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -33,10 +33,25 @@ struct _Elm_Part_Data
33 EFL_OBJECT_OP_FUNC(efl_ui_widget_default_text_part_get, _ ## type ## _default_text_part_get) 33 EFL_OBJECT_OP_FUNC(efl_ui_widget_default_text_part_get, _ ## type ## _default_text_part_get)
34 34
35#define ELM_PART_CONTENT_DEFAULT_IMPLEMENT(type, typedata) \ 35#define ELM_PART_CONTENT_DEFAULT_IMPLEMENT(type, typedata) \
36 static void \
37 _ ## type ## _invalidated_cb(void *data, const Efl_Event *ev EINA_UNUSED) \
38 { \
39 efl_content_set(data, NULL); \
40 } \
41 \
36 EOLIAN static Eina_Bool \ 42 EOLIAN static Eina_Bool \
37 _ ## type ## _efl_content_content_set(Eo *obj, typedata *sd EINA_UNUSED, Evas_Object *content) \ 43 _ ## type ## _efl_content_content_set(Eo *obj, typedata *sd EINA_UNUSED, Evas_Object *content) \
38 { \ 44 { \
39 return efl_content_set(efl_part(obj, efl_ui_widget_default_content_part_get(obj)), content); \ 45 Eina_Bool result; \
46 Efl_Ui_Widget *former; \
47 former = efl_content_get(efl_part(obj, efl_ui_widget_default_content_part_get(obj))); \
48 if (former) \
49 efl_event_callback_del(former, EFL_EVENT_INVALIDATE, _ ## type ## _invalidated_cb, obj); \
50 result = efl_content_set(efl_part(obj, efl_ui_widget_default_content_part_get(obj)), content); \
51 if (content && result) \
52 efl_event_callback_add(content, EFL_EVENT_INVALIDATE, _ ## type ## _invalidated_cb, obj); \
53 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, result ? content : NULL); \
54 return result; \
40 } \ 55 } \
41 \ 56 \
42 EOLIAN static Evas_Object* \ 57 EOLIAN static Evas_Object* \
@@ -48,7 +63,11 @@ struct _Elm_Part_Data
48 EOLIAN static Evas_Object* \ 63 EOLIAN static Evas_Object* \
49 _ ## type ## _efl_content_content_unset(Eo *obj, typedata *sd EINA_UNUSED) \ 64 _ ## type ## _efl_content_content_unset(Eo *obj, typedata *sd EINA_UNUSED) \
50 { \ 65 { \
51 return efl_content_unset(efl_part(obj, efl_ui_widget_default_content_part_get(obj))); \ 66 Eo *result = efl_content_unset(efl_part(obj, efl_ui_widget_default_content_part_get(obj))); \
67 if (result) \
68 efl_event_callback_del(result, EFL_EVENT_INVALIDATE, _ ## type ## _invalidated_cb, obj); \
69 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL); \
70 return result; \
52 } 71 }
53 72
54static inline Eo * 73static inline Eo *