summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Kumar Nahak <ak.nahak@samsung.com>2014-11-29 15:56:45 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-11-29 15:56:45 +0900
commit65240b5327e5ab1eb8f77835b4729444fe1f02df (patch)
tree8dfa38bb2619440e7830a8b3694bd3ee7cc47d33
parent7380d2674a7f338b0b6a1140c135863256ffef18 (diff)
Slider: Added APIs to set/get slider's indicator visibility mode.
Summary: elm_config_slider_indicator_visible_mode_set elm_config_slider_indicator_visible_mode_get The patch will enable the slider's indicator to get visible always visible on focus visible never visible on slider value change Reviewers: raster, seoz Subscribers: sachin.dev Differential Revision: https://phab.enlightenment.org/D1558
-rw-r--r--config/default/base.src.in1
-rw-r--r--config/mobile/base.src.in1
-rw-r--r--config/standard/base.src.in1
-rw-r--r--src/lib/elm_config.c26
-rw-r--r--src/lib/elm_config.h40
-rw-r--r--src/lib/elm_priv.h1
-rw-r--r--src/lib/elm_slider.c36
7 files changed, 95 insertions, 11 deletions
diff --git a/config/default/base.src.in b/config/default/base.src.in
index 64b278313..35f9984fa 100644
--- a/config/default/base.src.in
+++ b/config/default/base.src.in
@@ -27,6 +27,7 @@ group "Elm_Config" struct {
27 value "scroll_smooth_future_time" double: 0.0; 27 value "scroll_smooth_future_time" double: 0.0;
28 value "scroll_smooth_time_window" double: 0.01; 28 value "scroll_smooth_time_window" double: 0.01;
29 value "focus_autoscroll_mode" uchar: 0; 29 value "focus_autoscroll_mode" uchar: 0;
30 value "slider_indicator_visible_mode" int: 0;
30 value "scale" double: 1.0; 31 value "scale" double: 1.0;
31 value "bgpixmap" int: 0; 32 value "bgpixmap" int: 0;
32 value "compositing" int: 1; 33 value "compositing" int: 1;
diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in
index ff6624303..4e4afd483 100644
--- a/config/mobile/base.src.in
+++ b/config/mobile/base.src.in
@@ -27,6 +27,7 @@ group "Elm_Config" struct {
27 value "scroll_smooth_future_time" double: 0.0; 27 value "scroll_smooth_future_time" double: 0.0;
28 value "scroll_smooth_time_window" double: 0.01; 28 value "scroll_smooth_time_window" double: 0.01;
29 value "focus_autoscroll_mode" uchar: 0; 29 value "focus_autoscroll_mode" uchar: 0;
30 value "slider_indicator_visible_mode" int: 0;
30 value "scale" double: 1.0; 31 value "scale" double: 1.0;
31 value "bgpixmap" int: 0; 32 value "bgpixmap" int: 0;
32 value "compositing" int: 1; 33 value "compositing" int: 1;
diff --git a/config/standard/base.src.in b/config/standard/base.src.in
index 7df943717..e55f879dd 100644
--- a/config/standard/base.src.in
+++ b/config/standard/base.src.in
@@ -27,6 +27,7 @@ group "Elm_Config" struct {
27 value "scroll_smooth_future_time" double: 0.0; 27 value "scroll_smooth_future_time" double: 0.0;
28 value "scroll_smooth_time_window" double: 0.01; 28 value "scroll_smooth_time_window" double: 0.01;
29 value "focus_autoscroll_mode" uchar: 0; 29 value "focus_autoscroll_mode" uchar: 0;
30 value "slider_indicator_visible_mode" int: 0;
30 value "scale" double: 1.0; 31 value "scale" double: 1.0;
31 value "bgpixmap" int: 0; 32 value "bgpixmap" int: 0;
32 value "compositing" int: 1; 33 value "compositing" int: 1;
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 661aaf808..5ddea1edb 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -529,6 +529,7 @@ _desc_init(void)
529 ELM_CONFIG_VAL(D, T, focus_highlight_clip_disable, T_UCHAR); 529 ELM_CONFIG_VAL(D, T, focus_highlight_clip_disable, T_UCHAR);
530 ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR); 530 ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR);
531 ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR); 531 ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR);
532 ELM_CONFIG_VAL(D, T, slider_indicator_visible_mode, T_INT);
532 ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR); 533 ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR);
533 ELM_CONFIG_VAL(D, T, first_item_focus_on_first_focus_in, T_UCHAR); 534 ELM_CONFIG_VAL(D, T, first_item_focus_on_first_focus_in, T_UCHAR);
534 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT); 535 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
@@ -1992,7 +1993,18 @@ _env_get(void)
1992 else 1993 else
1993 _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_SHOW; 1994 _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_SHOW;
1994 } 1995 }
1995 1996 s = getenv("ELM_SLIDER_INDICATOR_VISIBLE_MODE");
1997 if (s)
1998 {
1999 if (!strcmp(s, "ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT"))
2000 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT;
2001 else if (!strcmp(s, "ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS"))
2002 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS;
2003 else if (!strcmp(s, "ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS"))
2004 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS;
2005 else
2006 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE;
2007 }
1996 s = getenv("ELM_THEME"); 2008 s = getenv("ELM_THEME");
1997 if (s) eina_stringshare_replace(&_elm_config->theme, s); 2009 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1998 2010
@@ -2957,6 +2969,18 @@ elm_config_focus_autoscroll_mode_get(void)
2957} 2969}
2958 2970
2959EAPI void 2971EAPI void
2972elm_config_slider_indicator_visible_mode_set(Elm_Slider_Indicator_Visible_Mode mode)
2973{
2974 _elm_config->slider_indicator_visible_mode = mode;
2975}
2976
2977EAPI Elm_Slider_Indicator_Visible_Mode
2978elm_config_slider_indicator_visible_mode_get(void)
2979{
2980 return _elm_config->slider_indicator_visible_mode;
2981}
2982
2983EAPI void
2960elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode) 2984elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode)
2961{ 2985{
2962 _elm_config->focus_autoscroll_mode = mode; 2986 _elm_config->focus_autoscroll_mode = mode;
diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h
index ae16b4dc4..7da1f5872 100644
--- a/src/lib/elm_config.h
+++ b/src/lib/elm_config.h
@@ -595,6 +595,46 @@ EAPI Elm_Focus_Autoscroll_Mode elm_config_focus_autoscroll_mode_get(void);
595EAPI void elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode); 595EAPI void elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode);
596 596
597/** 597/**
598 * Slider's indicator visiblity mode.
599 *
600 * @since 1.12
601 * @ingroup Slider
602 */
603
604typedef enum
605{
606 ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT, /**< show indicator on mouse down or change in slider value */
607 ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, /**< Always show the indicator. */
608 ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS, /**< Show the indicator on focus */
609 ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE /**< Never show the indicator */
610} Elm_Slider_Indicator_Visible_Mode;
611
612/**
613 * Sets the slider's indicator visible mode.
614 *
615 * @param obj The slider object.
616 * @param mode Elm_Slider_Indicator_Visible_Mode.
617 * viewport.
618 *
619 * @ingroup Slider
620 * @since 1.12
621 */
622EAPI void elm_config_slider_indicator_visible_mode_set(Elm_Slider_Indicator_Visible_Mode mode);
623
624/**
625 * Get the slider's indicator visible mode.
626 *
627 * @param obj The slider object.
628 * @return @c ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT if not set anything by the user.
629 * @c ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS,
630 * ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE if any of the above is set by user.
631 *
632 * @ingroup Slider
633 * @since 1.12
634 */
635EAPI Elm_Slider_Indicator_Visible_Mode elm_config_slider_indicator_visible_mode_get(void);
636
637/**
598 * @} 638 * @}
599 */ 639 */
600 640
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 5d1c6fa07..719cbf1af 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -231,6 +231,7 @@ struct _Elm_Config
231 unsigned char item_select_on_focus_disable; /**< This shows the disabled status of select on focus feature. This value is false by default so that select on focus feature is enabled by default.*/ 231 unsigned char item_select_on_focus_disable; /**< This shows the disabled status of select on focus feature. This value is false by default so that select on focus feature is enabled by default.*/
232 unsigned char first_item_focus_on_first_focus_in; /**< This sets the first item focus on first focus in feature*/ 232 unsigned char first_item_focus_on_first_focus_in; /**< This sets the first item focus on first focus in feature*/
233 Elm_Focus_Autoscroll_Mode focus_autoscroll_mode; /**< This shows the focus auto scroll mode. By default, @c ELM_FOCUS_AUTOSCROLL_MODE_SHOW is set. */ 233 Elm_Focus_Autoscroll_Mode focus_autoscroll_mode; /**< This shows the focus auto scroll mode. By default, @c ELM_FOCUS_AUTOSCROLL_MODE_SHOW is set. */
234 Elm_Slider_Indicator_Visible_Mode slider_indicator_visible_mode; /**< this sets the slider indicator visible mode */
234 int toolbar_shrink_mode; 235 int toolbar_shrink_mode;
235 unsigned char fileselector_expand_enable; 236 unsigned char fileselector_expand_enable;
236 unsigned char fileselector_double_tap_navigation_enable; 237 unsigned char fileselector_double_tap_navigation_enable;
diff --git a/src/lib/elm_slider.c b/src/lib/elm_slider.c
index 82707ec08..6d11d2382 100644
--- a/src/lib/elm_slider.c
+++ b/src/lib/elm_slider.c
@@ -308,7 +308,7 @@ _popup_show(void *data,
308 const char *source EINA_UNUSED) 308 const char *source EINA_UNUSED)
309{ 309{
310 ELM_SLIDER_DATA_GET(data, sd); 310 ELM_SLIDER_DATA_GET(data, sd);
311 if (sd->popup) 311 if (sd->popup && _elm_config->slider_indicator_visible_mode != ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE)
312 { 312 {
313 evas_object_raise(sd->popup); 313 evas_object_raise(sd->popup);
314 evas_object_show(sd->popup); 314 evas_object_show(sd->popup);
@@ -328,7 +328,10 @@ _popup_hide(void *data,
328 328
329 if (!sd->popup_visible || !sd->popup) return; 329 if (!sd->popup_visible || !sd->popup) return;
330 330
331 if (!(elm_widget_focus_get(data) && sd->always_popup_show)) 331 if (_elm_config->slider_indicator_visible_mode == ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS) return;
332
333 if (!((elm_widget_focus_get(data)) &&
334 (_elm_config->slider_indicator_visible_mode == ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS)))
332 { 335 {
333 // XXX: for compat 336 // XXX: for compat
334 edje_object_signal_emit(sd->popup, "popup,hide", "elm"); 337 edje_object_signal_emit(sd->popup, "popup,hide", "elm");
@@ -345,7 +348,8 @@ _popup_hide_done(void *data,
345 ELM_SLIDER_DATA_GET(data, sd); 348 ELM_SLIDER_DATA_GET(data, sd);
346 if (sd->popup) 349 if (sd->popup)
347 { 350 {
348 if (!(elm_widget_focus_get(data) && sd->always_popup_show)) 351 if (!((elm_widget_focus_get(data)) &&
352 (_elm_config->slider_indicator_visible_mode == ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS)))
349 { 353 {
350 evas_object_hide(sd->popup); 354 evas_object_hide(sd->popup);
351 sd->popup_visible = EINA_FALSE; 355 sd->popup_visible = EINA_FALSE;
@@ -823,6 +827,16 @@ _access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
823 return NULL; 827 return NULL;
824} 828}
825 829
830static void
831_on_show(void *data EINA_UNUSED,
832 Evas *e EINA_UNUSED,
833 Evas_Object *obj,
834 void *event_info EINA_UNUSED)
835{
836 if (_elm_config->slider_indicator_visible_mode == ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS)
837 _popup_show(obj, NULL, NULL, NULL);
838}
839
826EOLIAN static void 840EOLIAN static void
827_elm_slider_evas_object_smart_add(Eo *obj, Elm_Slider_Data *priv) 841_elm_slider_evas_object_smart_add(Eo *obj, Elm_Slider_Data *priv)
828{ 842{
@@ -867,6 +881,8 @@ _elm_slider_evas_object_smart_add(Eo *obj, Elm_Slider_Data *priv)
867 evas_object_event_callback_add 881 evas_object_event_callback_add
868 (priv->spacer, EVAS_CALLBACK_MOUSE_UP, _spacer_up_cb, obj); 882 (priv->spacer, EVAS_CALLBACK_MOUSE_UP, _spacer_up_cb, obj);
869 883
884 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
885
870 elm_widget_can_focus_set(obj, EINA_TRUE); 886 elm_widget_can_focus_set(obj, EINA_TRUE);
871 887
872 _elm_access_object_register(obj, wd->resize_obj); 888 _elm_access_object_register(obj, wd->resize_obj);
@@ -1143,18 +1159,18 @@ _elm_slider_step_get(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd)
1143} 1159}
1144 1160
1145EOLIAN static void 1161EOLIAN static void
1146_elm_slider_indicator_show_on_focus_set(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd, Eina_Bool flag) 1162_elm_slider_indicator_show_on_focus_set(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd EINA_UNUSED, Eina_Bool flag)
1147{ 1163{
1148 if (flag) 1164 if (flag)
1149 sd->always_popup_show = EINA_TRUE; 1165 elm_config_slider_indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS);
1150 else 1166 else
1151 sd->always_popup_show = EINA_FALSE; 1167 elm_config_slider_indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT);
1152} 1168}
1153 1169
1154EOLIAN static Eina_Bool 1170EOLIAN static Eina_Bool
1155_elm_slider_indicator_show_on_focus_get(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd) 1171_elm_slider_indicator_show_on_focus_get(Eo *obj EINA_UNUSED, Elm_Slider_Data *sd EINA_UNUSED)
1156{ 1172{
1157 return sd->always_popup_show; 1173 return (elm_config_slider_indicator_visible_mode_get() == ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS);
1158} 1174}
1159 1175
1160EOLIAN static Eina_Bool 1176EOLIAN static Eina_Bool
@@ -1170,13 +1186,13 @@ _elm_slider_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Slide
1170} 1186}
1171 1187
1172EOLIAN static Eina_Bool 1188EOLIAN static Eina_Bool
1173_elm_slider_elm_widget_on_focus(Eo *obj, Elm_Slider_Data *sd) 1189_elm_slider_elm_widget_on_focus(Eo *obj, Elm_Slider_Data *sd EINA_UNUSED)
1174{ 1190{
1175 Eina_Bool int_ret = EINA_FALSE; 1191 Eina_Bool int_ret = EINA_FALSE;
1176 1192
1177 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_on_focus()); 1193 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_on_focus());
1178 1194
1179 if (sd->always_popup_show && elm_widget_focus_get(obj)) 1195 if ((_elm_config->slider_indicator_visible_mode == ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS) && elm_widget_focus_get(obj))
1180 _popup_show(obj, NULL, NULL, NULL); 1196 _popup_show(obj, NULL, NULL, NULL);
1181 else 1197 else
1182 _popup_hide(obj, NULL, NULL, NULL); 1198 _popup_hide(obj, NULL, NULL, NULL);