forked from enlightenment/efl
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
This commit is contained in:
parent
c12d947484
commit
e7e375937b
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) \
|
||||
|
|
Loading…
Reference in New Issue