elm_win focus: Added elm_win_focus_highlight_animate_set/get APIs.

Now one can manually enable/disable focus highlight animation for a specific window on run-time.
This commit is contained in:
Daniel Juyung Seo 2013-08-11 18:58:28 +09:00
parent 20f58390d7
commit dd3fb75651
6 changed files with 132 additions and 5 deletions

View File

@ -1542,3 +1542,7 @@
* Popup: Fix the corrupted internal widget tree that caused
elm_theme_set() doesn't work correctly.
2013-08-11 Daniel Juyung Seo (SeoZ)
* Win Focus: Added elm_win_focus_highlight_animate_set/get().

View File

@ -82,6 +82,7 @@ Additions:
* Add elm_access_highlight_next_set, export elm_widget_focus_region_show
* File Selector : Support elm_object_part_text_set() for the ok, cancel part to change the OK, Cancel button label.
* Add _elm_access_object_get, deprecate _elm_access_info_get
* Add elm_win_focus_highlight_animate_set/get().
Improvements:

View File

@ -125,6 +125,13 @@ win_highlight_enabled_cb(void *data, Evas_Object *obj, void *event_info __UNUSED
elm_check_state_get(obj));
}
static void
win_highlight_animate_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
elm_win_focus_highlight_animate_set((Evas_Object *)data,
elm_check_state_get(obj));
}
static void
custom_chain_unset_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
@ -209,6 +216,7 @@ test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
win = elm_win_util_standard_add("focus4", "Focus 4");
elm_win_autodel_set(win, EINA_TRUE);
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
elm_win_focus_highlight_animate_set(win, EINA_TRUE);
elm_config_focus_highlight_enabled_set(EINA_TRUE);
elm_config_focus_highlight_animate_set(EINA_TRUE);
@ -234,7 +242,7 @@ test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
elm_object_text_set(tg, "Focus Highlight Animate (Config)");
elm_check_state_set(tg, EINA_TRUE);
evas_object_smart_callback_add(tg, "changed", highlight_animate_cb, NULL);
elm_grid_pack(gd, tg, 10, 15, 60, 10);
elm_grid_pack(gd, tg, 10, 10, 60, 10);
evas_object_show(tg);
tg = elm_check_add(win);
@ -243,7 +251,16 @@ test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
elm_object_text_set(tg, "Focus Highlight Enabled (Win)");
elm_check_state_set(tg, EINA_TRUE);
evas_object_smart_callback_add(tg, "changed", win_highlight_enabled_cb, win);
elm_grid_pack(gd, tg, 10, 25, 60, 10);
elm_grid_pack(gd, tg, 10, 15, 60, 10);
evas_object_show(tg);
tg = elm_check_add(win);
evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(tg, "Focus Highlight Animate (Win)");
elm_check_state_set(tg, EINA_TRUE);
evas_object_smart_callback_add(tg, "changed", win_highlight_animate_cb, win);
elm_grid_pack(gd, tg, 10, 20, 60, 10);
evas_object_show(tg);
bt = elm_button_add(win);

View File

@ -125,6 +125,7 @@ struct _Elm_Win_Smart_Data
Eina_Bool enabled : 1;
Eina_Bool theme_changed : 1; /* set true when the focus theme is changed */
Eina_Bool animate : 1; /* set true when the focus highlight animate is enabled */
Eina_Bool animate_supported : 1; /* set true when the focus highlight animate is supported by theme */
Eina_Bool geometry_changed : 1;
} focus_highlight;
@ -778,14 +779,14 @@ _elm_win_focus_highlight_reconfigure(Elm_Win_Smart_Data *sd)
(sd->obj, fobj, "focus_highlight", "top", str);
sd->focus_highlight.theme_changed = EINA_FALSE;
if (_elm_config->focus_highlight_animate)
if (sd->focus_highlight.animate)
{
str = edje_object_data_get(sd->focus_highlight.fobj, "animate");
sd->focus_highlight.animate = ((str) && (!strcmp(str, "on")));
sd->focus_highlight.animate_supported = ((str) && (!strcmp(str, "on")));
}
}
if ((sd->focus_highlight.animate) && (previous) &&
if ((sd->focus_highlight.animate_supported) && (previous) &&
(!sd->focus_highlight.prev.handled))
_elm_win_focus_highlight_anim_setup(sd, fobj);
else
@ -2987,6 +2988,8 @@ _win_constructor(Eo *obj, void *_pd, va_list *list)
if (_elm_config->focus_highlight_enable)
elm_win_focus_highlight_enabled_set(obj, EINA_TRUE);
if (_elm_config->focus_highlight_animate)
elm_win_focus_highlight_animate_set(obj, EINA_TRUE);
#ifdef ELM_DEBUG
Evas_Modifier_Mask mask = evas_key_modifier_mask_get(sd->evas, "Control");
@ -5103,6 +5106,52 @@ _focus_highlight_style_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
*ret = sd->focus_highlight.style;
}
EAPI void
elm_win_focus_highlight_animate_set(Evas_Object *obj,
Eina_Bool animate)
{
ELM_WIN_CHECK(obj);
eo_do(obj, elm_obj_win_focus_highlight_animate_set(animate));
}
static void
_focus_highlight_animate_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
{
Eina_Bool animate = va_arg(*list, int);
Elm_Win_Smart_Data *sd = _pd;
const char *str;
animate = !!animate;
if (sd->focus_highlight.animate == animate)
return;
sd->focus_highlight.animate = animate;
if (animate)
{
str = edje_object_data_get(sd->focus_highlight.fobj, "animate");
sd->focus_highlight.animate_supported = ((str) && (!strcmp(str, "on")));
}
else
sd->focus_highlight.animate_supported = EINA_FALSE;
}
EAPI Eina_Bool
elm_win_focus_highlight_animate_get(const Evas_Object *obj)
{
ELM_WIN_CHECK(obj) EINA_FALSE;
Eina_Bool ret = EINA_FALSE;
eo_do((Eo *) obj, elm_obj_win_focus_highlight_animate_get(&ret));
return ret;
}
static void
_focus_highlight_animate_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
Elm_Win_Smart_Data *sd = _pd;
*ret = sd->focus_highlight.animate;
}
EAPI Eina_Bool
elm_win_socket_listen(Evas_Object *obj,
const char *svcname,
@ -5368,6 +5417,8 @@ _class_constructor(Eo_Class *klass)
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET), _focus_highlight_enabled_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET), _focus_highlight_style_set),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), _focus_highlight_style_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET), _focus_highlight_animate_set),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET), _focus_highlight_animate_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN), _socket_listen),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET), _xwindow_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET), _wl_window_get),
@ -5468,6 +5519,8 @@ static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET, "Get the enabled value of the focus highlight for this window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET, "Set the style for the focus highlight on this window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET, "Get the style set for the focus highlight object."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET, "Set the animate status for the focus highlight for this window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET, "Get the animate status for the focus highlight for this window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN, "Create a socket to provide the service for Plug widget."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, "Get the Ecore_X_Window of an Evas_Object."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, "Get the Ecore_Wl_Window of and Evas_Object."),

View File

@ -99,6 +99,8 @@ enum
ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET,
ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET,
ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET,
ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET,
ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET,
ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN,
ELM_OBJ_WIN_SUB_ID_XWINDOW_GET,
ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET,
@ -1177,6 +1179,30 @@ enum
*/
#define elm_obj_win_focus_highlight_style_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), EO_TYPECHECK(const char **, ret)
/**
* @def elm_obj_win_focus_highlight_animate_set
* @since 1.8
*
* Set the animate status for the focus highlight for this window.
*
* @param[in] animate
*
* @see elm_win_focus_highlight_animate_get
*/
#define elm_obj_win_focus_highlight_animate_set(animate) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET), EO_TYPECHECK(Eina_Bool, animate)
/**
* @def elm_obj_win_focus_highlight_animate_get
* @since 1.8
*
* Get the animate status for the focus highlight for this window.
*
* @param[out] ret
*
* @see elm_win_focus_highlight_animate_get
*/
#define elm_obj_win_focus_highlight_animate_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET), EO_TYPECHECK(Eina_Bool *, ret)
/**
* @def elm_obj_win_socket_listen
* @since 1.8

View File

@ -1118,6 +1118,32 @@ EAPI void elm_win_focus_highlight_style_set(Evas_Object *obj, c
*/
EAPI const char *elm_win_focus_highlight_style_get(const Evas_Object *obj);
/**
* 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, regardless of the global setting for it
*
* @param obj The window where to enable the highlight animation
* @param enabled The enabled value for the highlight animation
*
* @ingroup Win
*/
EAPI void elm_win_focus_highlight_animate_set(Evas_Object *obj, Eina_Bool enabled);
/**
* Get the animate value of the focus highlight for this window
*
* @param obj The window in which to check if the focus highlight animation is
* enabled
*
* @return EINA_TRUE if animation is enabled, EINA_FALSE otherwise
*
* @ingroup Win
*/
EAPI Eina_Bool elm_win_focus_highlight_animate_get(const Evas_Object *obj);
/**
* Sets the keyboard mode of the window.
*