diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 8d5fe3a1ae..aae92a4e24 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -234,6 +234,30 @@ _elm_widget_focus_highlight_animate_set(Eo *obj, Elm_Widget_Smart_Data *sd EINA_ elm_win_focus_highlight_animate_set(win, enable); } +EOLIAN static Eina_Bool +_elm_widget_focus_highlight_style_set(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *style) +{ + // Forward to closest parent Window + Evas_Object *win = elm_widget_top_get(obj); + + if (win && efl_isa(win, EFL_UI_WIN_CLASS)) + return elm_obj_widget_focus_highlight_style_set(win, style); + + return EINA_FALSE; +} + +EOLIAN static const char * +_elm_widget_focus_highlight_style_get(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED) +{ + // Forward to closest parent Window + Evas_Object *win = elm_widget_top_get(obj); + + if (win && efl_isa(win, EFL_UI_WIN_CLASS)) + return elm_win_focus_highlight_style_get(win); + + return NULL; +} + static Eina_Bool _tree_unfocusable(Eo *obj) { @@ -1117,22 +1141,6 @@ _elm_widget_focus_region_show(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED) } } -EOLIAN static Eina_Bool -_elm_widget_focus_highlight_style_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, const char *style) -{ - // FIXME: This does not return the proper error code! Who cares if the - // string was changed?? This should return false if the desired style does - // not exist... - if (eina_stringshare_replace(&sd->focus_highlight_style, style)) return EINA_TRUE; - return EINA_FALSE; -} - -EOLIAN static const char* -_elm_widget_focus_highlight_style_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) -{ - return sd->focus_highlight_style; -} - static void _parent_focus(Evas_Object *obj, Elm_Object_Item *item) { diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index 08cbd8f87c..ebeea3dc14 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -516,27 +516,23 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, region: Eina.Rectangle; [[The rectangle area.]] } } - @property focus_highlight_style { - [[Control the widget focus highlight style. - - If $style is $null, the default will be used. - ]] - set { - return: bool; [[$true on success, $false otherwise.]] - } - get { - } - values { - style: string @nullable; [[The name of the focus highlight style.]] - } - } @property focus_highlight_enabled { - [[Whether focus highlight is enabled or not.]] + [[Whether focus highlight is enabled or not. + + As of EFL 1.21 focus highlight properties apply to a single window, + not a single widget. As a consequence, calls to this function may + be forwarded to the parent window. Future versions of EFL may + implement widget-specific focus highlight properties. + + See also @.widget_top. + See also @.focus_highlight_style. + See also @.focus_highlight_animate. + ]] set { [[Set the enabled status for the focus highlight in a window. - This function will enable or disable the focus highlight only - for the given window, regardless of the global setting for it. + This function will enable or disable the focus highlight, + regardless of the global setting for it. ]] } get { @@ -546,15 +542,47 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, enabled: bool; [[The enabled value for the highlight.]] } } + @property focus_highlight_style { + [[Control the widget focus highlight style. + + If $style is $null, the default will be used. + + As of EFL 1.21 focus highlight properties apply to a single window, + not a single widget. As a consequence, calls to this function may + be forwarded to the parent window. Future versions of EFL may + implement widget-specific focus highlight properties. + + See also @.widget_top. + See also @.focus_highlight_enabled. + See also @.focus_highlight_animate. + ]] + set { + /* FIXME: This is async... success here means nothing. */ + return: bool; [[$true on success, $false otherwise.]] + } + get { + } + values { + style: string @nullable; [[The name of the focus highlight style.]] + } + } @property focus_highlight_animate { - [[Whether focus highlight should animate or not.]] + [[Whether focus highlight should animate or not. + + As of EFL 1.21 focus highlight properties apply to a single window, + not a single widget. As a consequence, calls to this function may + be forwarded to the parent window. Future versions of EFL may + implement widget-specific focus highlight properties. + + See also @.widget_top. + See also @.focus_highlight_style. + See also @.focus_highlight_enabled. + ]] set { [[Set the animate status for the focus highlight for this window. This function will enable or disable the animation of focus - highlight only for the given window. If the widget is not a - window, then this call is forwarded to the window (using - @.widget_top). + highlight. ]] } get { diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index fe8f6c329f..3bd9b02521 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -407,7 +407,6 @@ typedef struct _Elm_Widget_Smart_Data double scale; Elm_Theme *theme; const char *style; - const char *focus_highlight_style; /**< custom focus style for a widget */ const char *access_info; const char *accessible_name; unsigned int focus_order;