summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-11-14 22:03:25 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-29 11:53:18 +0900
commit0ab10ddd4068c34b872417962fd741722018a10e (patch)
treeff9a4b2182433addaf1d80967190aacf96dea037
parenta088b73bc0cb6385776db1736ba1266c65d6d47d (diff)
downloadefl-0ab10ddd4068c34b872417962fd741722018a10e.tar.gz
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
-rw-r--r--src/lib/elementary/efl_ui_bg.c8
-rw-r--r--src/lib/elementary/efl_ui_button.c8
-rw-r--r--src/lib/elementary/efl_ui_calendar.c8
-rw-r--r--src/lib/elementary/efl_ui_check.c5
-rw-r--r--src/lib/elementary/efl_ui_clock.c12
-rw-r--r--src/lib/elementary/efl_ui_frame.c7
-rw-r--r--src/lib/elementary/efl_ui_multibuttonentry.c8
-rw-r--r--src/lib/elementary/efl_ui_nstate.c5
-rw-r--r--src/lib/elementary/efl_ui_panes.c8
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c8
-rw-r--r--src/lib/elementary/efl_ui_radio.c5
-rw-r--r--src/lib/elementary/efl_ui_slider.c8
-rw-r--r--src/lib/elementary/efl_ui_video.c8
-rw-r--r--src/lib/elementary/elm_code_widget.c28
-rw-r--r--src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c5
15 files changed, 97 insertions, 34 deletions
diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c
index 3a38c4a284..38ac41a37c 100644
--- a/src/lib/elementary/efl_ui_bg.c
+++ b/src/lib/elementary/efl_ui_bg.c
@@ -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);
}
diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c
index 36eaebd5bf..879d420409 100644
--- a/src/lib/elementary/efl_ui_button.c
+++ b/src/lib/elementary/efl_ui_button.c
@@ -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!");
}
diff --git a/src/lib/elementary/efl_ui_calendar.c b/src/lib/elementary/efl_ui_calendar.c
index df5e9d6a38..1a8f43f5f5 100644
--- a/src/lib/elementary/efl_ui_calendar.c
+++ b/src/lib/elementary/efl_ui_calendar.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c
index d0997bad4a..b8887ff6ac 100644
--- a/src/lib/elementary/efl_ui_check.c
+++ b/src/lib/elementary/efl_ui_check.c
@@ -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_canvas_layout_signal_callback_add
(wd->resize_obj, "elm,action,check,on", "*", _on_check_on, obj);
diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c
index b32e7aa8dd..fea20899bf 100644
--- a/src/lib/elementary/efl_ui_clock.c
+++ b/src/lib/elementary/efl_ui_clock.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c
index 2ca12ad428..e3679af604 100644
--- a/src/lib/elementary/efl_ui_frame.c
+++ b/src/lib/elementary/efl_ui_frame.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c
index 577faeb7f8..0ae8c20bfa 100644
--- a/src/lib/elementary/efl_ui_multibuttonentry.c
+++ b/src/lib/elementary/efl_ui_multibuttonentry.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_nstate.c b/src/lib/elementary/efl_ui_nstate.c
index b1798cf774..44494b83c8 100644
--- a/src/lib/elementary/efl_ui_nstate.c
+++ b/src/lib/elementary/efl_ui_nstate.c
@@ -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_canvas_layout_signal_callback_add
(wd->resize_obj, "elm,action,state,changed", "*", _on_state_changed, obj);
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index 893ee1d72a..706dbcc603 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c
index 88035cac02..e43f937b67 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -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 %%");
diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c
index f0b4f563fd..edfd2db80f 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c
index 4ccbb660f3..acb95f7f11 100644
--- a/src/lib/elementary/efl_ui_slider.c
+++ b/src/lib/elementary/efl_ui_slider.c
@@ -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);
diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c
index 1aac7224ef..70db16e720 100644
--- a/src/lib/elementary/efl_ui_video.c
+++ b/src/lib/elementary/efl_ui_video.c
@@ -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);
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 774e763c78..2fd8e258f4 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -2199,6 +2199,18 @@ _elm_code_widget_elm_widget_theme_apply(Eo *obj, Elm_Code_Widget_Data *pd)
int r, g, b, a;
unsigned int i;
Evas_Object *grid, *background;
+ const char *fontname, *fontsize;
+
+ if (!efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)))
+ {
+ CRI("Failed to set layout!");
+ return EFL_UI_THEME_APPLY_FAILED;
+ }
+
+ fontname = edje_object_data_get(elm_layout_edje_get(obj), "font.name");
+ fontsize = edje_object_data_get(elm_layout_edje_get(obj), "font.size");
+ if (fontname && fontsize)
+ _elm_code_widget_font_set(obj, pd, fontname, atoi(fontsize));
edje = elm_layout_edje_get(obj);
edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a,
@@ -2220,12 +2232,19 @@ EOLIAN static void
_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
{
Evas_Object *background, *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);
- 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);
@@ -2242,11 +2261,6 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
evas_object_show(background);
elm_object_part_content_set(scroller, "elm.swallow.background", background);
- fontname = edje_object_data_get(elm_layout_edje_get(obj), "font.name");
- fontsize = edje_object_data_get(elm_layout_edje_get(obj), "font.size");
- if (fontname && fontsize)
- _elm_code_widget_font_set(obj, pd, fontname, atoi(fontsize));
-
gridrows = elm_box_add(scroller);
evas_object_size_hint_weight_set(gridrows, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(gridrows, EVAS_HINT_FILL, 0.0);
diff --git a/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c b/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c
index 72884b96a7..9e9d08dcb2 100644
--- a/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c
+++ b/src/modules/elementary/clock_input_ctxpopup/clock_input_ctxpopup.c
@@ -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);
}