summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2013-08-11 18:58:28 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2013-08-11 18:58:28 +0900
commitdd3fb75651de2c16c398d901a9f1a5d7e692e71f (patch)
tree1b07c74a6989e8ad162c4a01ef0122d801f5480b /legacy
parent20f58390d7fffe50f2251f851646db34540ea641 (diff)
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.
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/ChangeLog4
-rw-r--r--legacy/elementary/NEWS1
-rw-r--r--legacy/elementary/src/bin/test_focus3.c21
-rw-r--r--legacy/elementary/src/lib/elm_win.c59
-rw-r--r--legacy/elementary/src/lib/elm_win_eo.h26
-rw-r--r--legacy/elementary/src/lib/elm_win_legacy.h26
6 files changed, 132 insertions, 5 deletions
diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog
index 6f094fae1d..71a27b20cb 100644
--- a/legacy/elementary/ChangeLog
+++ b/legacy/elementary/ChangeLog
@@ -1542,3 +1542,7 @@
1542 1542
1543 * Popup: Fix the corrupted internal widget tree that caused 1543 * Popup: Fix the corrupted internal widget tree that caused
1544 elm_theme_set() doesn't work correctly. 1544 elm_theme_set() doesn't work correctly.
1545
15462013-08-11 Daniel Juyung Seo (SeoZ)
1547
1548 * Win Focus: Added elm_win_focus_highlight_animate_set/get().
diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS
index 9d839c3228..a997076ab9 100644
--- a/legacy/elementary/NEWS
+++ b/legacy/elementary/NEWS
@@ -82,6 +82,7 @@ Additions:
82 * Add elm_access_highlight_next_set, export elm_widget_focus_region_show 82 * Add elm_access_highlight_next_set, export elm_widget_focus_region_show
83 * File Selector : Support elm_object_part_text_set() for the ok, cancel part to change the OK, Cancel button label. 83 * File Selector : Support elm_object_part_text_set() for the ok, cancel part to change the OK, Cancel button label.
84 * Add _elm_access_object_get, deprecate _elm_access_info_get 84 * Add _elm_access_object_get, deprecate _elm_access_info_get
85 * Add elm_win_focus_highlight_animate_set/get().
85 86
86Improvements: 87Improvements:
87 88
diff --git a/legacy/elementary/src/bin/test_focus3.c b/legacy/elementary/src/bin/test_focus3.c
index b5355ff078..eeac44ef10 100644
--- a/legacy/elementary/src/bin/test_focus3.c
+++ b/legacy/elementary/src/bin/test_focus3.c
@@ -126,6 +126,13 @@ win_highlight_enabled_cb(void *data, Evas_Object *obj, void *event_info __UNUSED
126} 126}
127 127
128static void 128static void
129win_highlight_animate_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
130{
131 elm_win_focus_highlight_animate_set((Evas_Object *)data,
132 elm_check_state_get(obj));
133}
134
135static void
129custom_chain_unset_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 136custom_chain_unset_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
130{ 137{
131 Evas_Object *c, *child = NULL; 138 Evas_Object *c, *child = NULL;
@@ -209,6 +216,7 @@ test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
209 win = elm_win_util_standard_add("focus4", "Focus 4"); 216 win = elm_win_util_standard_add("focus4", "Focus 4");
210 elm_win_autodel_set(win, EINA_TRUE); 217 elm_win_autodel_set(win, EINA_TRUE);
211 elm_win_focus_highlight_enabled_set(win, EINA_TRUE); 218 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
219 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
212 elm_config_focus_highlight_enabled_set(EINA_TRUE); 220 elm_config_focus_highlight_enabled_set(EINA_TRUE);
213 elm_config_focus_highlight_animate_set(EINA_TRUE); 221 elm_config_focus_highlight_animate_set(EINA_TRUE);
214 222
@@ -234,7 +242,7 @@ test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
234 elm_object_text_set(tg, "Focus Highlight Animate (Config)"); 242 elm_object_text_set(tg, "Focus Highlight Animate (Config)");
235 elm_check_state_set(tg, EINA_TRUE); 243 elm_check_state_set(tg, EINA_TRUE);
236 evas_object_smart_callback_add(tg, "changed", highlight_animate_cb, NULL); 244 evas_object_smart_callback_add(tg, "changed", highlight_animate_cb, NULL);
237 elm_grid_pack(gd, tg, 10, 15, 60, 10); 245 elm_grid_pack(gd, tg, 10, 10, 60, 10);
238 evas_object_show(tg); 246 evas_object_show(tg);
239 247
240 tg = elm_check_add(win); 248 tg = elm_check_add(win);
@@ -243,7 +251,16 @@ test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
243 elm_object_text_set(tg, "Focus Highlight Enabled (Win)"); 251 elm_object_text_set(tg, "Focus Highlight Enabled (Win)");
244 elm_check_state_set(tg, EINA_TRUE); 252 elm_check_state_set(tg, EINA_TRUE);
245 evas_object_smart_callback_add(tg, "changed", win_highlight_enabled_cb, win); 253 evas_object_smart_callback_add(tg, "changed", win_highlight_enabled_cb, win);
246 elm_grid_pack(gd, tg, 10, 25, 60, 10); 254 elm_grid_pack(gd, tg, 10, 15, 60, 10);
255 evas_object_show(tg);
256
257 tg = elm_check_add(win);
258 evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
259 evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL);
260 elm_object_text_set(tg, "Focus Highlight Animate (Win)");
261 elm_check_state_set(tg, EINA_TRUE);
262 evas_object_smart_callback_add(tg, "changed", win_highlight_animate_cb, win);
263 elm_grid_pack(gd, tg, 10, 20, 60, 10);
247 evas_object_show(tg); 264 evas_object_show(tg);
248 265
249 bt = elm_button_add(win); 266 bt = elm_button_add(win);
diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c
index 444c0225a8..bccb7d1e6d 100644
--- a/legacy/elementary/src/lib/elm_win.c
+++ b/legacy/elementary/src/lib/elm_win.c
@@ -125,6 +125,7 @@ struct _Elm_Win_Smart_Data
125 Eina_Bool enabled : 1; 125 Eina_Bool enabled : 1;
126 Eina_Bool theme_changed : 1; /* set true when the focus theme is changed */ 126 Eina_Bool theme_changed : 1; /* set true when the focus theme is changed */
127 Eina_Bool animate : 1; /* set true when the focus highlight animate is enabled */ 127 Eina_Bool animate : 1; /* set true when the focus highlight animate is enabled */
128 Eina_Bool animate_supported : 1; /* set true when the focus highlight animate is supported by theme */
128 Eina_Bool geometry_changed : 1; 129 Eina_Bool geometry_changed : 1;
129 } focus_highlight; 130 } focus_highlight;
130 131
@@ -778,14 +779,14 @@ _elm_win_focus_highlight_reconfigure(Elm_Win_Smart_Data *sd)
778 (sd->obj, fobj, "focus_highlight", "top", str); 779 (sd->obj, fobj, "focus_highlight", "top", str);
779 sd->focus_highlight.theme_changed = EINA_FALSE; 780 sd->focus_highlight.theme_changed = EINA_FALSE;
780 781
781 if (_elm_config->focus_highlight_animate) 782 if (sd->focus_highlight.animate)
782 { 783 {
783 str = edje_object_data_get(sd->focus_highlight.fobj, "animate"); 784 str = edje_object_data_get(sd->focus_highlight.fobj, "animate");
784 sd->focus_highlight.animate = ((str) && (!strcmp(str, "on"))); 785 sd->focus_highlight.animate_supported = ((str) && (!strcmp(str, "on")));
785 } 786 }
786 } 787 }
787 788
788 if ((sd->focus_highlight.animate) && (previous) && 789 if ((sd->focus_highlight.animate_supported) && (previous) &&
789 (!sd->focus_highlight.prev.handled)) 790 (!sd->focus_highlight.prev.handled))
790 _elm_win_focus_highlight_anim_setup(sd, fobj); 791 _elm_win_focus_highlight_anim_setup(sd, fobj);
791 else 792 else
@@ -2987,6 +2988,8 @@ _win_constructor(Eo *obj, void *_pd, va_list *list)
2987 2988
2988 if (_elm_config->focus_highlight_enable) 2989 if (_elm_config->focus_highlight_enable)
2989 elm_win_focus_highlight_enabled_set(obj, EINA_TRUE); 2990 elm_win_focus_highlight_enabled_set(obj, EINA_TRUE);
2991 if (_elm_config->focus_highlight_animate)
2992 elm_win_focus_highlight_animate_set(obj, EINA_TRUE);
2990 2993
2991#ifdef ELM_DEBUG 2994#ifdef ELM_DEBUG
2992 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(sd->evas, "Control"); 2995 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)
5103 *ret = sd->focus_highlight.style; 5106 *ret = sd->focus_highlight.style;
5104} 5107}
5105 5108
5109EAPI void
5110elm_win_focus_highlight_animate_set(Evas_Object *obj,
5111 Eina_Bool animate)
5112{
5113 ELM_WIN_CHECK(obj);
5114 eo_do(obj, elm_obj_win_focus_highlight_animate_set(animate));
5115}
5116
5117static void
5118_focus_highlight_animate_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5119{
5120 Eina_Bool animate = va_arg(*list, int);
5121 Elm_Win_Smart_Data *sd = _pd;
5122 const char *str;
5123
5124 animate = !!animate;
5125 if (sd->focus_highlight.animate == animate)
5126 return;
5127
5128 sd->focus_highlight.animate = animate;
5129 if (animate)
5130 {
5131 str = edje_object_data_get(sd->focus_highlight.fobj, "animate");
5132 sd->focus_highlight.animate_supported = ((str) && (!strcmp(str, "on")));
5133 }
5134 else
5135 sd->focus_highlight.animate_supported = EINA_FALSE;
5136}
5137
5138EAPI Eina_Bool
5139elm_win_focus_highlight_animate_get(const Evas_Object *obj)
5140{
5141 ELM_WIN_CHECK(obj) EINA_FALSE;
5142 Eina_Bool ret = EINA_FALSE;
5143 eo_do((Eo *) obj, elm_obj_win_focus_highlight_animate_get(&ret));
5144 return ret;
5145}
5146
5147static void
5148_focus_highlight_animate_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5149{
5150 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
5151 Elm_Win_Smart_Data *sd = _pd;
5152 *ret = sd->focus_highlight.animate;
5153}
5154
5106EAPI Eina_Bool 5155EAPI Eina_Bool
5107elm_win_socket_listen(Evas_Object *obj, 5156elm_win_socket_listen(Evas_Object *obj,
5108 const char *svcname, 5157 const char *svcname,
@@ -5368,6 +5417,8 @@ _class_constructor(Eo_Class *klass)
5368 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET), _focus_highlight_enabled_get), 5417 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET), _focus_highlight_enabled_get),
5369 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET), _focus_highlight_style_set), 5418 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET), _focus_highlight_style_set),
5370 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), _focus_highlight_style_get), 5419 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), _focus_highlight_style_get),
5420 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET), _focus_highlight_animate_set),
5421 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET), _focus_highlight_animate_get),
5371 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN), _socket_listen), 5422 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN), _socket_listen),
5372 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET), _xwindow_get), 5423 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET), _xwindow_get),
5373 EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET), _wl_window_get), 5424 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[] = {
5468 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET, "Get the enabled value of the focus highlight for this window."), 5519 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET, "Get the enabled value of the focus highlight for this window."),
5469 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET, "Set the style for the focus highlight on this window."), 5520 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET, "Set the style for the focus highlight on this window."),
5470 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET, "Get the style set for the focus highlight object."), 5521 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET, "Get the style set for the focus highlight object."),
5522 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET, "Set the animate status for the focus highlight for this window."),
5523 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET, "Get the animate status for the focus highlight for this window."),
5471 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN, "Create a socket to provide the service for Plug widget."), 5524 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN, "Create a socket to provide the service for Plug widget."),
5472 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, "Get the Ecore_X_Window of an Evas_Object."), 5525 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, "Get the Ecore_X_Window of an Evas_Object."),
5473 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, "Get the Ecore_Wl_Window of and Evas_Object."), 5526 EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, "Get the Ecore_Wl_Window of and Evas_Object."),
diff --git a/legacy/elementary/src/lib/elm_win_eo.h b/legacy/elementary/src/lib/elm_win_eo.h
index 0a321b36e2..5ddd092332 100644
--- a/legacy/elementary/src/lib/elm_win_eo.h
+++ b/legacy/elementary/src/lib/elm_win_eo.h
@@ -99,6 +99,8 @@ enum
99 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET, 99 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET,
100 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET, 100 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET,
101 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET, 101 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET,
102 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET,
103 ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET,
102 ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN, 104 ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN,
103 ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, 105 ELM_OBJ_WIN_SUB_ID_XWINDOW_GET,
104 ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, 106 ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET,
@@ -1178,6 +1180,30 @@ enum
1178#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) 1180#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)
1179 1181
1180/** 1182/**
1183 * @def elm_obj_win_focus_highlight_animate_set
1184 * @since 1.8
1185 *
1186 * Set the animate status for the focus highlight for this window.
1187 *
1188 * @param[in] animate
1189 *
1190 * @see elm_win_focus_highlight_animate_get
1191 */
1192#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)
1193
1194/**
1195 * @def elm_obj_win_focus_highlight_animate_get
1196 * @since 1.8
1197 *
1198 * Get the animate status for the focus highlight for this window.
1199 *
1200 * @param[out] ret
1201 *
1202 * @see elm_win_focus_highlight_animate_get
1203 */
1204#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)
1205
1206/**
1181 * @def elm_obj_win_socket_listen 1207 * @def elm_obj_win_socket_listen
1182 * @since 1.8 1208 * @since 1.8
1183 * 1209 *
diff --git a/legacy/elementary/src/lib/elm_win_legacy.h b/legacy/elementary/src/lib/elm_win_legacy.h
index 463c98230f..ee02380e44 100644
--- a/legacy/elementary/src/lib/elm_win_legacy.h
+++ b/legacy/elementary/src/lib/elm_win_legacy.h
@@ -1119,6 +1119,32 @@ EAPI void elm_win_focus_highlight_style_set(Evas_Object *obj, c
1119EAPI const char *elm_win_focus_highlight_style_get(const Evas_Object *obj); 1119EAPI const char *elm_win_focus_highlight_style_get(const Evas_Object *obj);
1120 1120
1121/** 1121/**
1122 * Set the animate status for the focus highlight for this window.
1123 *
1124 * This function will enable or disable the animation of focus highlight only
1125 * for the given window, regardless of the global setting for it
1126 *
1127 * @param obj The window where to enable the highlight animation
1128 * @param enabled The enabled value for the highlight animation
1129 *
1130 * @ingroup Win
1131 */
1132EAPI void elm_win_focus_highlight_animate_set(Evas_Object *obj, Eina_Bool enabled);
1133
1134/**
1135 * Get the animate value of the focus highlight for this window
1136 *
1137 * @param obj The window in which to check if the focus highlight animation is
1138 * enabled
1139 *
1140 * @return EINA_TRUE if animation is enabled, EINA_FALSE otherwise
1141 *
1142 * @ingroup Win
1143 */
1144EAPI Eina_Bool elm_win_focus_highlight_animate_get(const Evas_Object *obj);
1145
1146
1147/**
1122 * Sets the keyboard mode of the window. 1148 * Sets the keyboard mode of the window.
1123 * 1149 *
1124 * @param obj The window object 1150 * @param obj The window object