forked from enlightenment/efl
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
This commit is contained in:
parent
b40d8296ff
commit
4e81df7cb2
|
@ -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);
|
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
|
static Eina_Bool
|
||||||
_tree_unfocusable(Eo *obj)
|
_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
|
static void
|
||||||
_parent_focus(Evas_Object *obj, Elm_Object_Item *item)
|
_parent_focus(Evas_Object *obj, Elm_Object_Item *item)
|
||||||
{
|
{
|
||||||
|
|
|
@ -516,27 +516,23 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
||||||
region: Eina.Rectangle; [[The rectangle area.]]
|
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 {
|
@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 {
|
||||||
[[Set the enabled status for the focus highlight in a window.
|
[[Set the enabled status for the focus highlight in a window.
|
||||||
|
|
||||||
This function will enable or disable the focus highlight only
|
This function will enable or disable the focus highlight,
|
||||||
for the given window, regardless of the global setting for it.
|
regardless of the global setting for it.
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
|
@ -546,15 +542,47 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
||||||
enabled: bool; [[The enabled value for the highlight.]]
|
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 {
|
@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 {
|
||||||
[[Set the animate status for the focus highlight for this window.
|
[[Set the animate status for the focus highlight for this window.
|
||||||
|
|
||||||
This function will enable or disable the animation of focus
|
This function will enable or disable the animation of focus
|
||||||
highlight only for the given window. If the widget is not a
|
highlight.
|
||||||
window, then this call is forwarded to the window (using
|
|
||||||
@.widget_top).
|
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -407,7 +407,6 @@ typedef struct _Elm_Widget_Smart_Data
|
||||||
double scale;
|
double scale;
|
||||||
Elm_Theme *theme;
|
Elm_Theme *theme;
|
||||||
const char *style;
|
const char *style;
|
||||||
const char *focus_highlight_style; /**< custom focus style for a widget */
|
|
||||||
const char *access_info;
|
const char *access_info;
|
||||||
const char *accessible_name;
|
const char *accessible_name;
|
||||||
unsigned int focus_order;
|
unsigned int focus_order;
|
||||||
|
|
Loading…
Reference in New Issue