forked from enlightenment/efl
efl_ui_widget: find theme just once in layout inherited widget
When a widget inherits layout in tries to set theme in group_add or in constructor. When another widget inherits the previous widget, it sets layout again with new klass name. This sets klass in the widget and sets layout in super class, so that it can set layout only once. Test Plan: Run efl_ui_widget related elementary test. Reviewers: jpeg, cedric, woohyun, singh.amitesh Differential Revision: https://phab.enlightenment.org/D5473
This commit is contained in:
parent
f80ab519af
commit
fc8cc4a9b3
|
@ -97,10 +97,13 @@ _on_resize(void *data,
|
|||
EOLIAN static void
|
||||
_efl_ui_bg_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Bg_Data *priv)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
priv->rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
||||
evas_object_color_set(priv->rect, 0, 0, 0, 0);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "bg");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
@ -109,7 +112,10 @@ _efl_ui_bg_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Bg_Data *priv)
|
|||
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _on_resize, obj);
|
||||
|
||||
if (!elm_layout_theme_set(obj, "bg", "base", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
elm_layout_content_set(obj, "elm.swallow.rectangle", priv->rect);
|
||||
}
|
||||
|
|
|
@ -270,6 +270,8 @@ _efl_ui_button_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Button_Data *_pd EINA_
|
|||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "button");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
|
@ -292,7 +294,11 @@ _efl_ui_button_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Button_Data *_pd EINA_
|
|||
(_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, obj);
|
||||
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
if (!elm_layout_theme_set(obj, "button", "base", elm_widget_style_get(obj)))
|
||||
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
}
|
||||
|
||||
|
|
|
@ -1000,8 +1000,12 @@ _efl_ui_calendar_constructor_internal(Eo *obj, Efl_Ui_Calendar_Data *priv)
|
|||
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
|
||||
if (!elm_layout_theme_set(obj, "calendar", "base",
|
||||
elm_object_style_get(obj)))
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "calendar");
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
_spinner_buttons_add(obj, priv);
|
||||
|
|
|
@ -320,13 +320,12 @@ elm_check_add(Evas_Object *parent)
|
|||
EOLIAN static Eo *
|
||||
_efl_ui_check_efl_object_constructor(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
||||
{
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "check");
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
||||
|
||||
if (!elm_layout_theme_set(obj, "check", "base", elm_widget_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
efl_layout_signal_callback_add
|
||||
(wd->resize_obj, "elm,action,check,on", "*", _on_check_on, obj);
|
||||
|
|
|
@ -821,10 +821,19 @@ _efl_ui_clock_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Clock_Data *priv)
|
|||
{
|
||||
Clock_Field *field;
|
||||
int idx;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "uiclock");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
// module - initialise module for clock
|
||||
if (!dt_mod) dt_mod = _dt_mod_init();
|
||||
if (dt_mod)
|
||||
|
@ -854,9 +863,6 @@ _efl_ui_clock_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Clock_Data *priv)
|
|||
else WRN("Failed to load clock module, clock widget may not show properly!");
|
||||
|
||||
priv->freeze_sizing = EINA_TRUE;
|
||||
if (!elm_layout_theme_set(obj, "uiclock", "base",
|
||||
elm_widget_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
_field_list_init(obj);
|
||||
_reload_format(obj);
|
||||
|
|
|
@ -117,6 +117,8 @@ _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UN
|
|||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "frame");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
|
@ -129,7 +131,10 @@ _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UN
|
|||
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
if (!elm_layout_theme_set(obj, "frame", "base", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
elm_layout_sizing_eval(obj);
|
||||
|
|
|
@ -1558,11 +1558,15 @@ _efl_ui_multibuttonentry_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Multibuttone
|
|||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "multibuttonentry");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
if (!elm_layout_theme_set
|
||||
(obj, "multibuttonentry", "base", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
|
|
@ -38,6 +38,8 @@ _on_state_changed(void *data,
|
|||
EOLIAN static Efl_Object *
|
||||
_efl_ui_nstate_efl_object_constructor(Eo *obj, Efl_Ui_Nstate_Data *pd)
|
||||
{
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "nstate");
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME);
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
@ -46,9 +48,6 @@ _efl_ui_nstate_efl_object_constructor(Eo *obj, Efl_Ui_Nstate_Data *pd)
|
|||
// Default: 2 states
|
||||
pd->nstate = 2;
|
||||
|
||||
if (!elm_layout_theme_set(obj, "nstate", "base", elm_widget_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
efl_layout_signal_callback_add
|
||||
(wd->resize_obj, "elm,action,state,changed", "*", _on_state_changed, obj);
|
||||
|
|
|
@ -391,11 +391,15 @@ _efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UN
|
|||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
EFL_UI_PANES_DATA_GET(obj, sd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "panes");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
if (!elm_layout_theme_set
|
||||
(obj, "panes", "vertical", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
_efl_ui_panes_theme_group_get(obj, sd),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
elm_panes_content_left_size_set(obj, 0.5);
|
||||
|
|
|
@ -353,14 +353,18 @@ _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data
|
|||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "progressbar");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
priv->dir = EFL_UI_DIR_RIGHT;
|
||||
priv->val = MIN_RATIO_LVL;
|
||||
|
||||
if (!elm_layout_theme_set
|
||||
(obj, "progressbar", "horizontal", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
_efl_ui_progressbar_theme_group_get(obj, priv),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
efl_ui_format_string_set(obj, "%.0f %%");
|
||||
|
|
|
@ -204,13 +204,12 @@ _access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
|||
EOLIAN static Eo *
|
||||
_efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *pd)
|
||||
{
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "radio");
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
||||
|
||||
if (!elm_layout_theme_set(obj, "radio", "base", elm_widget_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
elm_layout_signal_callback_add
|
||||
(obj, "elm,action,radio,toggle", "*", _radio_on_cb, obj);
|
||||
|
|
|
@ -1130,6 +1130,8 @@ _efl_ui_slider_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Slider_Data *priv)
|
|||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "slider");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
||||
|
@ -1141,8 +1143,10 @@ _efl_ui_slider_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Slider_Data *priv)
|
|||
priv->wheel_indicator_duration = 0.25;
|
||||
priv->step = SLIDER_STEP;
|
||||
|
||||
if (!elm_layout_theme_set
|
||||
(obj, "slider", "horizontal", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
_efl_ui_slider_theme_group_get(obj, priv),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
elm_layout_signal_callback_add(obj, "drag", "*", _drag, obj);
|
||||
|
|
|
@ -219,8 +219,11 @@ _elm_video_check(Evas_Object *video)
|
|||
EOLIAN static void
|
||||
_efl_ui_video_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Video_Data *priv)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
_elm_emotion_init();
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "video");
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
|
@ -229,7 +232,10 @@ _efl_ui_video_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Video_Data *priv)
|
|||
if (!emotion_object_init(priv->emotion, NULL))
|
||||
CRI("Failed to init emotion object");
|
||||
|
||||
if (!elm_layout_theme_set(obj, "video", "base", elm_widget_style_get(obj)))
|
||||
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
elm_layout_content_set(obj, "elm.swallow.video", priv->emotion);
|
||||
|
|
|
@ -2238,12 +2238,20 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
|
|||
{
|
||||
Evas_Object *gridrows, *scroller;
|
||||
const char *fontname, *fontsize;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "code");
|
||||
elm_widget_theme_element_set(obj, "layout");
|
||||
|
||||
efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
|
||||
elm_object_focus_allow_set(obj, EINA_TRUE);
|
||||
pd->alpha = 255;
|
||||
|
||||
if (!elm_layout_theme_set(obj, "code", "layout", elm_widget_style_get(obj)))
|
||||
if (!elm_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
scroller = elm_scroller_add(obj);
|
||||
|
|
|
@ -310,7 +310,10 @@ field_create(Efl_Ui_Clock_Module_Data *module_data, Efl_Ui_Clock_Type field_typ
|
|||
|
||||
if (field_type == EFL_UI_CLOCK_TYPE_AMPM)
|
||||
{
|
||||
field_obj = elm_button_add(ctx_mod->mod_data.base);
|
||||
field_obj = efl_add(EFL_UI_BUTTON_CLASS, ctx_mod->mod_data.base,
|
||||
elm_widget_element_update(ctx_mod->mod_data.base,
|
||||
efl_added,
|
||||
PART_NAME_ARRAY[field_type]));
|
||||
efl_event_callback_add
|
||||
(field_obj, EFL_UI_EVENT_CLICKED, _ampm_clicked_cb, ctx_mod);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue