win: Merge focus_highlight_style with widget (EO)

Note: elm_test "Focus Style" can be used to test this API. The test case
is a bit broken (overly complex EDC?) but if you're patient you can see
the difference between "glow" and "glow_effect".

Ref T5363
Ref T5322
This commit is contained in:
Jean-Philippe Andre 2017-08-31 15:42:52 +09:00
parent c0d7ea4af0
commit 0972c49438
5 changed files with 53 additions and 26 deletions

View File

@ -8,7 +8,8 @@ glow_effect_on_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{ {
Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable"); Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable");
if (elm_check_state_get(chk)) elm_win_focus_highlight_style_set(data, "glow_effect"); if (elm_check_state_get(chk))
elm_win_focus_highlight_style_set(data, "glow_effect");
} }
static void static void
@ -16,7 +17,8 @@ glow_effect_off_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{ {
Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable"); Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable");
if (elm_check_state_get(chk)) elm_win_focus_highlight_style_set(data, "glow"); if (elm_check_state_get(chk))
elm_win_focus_highlight_style_set(data, "glow");
} }
void void

View File

@ -6344,16 +6344,19 @@ _efl_ui_win_elm_widget_theme_apply(Eo *obj, Efl_Ui_Win_Data *sd)
return int_ret; return int_ret;
} }
EOLIAN static void EOLIAN static Eina_Bool
_efl_ui_win_focus_highlight_style_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *style) _efl_ui_win_elm_widget_focus_highlight_style_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *style)
{ {
eina_stringshare_replace(&sd->focus_highlight.style, style); if (!eina_stringshare_replace(&sd->focus_highlight.style, style))
return EINA_TRUE;
sd->focus_highlight.theme_changed = EINA_TRUE; sd->focus_highlight.theme_changed = EINA_TRUE;
_elm_win_focus_highlight_reconfigure_job_start(sd); _elm_win_focus_highlight_reconfigure_job_start(sd);
return EINA_TRUE;
} }
EOLIAN static const char* EOLIAN static const char*
_efl_ui_win_focus_highlight_style_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) _efl_ui_win_elm_widget_focus_highlight_style_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
{ {
return sd->focus_highlight.style; return sd->focus_highlight.style;
} }
@ -8163,6 +8166,19 @@ elm_win_focus_get(const Efl_Ui_Win *obj)
return elm_obj_widget_focus_get(obj); return elm_obj_widget_focus_get(obj);
} }
EAPI void
elm_win_focus_highlight_style_set(Elm_Win *obj, const char *style)
{
elm_widget_focus_highlight_style_set(obj, style);
}
EAPI const char *
elm_win_focus_highlight_style_get(const Elm_Win *obj)
{
return elm_widget_focus_highlight_style_get(obj);
}
// deprecated // deprecated
EAPI void EAPI void

View File

@ -268,22 +268,6 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Elm.Interface.Atspi.Window,
constrain: bool; [[$true to restrict the window's maximum size.]] constrain: bool; [[$true to restrict the window's maximum size.]]
} }
} }
@property focus_highlight_style {
set {
[[Set the style for the focus highlight on this window.
Sets the style to use for theming the highlight of focused
objects on the given window. If $style is NULL, the default
will be used.
]]
}
get {
[[Get the style set for the focus highlight object.]]
}
values {
style: string @nullable; [[The style or $null if none.]]
}
}
@property focus_highlight_enabled { @property focus_highlight_enabled {
set { set {
[[Set the enabled status for the focus highlight in a window. [[Set the enabled status for the focus highlight in a window.
@ -900,6 +884,7 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Elm.Interface.Atspi.Window,
Elm.Widget.focus_next; Elm.Widget.focus_next;
Elm.Widget.theme_apply; Elm.Widget.theme_apply;
Elm.Widget.focus { get; } Elm.Widget.focus { get; }
Elm.Widget.focus_highlight_style { get; set; }
Elm.Widget.on_focus_update; Elm.Widget.on_focus_update;
Elm.Widget.widget_event; Elm.Widget.widget_event;
Elm.Widget.focus_manager_factory; Elm.Widget.focus_manager_factory;

View File

@ -517,14 +517,17 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
} }
} }
@property focus_highlight_style { @property focus_highlight_style {
[[Control the widget focus highlight style.]] [[Control the widget focus highlight style.
If $style is $null, the default will be used.
]]
set { set {
return: bool; [[$true on success, $false otherwise.]] return: bool; [[$true on success, $false otherwise.]]
} }
get { get {
} }
values { values {
style: string; [[The name of the focus highlight style.]] style: string @nullable; [[The name of the focus highlight style.]]
} }
} }

View File

@ -1147,7 +1147,7 @@ EAPI Evas_Object *elm_win_get(Evas_Object *obj);
* *
* @ingroup Efl_Ui_Win * @ingroup Efl_Ui_Win
*/ */
EAPI Eina_Bool elm_win_socket_listen(Efl_Ui_Win *obj, const char *svcname, int svcnum, Eina_Bool svcsys); EAPI Eina_Bool elm_win_socket_listen(Elm_Win *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
/** /**
* @brief Get whether a window has focus. * @brief Get whether a window has focus.
@ -1156,4 +1156,25 @@ EAPI Eina_Bool elm_win_socket_listen(Efl_Ui_Win *obj, const char *svcname, int s
* *
* @ingroup Efl_Ui_Win * @ingroup Efl_Ui_Win
*/ */
EAPI Eina_Bool elm_win_focus_get(const Efl_Ui_Win *obj); EAPI Eina_Bool elm_win_focus_get(const Elm_Win *obj);
/**
* @brief Set the style for the focus highlight on this window.
*
* Sets the style to use for theming the highlight of focused objects on the
* given window. If @c style is NULL, the default will be used.
*
* @param[in] style The style or @c null if none.
*
* @ingroup Efl_Ui_Win
*/
EAPI void elm_win_focus_highlight_style_set(Elm_Win *obj, const char *style);
/**
* @brief Get the style set for the focus highlight object.
*
* @return The style or @c null if none.
*
* @ingroup Efl_Ui_Win
*/
EAPI const char *elm_win_focus_highlight_style_get(const Elm_Win *obj);