summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-12-04 16:01:51 +0900
committerSungtaek Hong <sth253.hong@samsung.com>2017-12-08 16:02:23 +0900
commite7e375937be40e543967ad32b4bb4dd533f3ab92 (patch)
treea454b234e3ded27a14c0ede685ef7007adc83328
parentc12d947484513b6caad91c8e1945e2de3b115cd3 (diff)
elm: introduce ELM_PART_OVERRIDE_PARTIAL
Summary: ELM_PART_OVERRIDE_PARTIAL replaces ELM_PART_OVERRIDE and ELM_PART_OVERRIDE_ONLY_ALIASES. The difference is ELM_PART_OVERRIDE_PARTIAL calls super ELM_PART_IMPLEMENT when subclass of part is not needed. Test Plan: Run elementary_test, Part Background, background part is well set. Run efl.ui.panes/efl.ui.flip, check content is well set. Reviewers: jpeg, Jaehyun_Cho, woohyun Reviewed By: Jaehyun_Cho Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5566
-rw-r--r--data/elementary/themes/edc/efl/panes.edc8
-rw-r--r--data/elementary/themes/edc/efl/popup.edc5
-rw-r--r--src/lib/elementary/efl_ui_button.c8
-rw-r--r--src/lib/elementary/efl_ui_flip.c8
-rw-r--r--src/lib/elementary/efl_ui_multibuttonentry.c18
-rw-r--r--src/lib/elementary/efl_ui_panes.c15
-rw-r--r--src/lib/elementary/efl_ui_popup_alert.c16
-rw-r--r--src/lib/elementary/elm_part_helper.h24
8 files changed, 60 insertions, 42 deletions
diff --git a/data/elementary/themes/edc/efl/panes.edc b/data/elementary/themes/edc/efl/panes.edc
index 38f178c..46a1c07 100644
--- a/data/elementary/themes/edc/efl/panes.edc
+++ b/data/elementary/themes/edc/efl/panes.edc
@@ -13,10 +13,18 @@
13 13
14group { "efl/panes/vertical"; 14group { "efl/panes/vertical";
15 inherit: "elm/panes/vertical/default"; 15 inherit: "elm/panes/vertical/default";
16 parts {
17 alias: "first" "elm.swallow.left";
18 alias: "second" "elm.swallow.right";
19 }
16} 20}
17 21
18group { "efl/panes/horizontal"; 22group { "efl/panes/horizontal";
19 inherit: "elm/panes/horizontal/default"; 23 inherit: "elm/panes/horizontal/default";
24 parts {
25 alias: "first" "elm.swallow.left";
26 alias: "second" "elm.swallow.right";
27 }
20} 28}
21 29
22group { "efl/panes/vertical:flush"; 30group { "efl/panes/vertical:flush";
diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc
index 407a28b..491d483 100644
--- a/data/elementary/themes/edc/efl/popup.edc
+++ b/data/elementary/themes/edc/efl/popup.edc
@@ -28,12 +28,13 @@ group { "efl/popup_alert";
28 alias: "efl/popup_alert_text"; 28 alias: "efl/popup_alert_text";
29 images.image: "rounded_square.png" COMP; 29 images.image: "rounded_square.png" COMP;
30 parts { 30 parts {
31 alias: "title" "elm.text.title";
31 image { "bg"; 32 image { "bg";
32 desc { "default"; 33 desc { "default";
33 min: 100 100; 34 min: 100 100;
34 image.border: 15 15 15 15; 35 image.border: 15 15 15 15;
35 image.normal: "rounded_square.png"; 36 image.normal: "rounded_square.png";
36 } 37 }
37 } 38 }
38 spacer { "base"; 39 spacer { "base";
39 desc { "default"; 40 desc { "default";
@@ -256,4 +257,4 @@ group { "efl/popup_alert_scroll/scroller";
256 257
257group { "efl/popup_alert_text/text"; 258group { "efl/popup_alert_text/text";
258 inherit: "efl/text"; 259 inherit: "efl/text";
259} \ No newline at end of file 260}
diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c
index 67abc09..e2b4d09 100644
--- a/src/lib/elementary/efl_ui_button.c
+++ b/src/lib/elementary/efl_ui_button.c
@@ -420,7 +420,13 @@ ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_button, Efl_Ui_Button_Data)
420 420
421/* Efl.Part begin */ 421/* Efl.Part begin */
422 422
423ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data, _content_aliases) 423static Eina_Bool
424_part_is_efl_ui_button_part(const Eo *obj EINA_UNUSED, const char *part)
425{
426 return eina_streq(part, "elm.swallow.content");
427}
428
429ELM_PART_OVERRIDE_PARTIAL(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data, _part_is_efl_ui_button_part)
424ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data) 430ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data)
425#include "efl_ui_button_part.eo.c" 431#include "efl_ui_button_part.eo.c"
426 432
diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c
index feb83ff..4fe9725 100644
--- a/src/lib/elementary/efl_ui_flip.c
+++ b/src/lib/elementary/efl_ui_flip.c
@@ -2349,7 +2349,13 @@ elm_flip_interaction_direction_enabled_get(Efl_Ui_Flip *obj, Elm_Flip_Direction
2349 2349
2350/* Efl.Part begin */ 2350/* Efl.Part begin */
2351 2351
2352ELM_PART_OVERRIDE(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data) 2352static Eina_Bool
2353_part_is_efl_ui_flip_entry_part(const Eo *obj EINA_UNUSED, const char *part)
2354{
2355 return ((eina_streq(part, "front")) || (eina_streq(part, "back")));
2356}
2357
2358ELM_PART_OVERRIDE_PARTIAL(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data, _part_is_efl_ui_flip_entry_part)
2353ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data) 2359ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data)
2354ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data) 2360ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data)
2355ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data) 2361ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data)
diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c
index 2becad6..a1a7bde 100644
--- a/src/lib/elementary/efl_ui_multibuttonentry.c
+++ b/src/lib/elementary/efl_ui_multibuttonentry.c
@@ -62,14 +62,6 @@ static void _entry_changed_cb(void *data, const Efl_Event *event);
62static void _entry_focus_changed_cb(void *data, const Efl_Event *event); 62static void _entry_focus_changed_cb(void *data, const Efl_Event *event);
63static void _entry_clicked_cb(void *data, const Efl_Event *event); 63static void _entry_clicked_cb(void *data, const Efl_Event *event);
64 64
65static const Elm_Layout_Part_Alias_Description _text_aliases[] =
66{
67 {"default", "elm.text"},
68 {"guide", "guide"},
69 {NULL, NULL}
70};
71
72
73EFL_CALLBACKS_ARRAY_DEFINE(_multi_buttonentry_cb, 65EFL_CALLBACKS_ARRAY_DEFINE(_multi_buttonentry_cb,
74 { ELM_ENTRY_EVENT_CHANGED, _entry_changed_cb }, 66 { ELM_ENTRY_EVENT_CHANGED, _entry_changed_cb },
75 { EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , _entry_focus_changed_cb }, 67 { EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , _entry_focus_changed_cb },
@@ -2066,9 +2058,15 @@ _elm_multibuttonentry_item_efl_access_widget_action_elm_actions_get(Eo *obj EINA
2066 return &atspi_actions[0]; 2058 return &atspi_actions[0];
2067} 2059}
2068 2060
2069/* Efl.Part begin */ 2061static Eina_Bool
2062_part_is_efl_ui_multibutton_entry_part(const Eo *obj, const char *part)
2063{
2064 return (((elm_widget_is_legacy(obj)) && (eina_streq(part, "default"))) ||
2065 (eina_streq(part, "guide")));
2066}
2070 2067
2071ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data, _text_aliases) 2068ELM_PART_OVERRIDE_PARTIAL(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY,
2069 Efl_Ui_Multibuttonentry_Data, _part_is_efl_ui_multibutton_entry_part)
2072ELM_PART_OVERRIDE_TEXT_SET(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data) 2070ELM_PART_OVERRIDE_TEXT_SET(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data)
2073ELM_PART_OVERRIDE_TEXT_GET(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data) 2071ELM_PART_OVERRIDE_TEXT_GET(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data)
2074#include "efl_ui_multibuttonentry_part.eo.c" 2072#include "efl_ui_multibuttonentry_part.eo.c"
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index bf7cb46..b98a1ee 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -546,7 +546,20 @@ _efl_ui_panes_class_constructor(Efl_Class *klass)
546 546
547/* Efl.Part begin */ 547/* Efl.Part begin */
548 548
549ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_panes, EFL_UI_PANES, Efl_Ui_Panes_Data, _content_aliases) 549static Eina_Bool
550_part_is_efl_ui_panes_part(const Eo *obj, const char *part)
551{
552 if (elm_widget_is_legacy(obj))
553 {
554 if ((eina_streq(part, "elm.swallow.left")) || (eina_streq(part, "elm.swallow.right")))
555 return EINA_TRUE;
556 }
557
558 return (eina_streq(part, "first")) || (eina_streq(part, "second"));
559}
560
561ELM_PART_OVERRIDE_PARTIAL(efl_ui_panes, EFL_UI_PANES, Efl_Ui_Panes_Data,
562 _part_is_efl_ui_panes_part)
550 563
551EOLIAN static void 564EOLIAN static void
552_efl_ui_panes_part_hint_min_allow_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool allow) 565_efl_ui_panes_part_hint_min_allow_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool allow)
diff --git a/src/lib/elementary/efl_ui_popup_alert.c b/src/lib/elementary/efl_ui_popup_alert.c
index 0249977..4fb2632 100644
--- a/src/lib/elementary/efl_ui_popup_alert.c
+++ b/src/lib/elementary/efl_ui_popup_alert.c
@@ -12,13 +12,6 @@
12#define MY_CLASS EFL_UI_POPUP_ALERT_CLASS 12#define MY_CLASS EFL_UI_POPUP_ALERT_CLASS
13#define MY_CLASS_NAME "Efl.Ui.Popup.Alert" 13#define MY_CLASS_NAME "Efl.Ui.Popup.Alert"
14 14
15static const Elm_Layout_Part_Alias_Description _text_aliases[] =
16{
17 {"title", "title"},
18 {"elm.text.title", "elm.text.title"},
19 {NULL, NULL}
20};
21
22static const char PART_NAME_BUTTON[] = "button"; 15static const char PART_NAME_BUTTON[] = "button";
23static const char PART_NAME_BUTTON_LAYOUT[EFL_UI_POPUP_ALERT_BUTTON_COUNT][15] = 16static const char PART_NAME_BUTTON_LAYOUT[EFL_UI_POPUP_ALERT_BUTTON_COUNT][15] =
24 {"button_layout1", 17 {"button_layout1",
@@ -262,8 +255,15 @@ _efl_ui_popup_alert_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Alert_Data *pd)
262 efl_destructor(efl_super(obj, MY_CLASS)); 255 efl_destructor(efl_super(obj, MY_CLASS));
263} 256}
264 257
258static Eina_Bool
259_part_is_efl_ui_popup_alert_part(const Eo *obj EINA_UNUSED, const char *part)
260{
261 return (eina_streq(part, "title") || eina_streq(part, "elm.text.title"));
262}
263
265/* Efl.Part begin */ 264/* Efl.Part begin */
266ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data, _text_aliases) 265ELM_PART_OVERRIDE_PARTIAL(efl_ui_popup_alert, EFL_UI_POPUP_ALERT,
266 Efl_Ui_Popup_Alert_Data, _part_is_efl_ui_popup_alert_part)
267ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data) 267ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
268ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data) 268ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
269#include "efl_ui_popup_alert_part.eo.c" 269#include "efl_ui_popup_alert_part.eo.c"
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h
index 858dbb4..3177aae 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -51,20 +51,6 @@ struct _Elm_Part_Data
51 return efl_content_unset(efl_part(obj, _ ## type ## _default_content_part_get(obj, sd))); \ 51 return efl_content_unset(efl_part(obj, _ ## type ## _default_content_part_get(obj, sd))); \
52 } 52 }
53 53
54
55// For any widget that has specific part handling
56
57static inline Eina_Bool
58_elm_part_alias_find(const Elm_Layout_Part_Alias_Description *aliases, const char *part)
59{
60 const Elm_Layout_Part_Alias_Description *alias;
61
62 for (alias = aliases; alias && alias->alias; alias++)
63 if (eina_streq(alias->real_part, part))
64 return EINA_TRUE;
65 return EINA_FALSE;
66}
67
68static inline Eo * 54static inline Eo *
69_elm_part_initialize(Eo *proxy, Eo *obj, const char *part) 55_elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
70{ 56{
@@ -86,14 +72,14 @@ ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part)
86 _elm_part_initialize(efl_added, (Eo *) obj, part)); 72 _elm_part_initialize(efl_added, (Eo *) obj, part));
87} 73}
88 74
89#define ELM_PART_OVERRIDE_ONLY_ALIASES(type, TYPE, typedata, aliases) \ 75#define ELM_PART_OVERRIDE_PARTIAL(type, TYPE, typedata, _is_part_cb) \
90 EOLIAN static Efl_Object * \ 76 EOLIAN static Efl_Object * \
91 _ ## type ## _efl_part_part(const Eo *obj, typedata *priv EINA_UNUSED, const char *part) \ 77 _ ## type ## _efl_part_part(const Eo *obj, typedata *priv EINA_UNUSED, const char *part) \
92 { \ 78 { \
93 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \ 79 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
94 if (_elm_part_alias_find(aliases, part)) \ 80 if (_is_part_cb(obj, part)) \
95 return ELM_PART_IMPLEMENT(TYPE ## _PART_CLASS, obj, part); \ 81 return ELM_PART_IMPLEMENT(TYPE ## _PART_CLASS, obj, part); \
96 return efl_part(efl_super(obj, MY_CLASS), part); \ 82 return efl_part(efl_super(obj, MY_CLASS), part); \
97 } 83 }
98 84
99#define ELM_PART_OVERRIDE(type, TYPE, typedata) \ 85#define ELM_PART_OVERRIDE(type, TYPE, typedata) \