seoz pushed a commit to branch master.
commit d40008b6f4a602548038213d0052f6c2c753d4f8
Author: Daniel Juyung Seo <[email protected]>
Date: Sun Aug 11 18:58:28 2013 +0900
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.
---
ChangeLog | 4 ++++
NEWS | 1 +
src/bin/test_focus3.c | 21 +++++++++++++++--
src/lib/elm_win.c | 59 +++++++++++++++++++++++++++++++++++++++++++++---
src/lib/elm_win_eo.h | 26 +++++++++++++++++++++
src/lib/elm_win_legacy.h | 26 +++++++++++++++++++++
6 files changed, 132 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6f094fa..71a27b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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().
diff --git a/NEWS b/NEWS
index 9d839c3..a997076 100644
--- a/NEWS
+++ b/NEWS
@@ -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:
diff --git a/src/bin/test_focus3.c b/src/bin/test_focus3.c
index b5355ff..eeac44e 100644
--- a/src/bin/test_focus3.c
+++ b/src/bin/test_focus3.c
@@ -126,6 +126,13 @@ win_highlight_enabled_cb(void *data, Evas_Object *obj,
void *event_info __UNUSED
}
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__)
{
Evas_Object *c, *child = NULL;
@@ -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);
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 444c022..bccb7d1 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -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."),
diff --git a/src/lib/elm_win_eo.h b/src/lib/elm_win_eo.h
index 0a321b3..5ddd092 100644
--- a/src/lib/elm_win_eo.h
+++ b/src/lib/elm_win_eo.h
@@ -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,
@@ -1178,6 +1180,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
*
diff --git a/src/lib/elm_win_legacy.h b/src/lib/elm_win_legacy.h
index 463c982..ee02380 100644
--- a/src/lib/elm_win_legacy.h
+++ b/src/lib/elm_win_legacy.h
@@ -1119,6 +1119,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.
*
* @param obj The window object
--
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk