summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-12-04 16:01:51 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-06 17:35:21 +0900
commit645a5897f0638033c2b275c6a806e69c6f7ecde3 (patch)
tree7abb7510826e3203d8aaf03d73f34bf38f458597
parent968611a85e4200b61f5640969a8f5dff339a147c (diff)
downloadefl-645a5897f0638033c2b275c6a806e69c6f7ecde3.tar.gz
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 38f178c99c..46a1c07d1c 100644
--- a/data/elementary/themes/edc/efl/panes.edc
+++ b/data/elementary/themes/edc/efl/panes.edc
@@ -13,10 +13,18 @@
group { "efl/panes/vertical";
inherit: "elm/panes/vertical/default";
+ parts {
+ alias: "first" "elm.swallow.left";
+ alias: "second" "elm.swallow.right";
+ }
}
group { "efl/panes/horizontal";
inherit: "elm/panes/horizontal/default";
+ parts {
+ alias: "first" "elm.swallow.left";
+ alias: "second" "elm.swallow.right";
+ }
}
group { "efl/panes/vertical:flush";
diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc
index 407a28b5dd..491d483b42 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";
alias: "efl/popup_alert_text";
images.image: "rounded_square.png" COMP;
parts {
+ alias: "title" "elm.text.title";
image { "bg";
desc { "default";
min: 100 100;
image.border: 15 15 15 15;
image.normal: "rounded_square.png";
- }
+ }
}
spacer { "base";
desc { "default";
@@ -256,4 +257,4 @@ group { "efl/popup_alert_scroll/scroller";
group { "efl/popup_alert_text/text";
inherit: "efl/text";
-} \ No newline at end of file
+}
diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c
index 67abc09622..e2b4d09ecc 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)
/* Efl.Part begin */
-ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data, _content_aliases)
+static Eina_Bool
+_part_is_efl_ui_button_part(const Eo *obj EINA_UNUSED, const char *part)
+{
+ return eina_streq(part, "elm.swallow.content");
+}
+
+ELM_PART_OVERRIDE_PARTIAL(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data, _part_is_efl_ui_button_part)
ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_button, EFL_UI_BUTTON, Efl_Ui_Button_Data)
#include "efl_ui_button_part.eo.c"
diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c
index feb83ffdb9..4fe972506d 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
/* Efl.Part begin */
-ELM_PART_OVERRIDE(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data)
+static Eina_Bool
+_part_is_efl_ui_flip_entry_part(const Eo *obj EINA_UNUSED, const char *part)
+{
+ return ((eina_streq(part, "front")) || (eina_streq(part, "back")));
+}
+
+ELM_PART_OVERRIDE_PARTIAL(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data, _part_is_efl_ui_flip_entry_part)
ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data)
ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_flip, EFL_UI_FLIP, Efl_Ui_Flip_Data)
ELM_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 2becad6dda..a1a7bdeb57 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);
static void _entry_focus_changed_cb(void *data, const Efl_Event *event);
static void _entry_clicked_cb(void *data, const Efl_Event *event);
-static const Elm_Layout_Part_Alias_Description _text_aliases[] =
-{
- {"default", "elm.text"},
- {"guide", "guide"},
- {NULL, NULL}
-};
-
-
EFL_CALLBACKS_ARRAY_DEFINE(_multi_buttonentry_cb,
{ ELM_ENTRY_EVENT_CHANGED, _entry_changed_cb },
{ 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
return &atspi_actions[0];
}
-/* Efl.Part begin */
+static Eina_Bool
+_part_is_efl_ui_multibutton_entry_part(const Eo *obj, const char *part)
+{
+ return (((elm_widget_is_legacy(obj)) && (eina_streq(part, "default"))) ||
+ (eina_streq(part, "guide")));
+}
-ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data, _text_aliases)
+ELM_PART_OVERRIDE_PARTIAL(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY,
+ Efl_Ui_Multibuttonentry_Data, _part_is_efl_ui_multibutton_entry_part)
ELM_PART_OVERRIDE_TEXT_SET(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data)
ELM_PART_OVERRIDE_TEXT_GET(efl_ui_multibuttonentry, EFL_UI_MULTIBUTTONENTRY, Efl_Ui_Multibuttonentry_Data)
#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 bf7cb465f1..b98a1ee26c 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)
/* Efl.Part begin */
-ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_panes, EFL_UI_PANES, Efl_Ui_Panes_Data, _content_aliases)
+static Eina_Bool
+_part_is_efl_ui_panes_part(const Eo *obj, const char *part)
+{
+ if (elm_widget_is_legacy(obj))
+ {
+ if ((eina_streq(part, "elm.swallow.left")) || (eina_streq(part, "elm.swallow.right")))
+ return EINA_TRUE;
+ }
+
+ return (eina_streq(part, "first")) || (eina_streq(part, "second"));
+}
+
+ELM_PART_OVERRIDE_PARTIAL(efl_ui_panes, EFL_UI_PANES, Efl_Ui_Panes_Data,
+ _part_is_efl_ui_panes_part)
EOLIAN static void
_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 0249977dea..4fb26326d8 100644
--- a/src/lib/elementary/efl_ui_popup_alert.c
+++ b/src/lib/elementary/efl_ui_popup_alert.c
@@ -12,13 +12,6 @@
#define MY_CLASS EFL_UI_POPUP_ALERT_CLASS
#define MY_CLASS_NAME "Efl.Ui.Popup.Alert"
-static const Elm_Layout_Part_Alias_Description _text_aliases[] =
-{
- {"title", "title"},
- {"elm.text.title", "elm.text.title"},
- {NULL, NULL}
-};
-
static const char PART_NAME_BUTTON[] = "button";
static const char PART_NAME_BUTTON_LAYOUT[EFL_UI_POPUP_ALERT_BUTTON_COUNT][15] =
{"button_layout1",
@@ -262,8 +255,15 @@ _efl_ui_popup_alert_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Alert_Data *pd)
efl_destructor(efl_super(obj, MY_CLASS));
}
+static Eina_Bool
+_part_is_efl_ui_popup_alert_part(const Eo *obj EINA_UNUSED, const char *part)
+{
+ return (eina_streq(part, "title") || eina_streq(part, "elm.text.title"));
+}
+
/* Efl.Part begin */
-ELM_PART_OVERRIDE_ONLY_ALIASES(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data, _text_aliases)
+ELM_PART_OVERRIDE_PARTIAL(efl_ui_popup_alert, EFL_UI_POPUP_ALERT,
+ Efl_Ui_Popup_Alert_Data, _part_is_efl_ui_popup_alert_part)
ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
#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 858dbb4d90..3177aae7b9 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
return efl_content_unset(efl_part(obj, _ ## type ## _default_content_part_get(obj, sd))); \
}
-
-// For any widget that has specific part handling
-
-static inline Eina_Bool
-_elm_part_alias_find(const Elm_Layout_Part_Alias_Description *aliases, const char *part)
-{
- const Elm_Layout_Part_Alias_Description *alias;
-
- for (alias = aliases; alias && alias->alias; alias++)
- if (eina_streq(alias->real_part, part))
- return EINA_TRUE;
- return EINA_FALSE;
-}
-
static inline Eo *
_elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
{
@@ -86,14 +72,14 @@ ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part)
_elm_part_initialize(efl_added, (Eo *) obj, part));
}
-#define ELM_PART_OVERRIDE_ONLY_ALIASES(type, TYPE, typedata, aliases) \
+#define ELM_PART_OVERRIDE_PARTIAL(type, TYPE, typedata, _is_part_cb) \
EOLIAN static Efl_Object * \
_ ## type ## _efl_part_part(const Eo *obj, typedata *priv EINA_UNUSED, const char *part) \
{ \
- EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
- if (_elm_part_alias_find(aliases, part)) \
- return ELM_PART_IMPLEMENT(TYPE ## _PART_CLASS, obj, part); \
- return efl_part(efl_super(obj, MY_CLASS), part); \
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
+ if (_is_part_cb(obj, part)) \
+ return ELM_PART_IMPLEMENT(TYPE ## _PART_CLASS, obj, part); \
+ return efl_part(efl_super(obj, MY_CLASS), part); \
}
#define ELM_PART_OVERRIDE(type, TYPE, typedata) \