jaehwan pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=0b1fbd9cafab0491969db39a4016c5fe904350de
commit 0b1fbd9cafab0491969db39a4016c5fe904350de Author: Jaehwan Kim <[email protected]> Date: Sat Feb 8 12:27:41 2014 +0900 access: Add elm_widget_access_highlight_in_theme_set/get. This is for widget to draw the access highlight itself in theme. --- src/lib/elm_access.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- src/lib/elm_layout.c | 30 +++++++++++++++++++++++------- src/lib/elm_widget.c | 37 +++++++++++++++++++++++++++++++++++++ src/lib/elm_widget.h | 27 +++++++++++++++++++++++++++ 4 files changed, 130 insertions(+), 9 deletions(-) diff --git a/src/lib/elm_access.c b/src/lib/elm_access.c index b9dd1de..4f315d2 100644 --- a/src/lib/elm_access.c +++ b/src/lib/elm_access.c @@ -773,11 +773,33 @@ _elm_access_object_get(const Evas_Object *obj) return _elm_access_info_get(obj); } +static Evas_Object * +_elm_access_widget_target_get(Evas_Object *obj) +{ + Evas_Object *o = obj; + + do + { + if (elm_widget_is(o)) + break; + else + { + o = elm_widget_parent_widget_get(o); + if (!o) + o = evas_object_smart_parent_get(o); + } + } + while (o); + + return o; +} + EAPI void _elm_access_object_highlight(Evas_Object *obj) { - Evas_Object *o; + Evas_Object *o, *widget; Evas_Coord x, y, w, h; + Eina_Bool in_theme = EINA_FALSE; o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); if (!o) @@ -802,6 +824,15 @@ _elm_access_object_highlight(Evas_Object *obj) _access_obj_hilight_move_cb, NULL); evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_RESIZE, _access_obj_hilight_resize_cb, NULL); + + widget = _elm_access_widget_target_get(ptarget); + if (widget) + { + if (elm_widget_access_highlight_in_theme_get(widget)) + { + elm_widget_signal_emit(widget, "elm,action,access_highlight,hide", "elm"); + } + } } } evas_object_data_set(o, "_elm_access_target", obj); @@ -822,9 +853,19 @@ _elm_access_object_highlight(Evas_Object *obj) evas_object_move(o, x, y); evas_object_resize(o, w, h); + widget = _elm_access_widget_target_get(obj); + if (widget) + { + if (elm_widget_access_highlight_in_theme_get(widget)) + { + in_theme = EINA_TRUE; + elm_widget_signal_emit(widget, "elm,action,access_highlight,show", "elm"); + } + } /* use callback, should an access object do below every time when * a window gets a client message ECORE_X_ATOM_E_ILLMUE_ACTION_READ? */ - if (!_access_action_callback_call(obj, ELM_ACCESS_ACTION_HIGHLIGHT, NULL)) + if (!in_theme && + !_access_action_callback_call(obj, ELM_ACCESS_ACTION_HIGHLIGHT, NULL)) evas_object_show(o); else evas_object_hide(o); diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c index 515790e..f856044 100644 --- a/src/lib/elm_layout.c +++ b/src/lib/elm_layout.c @@ -320,10 +320,31 @@ _elm_layout_smart_disable(Eo *obj, void *_pd EINA_UNUSED, va_list *list) if (ret) *ret = EINA_TRUE; } +static void +_elm_layout_highlight_in_theme(Evas_Object *obj) +{ + const char *fh; + + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + + fh = edje_object_data_get + (wd->resize_obj, "focus_highlight"); + if ((fh) && (!strcmp(fh, "on"))) + elm_widget_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + + fh = edje_object_data_get + (wd->resize_obj, "access_highlight"); + if ((fh) && (!strcmp(fh, "on"))) + elm_widget_access_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_access_highlight_in_theme_set(obj, EINA_FALSE); +} + static Eina_Bool _elm_layout_theme_internal(Eo *obj, Elm_Layout_Smart_Data *sd) { - const char *fh; Eina_Bool ret = EINA_FALSE; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); @@ -340,12 +361,7 @@ _elm_layout_theme_internal(Eo *obj, Elm_Layout_Smart_Data *sd) (wd->resize_obj, elm_widget_scale_get(obj) * elm_config_scale_get()); - fh = edje_object_data_get - (wd->resize_obj, "focus_highlight"); - if ((fh) && (!strcmp(fh, "on"))) - elm_widget_highlight_in_theme_set(obj, EINA_TRUE); - else - elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + _elm_layout_highlight_in_theme(obj); evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL); diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 5671efb..c96f9bc 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1622,6 +1622,39 @@ _elm_widget_highlight_in_theme_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list *ret = sd->highlight_in_theme; } +EAPI void +elm_widget_access_highlight_in_theme_set(Evas_Object *obj, + Eina_Bool highlight) +{ + ELM_WIDGET_CHECK(obj); + eo_do(obj, elm_wdg_access_highlight_in_theme_set(highlight)); +} + +static void +_elm_widget_access_highlight_in_theme_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + Eina_Bool highlight = va_arg(*list, int); + Elm_Widget_Smart_Data *sd = _pd; + sd->access_highlight_in_theme = !!highlight; +} + +EAPI Eina_Bool +elm_widget_access_highlight_in_theme_get(const Evas_Object *obj) +{ + ELM_WIDGET_CHECK(obj) EINA_FALSE; + Eina_Bool ret = EINA_FALSE; + eo_do((Eo *) obj, elm_wdg_access_highlight_in_theme_get(&ret)); + return ret; +} + +static void +_elm_widget_access_highlight_in_theme_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Elm_Widget_Smart_Data *sd = _pd; + *ret = sd->access_highlight_in_theme; +} + EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj) { @@ -6468,6 +6501,8 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_HIGHLIGHT_IGNORE_GET), _elm_widget_highlight_ignore_get), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_SET), _elm_widget_highlight_in_theme_set), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_GET), _elm_widget_highlight_in_theme_get), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_SET), _elm_widget_access_highlight_in_theme_set), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_GET), _elm_widget_access_highlight_in_theme_get), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SCROLL_HOLD_PUSH), _elm_widget_scroll_hold_push), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SCROLL_HOLD_POP), _elm_widget_scroll_hold_pop), @@ -6615,6 +6650,8 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_HIGHLIGHT_IGNORE_GET, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_SET, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_GET, "description here"), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_SET, "Set the access highlight in widget theme."), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_GET, "Get the access highlight in widget theme."), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_SCROLL_HOLD_PUSH, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_SCROLL_HOLD_POP, "description here"), diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index d3fe1c3..085ac61 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -426,6 +426,7 @@ typedef struct _Elm_Widget_Smart_Data Eina_Bool tree_unfocusable : 1; Eina_Bool highlight_ignore : 1; Eina_Bool highlight_in_theme : 1; + Eina_Bool access_highlight_in_theme : 1; Eina_Bool disabled : 1; Eina_Bool is_mirrored : 1; Eina_Bool mirrored_auto_mode : 1; /* This is @@ -623,6 +624,8 @@ EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Boo EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj); EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight); EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj); +EAPI void elm_widget_access_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight); +EAPI Eina_Bool elm_widget_access_highlight_in_theme_get(const Evas_Object *obj); EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj); EAPI Eina_Bool elm_widget_highlight_get(const Evas_Object *obj); EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj); @@ -1156,6 +1159,8 @@ enum ELM_WIDGET_SUB_ID_HIGHLIGHT_IGNORE_GET, ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_SET, ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_GET, + ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_SET, + ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_GET, ELM_WIDGET_SUB_ID_SCROLL_HOLD_PUSH, ELM_WIDGET_SUB_ID_SCROLL_HOLD_POP, @@ -1597,6 +1602,28 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l); #define elm_wdg_highlight_in_theme_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_HIGHLIGHT_IN_THEME_GET), EO_TYPECHECK(Eina_Bool *, ret) /** + * @def elm_wdg_access_highlight_in_theme_set + * @since 1.9 + * + * No description supplied by the EAPI. + * + * @param[in] access highlight + * + */ +#define elm_wdg_access_highlight_in_theme_set(highlight) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_SET), EO_TYPECHECK(Eina_Bool, highlight) + +/** + * @def elm_wdg_access_highlight_in_theme_get + * @since 1.9 + * + * No description supplied by the EAPI. + * + * @param[out] ret + * + */ +#define elm_wdg_access_highlight_in_theme_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS_HIGHLIGHT_IN_THEME_GET), EO_TYPECHECK(Eina_Bool *, ret) + +/** * @def elm_wdg_scroll_hold_push * @since 1.8 * --
