diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-08-31 16:10:43 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-09-01 10:09:37 +0900 |
commit | 4e81df7cb2ee558cf5a9137835e46dbaa0dce35d (patch) | |
tree | 02fd190964c324d151e023895eba6f991746f78e | |
parent | b40d8296ffe5d216c4a3458b8b6acdf5b35a4f55 (diff) | |
download | efl-4e81df7cb2ee558cf5a9137835e46dbaa0dce35d.tar.gz |
widget: Forward focus_highlight_style to win
See the previous commits. All focus_highlight APIs are defined in the
Widget class but only implemented at the Window level. For consistency I
believe this call should also be forwarded to the window. The previous
logic had absolutely no effect at all, except storing a stringshare.
The day focus_highlight becomes widget-specific (i.e. each widget has
its own highlight style) then this can be changed.
Note: This will apply to legacy API as well.
Ref T5363
-rw-r--r-- | src/lib/elementary/elm_widget.c | 40 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget.eo | 64 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget.h | 1 |
3 files changed, 70 insertions, 35 deletions
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,45 +516,73 @@ 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. + @property focus_highlight_enabled { + [[Whether focus highlight is enabled or not. - 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_style. + See also @.focus_highlight_animate. ]] set { - return: bool; [[$true on success, $false otherwise.]] + [[Set the enabled status for the focus highlight in a window. + + This function will enable or disable the focus highlight, + regardless of the global setting for it. + ]] } get { + [[Get the enabled value of the focus highlight for this window.]] } values { - style: string @nullable; [[The name of the focus highlight style.]] + enabled: bool; [[The enabled value for the highlight.]] } } - @property focus_highlight_enabled { - [[Whether focus highlight is enabled or not.]] - set { - [[Set the enabled status for the focus highlight in a window. + @property focus_highlight_style { + [[Control the widget focus highlight style. - This function will enable or disable the focus highlight only - for the given window, regardless of the global setting for it. - ]] + 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 { - [[Get the enabled value of the focus highlight for this window.]] } values { - enabled: bool; [[The enabled value for the highlight.]] + 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; |