efl_ui_widget: make Elm.Widget.theme, Elm.Widget.theme_object internal

This commit is contained in:
Sungtaek Hong 2017-11-17 17:24:39 +09:00
parent fc8cc4a9b3
commit 751cf2c0d0
15 changed files with 37 additions and 73 deletions

View File

@ -112,7 +112,7 @@ _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); evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _on_resize, obj);
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -295,7 +295,7 @@ _efl_ui_button_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Button_Data *_pd EINA_
elm_widget_can_focus_set(obj, EINA_TRUE); elm_widget_can_focus_set(obj, EINA_TRUE);
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -1002,7 +1002,7 @@ _efl_ui_calendar_constructor_internal(Eo *obj, Efl_Ui_Calendar_Data *priv)
if (!elm_widget_theme_klass_get(obj)) if (!elm_widget_theme_klass_get(obj))
elm_widget_theme_klass_set(obj, "calendar"); elm_widget_theme_klass_set(obj, "calendar");
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -828,7 +828,7 @@ _efl_ui_clock_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Clock_Data *priv)
efl_canvas_group_add(efl_super(obj, MY_CLASS)); efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj); elm_widget_sub_object_parent_add(obj);
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -131,7 +131,7 @@ _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); elm_widget_can_focus_set(obj, EINA_FALSE);
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -1563,7 +1563,7 @@ _efl_ui_multibuttonentry_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Multibuttone
efl_canvas_group_add(efl_super(obj, MY_CLASS)); efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj); elm_widget_sub_object_parent_add(obj);
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -396,7 +396,7 @@ _efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UN
efl_canvas_group_add(efl_super(obj, MY_CLASS)); efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj); elm_widget_sub_object_parent_add(obj);
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
_efl_ui_panes_theme_group_get(obj, sd), _efl_ui_panes_theme_group_get(obj, sd),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -361,7 +361,7 @@ _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data
priv->dir = EFL_UI_DIR_RIGHT; priv->dir = EFL_UI_DIR_RIGHT;
priv->val = MIN_RATIO_LVL; priv->val = MIN_RATIO_LVL;
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
_efl_ui_progressbar_theme_group_get(obj, priv), _efl_ui_progressbar_theme_group_get(obj, priv),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -655,9 +655,9 @@ _popup_update(Evas_Object *obj, Efl_Ui_Slider_Data *sd, Evas_Object *popup)
if (elm_widget_is_legacy(obj)) if (elm_widget_is_legacy(obj))
{ {
if (_is_horizontal(sd->dir)) if (_is_horizontal(sd->dir))
efl_ui_widget_theme_object_set(obj, popup, "slider", "horizontal/popup", elm_widget_style_get(obj)); elm_widget_theme_object_set(obj, popup, "slider", "horizontal/popup", elm_widget_style_get(obj));
else else
efl_ui_widget_theme_object_set(obj, popup, "slider", "vertical/popup", elm_widget_style_get(obj)); elm_widget_theme_object_set(obj, popup, "slider", "vertical/popup", elm_widget_style_get(obj));
} }
else else
elm_widget_element_update(obj, popup, PART_NAME_POPUP); elm_widget_element_update(obj, popup, PART_NAME_POPUP);
@ -1143,7 +1143,7 @@ _efl_ui_slider_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Slider_Data *priv)
priv->wheel_indicator_duration = 0.25; priv->wheel_indicator_duration = 0.25;
priv->step = SLIDER_STEP; priv->step = SLIDER_STEP;
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
_efl_ui_slider_theme_group_get(obj, priv), _efl_ui_slider_theme_group_get(obj, priv),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -3011,7 +3011,7 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv)
if (!elm_widget_theme_klass_get(obj)) if (!elm_widget_theme_klass_get(obj))
elm_widget_theme_klass_set(obj, "text"); elm_widget_theme_klass_set(obj, "text");
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
_efl_ui_text_theme_group_get(obj), _efl_ui_text_theme_group_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -232,7 +232,7 @@ _efl_ui_video_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Video_Data *priv)
if (!emotion_object_init(priv->emotion, NULL)) if (!emotion_object_init(priv->emotion, NULL))
CRI("Failed to init emotion object"); CRI("Failed to init emotion object");
if (!efl_ui_widget_theme_object_set(obj, wd->resize_obj, if (!elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
elm_widget_theme_element_get(obj), elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj))) elm_widget_theme_style_get(obj)))

View File

@ -1170,7 +1170,7 @@ _elm_win_focus_highlight_reconfigure_job(void *data)
else else
str = "default"; str = "default";
efl_ui_widget_theme_object_set elm_widget_theme_object_set
(sd->obj, fobj, "focus_highlight", "top", str); (sd->obj, fobj, "focus_highlight", "top", str);
sd->focus_highlight.theme_changed = EINA_FALSE; sd->focus_highlight.theme_changed = EINA_FALSE;
@ -3153,15 +3153,15 @@ _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor)
if (cursor) if (cursor)
{ {
if (!efl_ui_widget_theme_object_set(sd->obj, sd->pointer.obj, if (!elm_widget_theme_object_set(sd->obj, sd->pointer.obj,
"cursor", cursor, "default")) "cursor", cursor, "default"))
{ {
efl_ui_widget_theme_object_set(sd->obj, sd->pointer.obj, elm_widget_theme_object_set(sd->obj, sd->pointer.obj,
"pointer", "base", "default"); "pointer", "base", "default");
} }
} }
else else
efl_ui_widget_theme_object_set(sd->obj, sd->pointer.obj, elm_widget_theme_object_set(sd->obj, sd->pointer.obj,
"pointer", "base", "default"); "pointer", "base", "default");
edje_object_size_min_get(sd->pointer.obj, &mw, &mh); edje_object_size_min_get(sd->pointer.obj, &mw, &mh);
@ -3976,7 +3976,7 @@ _elm_win_frame_cb_resize_show(void *data,
{ {
Efl_Ui_Win_Move_Resize_Mode mode = _move_resize_mode_get(source); Efl_Ui_Win_Move_Resize_Mode mode = _move_resize_mode_get(source);
const resize_info *ri = _resize_info_get(sd->rot, mode); const resize_info *ri = _resize_info_get(sd->rot, mode);
if (ri) efl_ui_widget_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", ri->cursor); if (ri) elm_widget_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", ri->cursor);
} }
#else #else
(void)source; (void)source;
@ -3996,7 +3996,7 @@ _elm_win_frame_cb_resize_hide(void *data,
#ifdef HAVE_ELEMENTARY_WL2 #ifdef HAVE_ELEMENTARY_WL2
if (sd->pointer.obj) if (sd->pointer.obj)
efl_ui_widget_theme_object_set(sd->obj, sd->pointer.obj, elm_widget_theme_object_set(sd->obj, sd->pointer.obj,
"pointer", "base", "default"); "pointer", "base", "default");
#endif #endif
} }
@ -4288,7 +4288,7 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style)
v = version ? atoi(version) : 0; v = version ? atoi(version) : 0;
if (EINA_LIKELY(v >= FRAME_OBJ_THEME_MIN_VERSION)) if (EINA_LIKELY(v >= FRAME_OBJ_THEME_MIN_VERSION))
{ {
if (!efl_ui_widget_theme_object_set if (!elm_widget_theme_object_set
(sd->obj, sd->frame_obj, "border", element, style)) (sd->obj, sd->frame_obj, "border", element, style))
{ {
ERR("Failed to set main border theme for the window."); ERR("Failed to set main border theme for the window.");
@ -5241,7 +5241,7 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U
Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0; Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0;
sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee)); sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee));
efl_ui_widget_theme_object_set(obj, o, "pointer", "base", "default"); elm_widget_theme_object_set(obj, o, "pointer", "base", "default");
edje_object_size_min_calc(o, &mw, &mh); edje_object_size_min_calc(o, &mw, &mh);
evas_object_resize(o, mw, mh); evas_object_resize(o, mw, mh);
edje_object_part_geometry_get(o, "elm.swallow.hotspot", edje_object_part_geometry_get(o, "elm.swallow.hotspot",
@ -6518,7 +6518,7 @@ _elm_win_theme_internal(Eo *obj, Efl_Ui_Win_Data *sd)
Eina_Bool ret = EINA_FALSE, prev_alpha; Eina_Bool ret = EINA_FALSE, prev_alpha;
const char *s; const char *s;
int_ret = efl_ui_widget_theme_object_set(obj, sd->legacy.edje, "win", "base", int_ret = elm_widget_theme_object_set(obj, sd->legacy.edje, "win", "base",
elm_widget_style_get(obj)); elm_widget_style_get(obj));
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;

View File

@ -2661,9 +2661,10 @@ _elm_widget_efl_gfx_scale_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
return sd->scale; return sd->scale;
} }
EOLIAN static void EAPI void
_elm_widget_theme_set(Eo *obj, Elm_Widget_Smart_Data *sd, Elm_Theme *th) elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th)
{ {
ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd);
Eina_Bool apply = EINA_FALSE; Eina_Bool apply = EINA_FALSE;
if (sd->theme != th) if (sd->theme != th)
{ {
@ -2675,13 +2676,6 @@ _elm_widget_theme_set(Eo *obj, Elm_Widget_Smart_Data *sd, Elm_Theme *th)
} }
} }
/* beta in eo */
EAPI void
elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th)
{
efl_ui_widget_theme_set(obj, th);
}
EAPI void EAPI void
elm_widget_part_text_set(Eo *obj, const char *part, const char *label) elm_widget_part_text_set(Eo *obj, const char *part, const char *label)
{ {
@ -2883,9 +2877,11 @@ _elm_widget_access_info_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
return sd->access_info; return sd->access_info;
} }
EOLIAN static Elm_Theme* EAPI Elm_Theme *
_elm_widget_theme_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) elm_widget_theme_get(const Evas_Object *obj)
{ {
ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd, NULL);
if (!sd->theme) if (!sd->theme)
{ {
if (sd->parent_obj && elm_widget_is(sd->parent_obj)) if (sd->parent_obj && elm_widget_is(sd->parent_obj))
@ -2895,13 +2891,6 @@ _elm_widget_theme_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
return sd->theme; return sd->theme;
} }
/* beta in eo */
EAPI Elm_Theme *
elm_widget_theme_get(const Evas_Object *obj)
{
return efl_ui_widget_theme_get(obj);
}
EOLIAN static Efl_Ui_Theme_Apply EOLIAN static Efl_Ui_Theme_Apply
_elm_widget_style_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *style) _elm_widget_style_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *style)
{ {
@ -3013,9 +3002,11 @@ elm_widget_scroll_child_locked_y_get(const Eo *obj)
return sd->child_drag_y_locked; return sd->child_drag_y_locked;
} }
EOLIAN static Efl_Ui_Theme_Apply EAPI Efl_Ui_Theme_Apply
_elm_widget_theme_object_set(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle) elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle)
{ {
ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd, EFL_UI_THEME_APPLY_FAILED);
if (eina_streq(welement, "base")) if (eina_streq(welement, "base"))
welement = NULL; welement = NULL;
if (eina_streq(wstyle, "default")) if (eina_streq(wstyle, "default"))
@ -3036,13 +3027,6 @@ _elm_widget_theme_object_set(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *ed
return ret; return ret;
} }
/* beta in eo */
EAPI Efl_Ui_Theme_Apply
elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle)
{
return efl_ui_widget_theme_object_set(obj, edj, wname, welement, wstyle);
}
static void static void
_convert(Efl_Dbg_Info *info, Eina_Iterator *ptr_list) _convert(Efl_Dbg_Info *info, Eina_Iterator *ptr_list)
{ {
@ -3702,7 +3686,7 @@ elm_widget_element_update(Evas_Object *obj, Evas_Object *component, const char *
} }
else else
{ {
ret = efl_ui_widget_theme_object_set(obj, component, ret = elm_widget_theme_object_set(obj, component,
elm_widget_theme_klass_get(obj), elm_widget_theme_klass_get(obj),
(const char *)group, (const char *)group,
elm_widget_theme_style_get(obj)); elm_widget_theme_style_get(obj));

View File

@ -202,26 +202,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Efl.Access,
} }
} }
/* Theme API: Not bound to EO */
@property theme @beta {
[[Widget theme]]
values {
th: ptr(Elm.Theme) @nullable; [[Elementary theme]]
}
}
@property theme_object @beta {
[[Theme object property]]
set {
return: Efl.Ui.Theme.Apply; [[Theme apply]]
}
values {
edj: Efl.Canvas.Object; [[Edje object]]
wname: string; [[Widget name]]
welement: string; [[Widget element]]
wstyle: string; [[Widget style]]
}
}
/* Accessibility */ /* Accessibility */
@property access_info { @property access_info {
[[Accessibility information. [[Accessibility information.

View File

@ -270,7 +270,7 @@ _elm_cursor_obj_add(Evas_Object *obj, Elm_Cursor *cur)
cur->obj = edje_object_add(cur->evas); cur->obj = edje_object_add(cur->evas);
if (!cur->obj) return EINA_FALSE; if (!cur->obj) return EINA_FALSE;
if (!efl_ui_widget_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name, if (!elm_widget_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
cur->style ? cur->style : "default")) cur->style ? cur->style : "default"))
{ {
ELM_SAFE_FREE(cur->obj, evas_object_del); ELM_SAFE_FREE(cur->obj, evas_object_del);
@ -740,7 +740,7 @@ _elm_widget_efl_ui_cursor_cursor_style_set(Evas_Object *obj, Elm_Widget_Smart_Da
} }
else else
{ {
if (!efl_ui_widget_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name, if (!elm_widget_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
style)) style))
{ {
ERR("Could not apply the theme to the cursor style=%s", style); ERR("Could not apply the theme to the cursor style=%s", style);
@ -768,7 +768,7 @@ void
elm_cursor_theme(Elm_Cursor *cur) elm_cursor_theme(Elm_Cursor *cur)
{ {
if ((!cur) || (!cur->obj)) return; if ((!cur) || (!cur->obj)) return;
if (!efl_ui_widget_theme_object_set(cur->owner, cur->obj, "cursor", if (!elm_widget_theme_object_set(cur->owner, cur->obj, "cursor",
cur->cursor_name, cur->style)) cur->cursor_name, cur->style))
ERR("Could not apply the theme to the cursor style=%s", cur->style); ERR("Could not apply the theme to the cursor style=%s", cur->style);
else else