focus: Change new API names related to focus auto scrolling.
authorDaniel Juyung Seo <seojuyung2@gmail.com>
Sun, 11 May 2014 13:42:45 +0000 (22:42 +0900)
committerDaniel Juyung Seo <juyung.seo@samsung.com>
Sun, 11 May 2014 13:46:16 +0000 (22:46 +0900)
elm_config_focus_auto_scroll_bring_in_enabled_get/set()
 ->
elm_config_focus_autoscroll_mode_get/set()

The main reason is that bring_in_enabled_get/set() APIs are too restricted
and thus not flexible. I got more requirements for the focus autoscrolling
such as none, wholely visible not just bring_in and show. So it is correct
to add mode_set/get() APIs for the focus auto scrolling.

Thanks god, we've found this before the release :)

@feature

16 files changed:
config/default/base.src
config/mobile/base.src
config/standard/base.src
src/bin/config.c
src/bin/test_gengrid.c
src/bin/test_genlist.c
src/bin/test_list.c
src/bin/test_toolbar.c
src/lib/elm_config.c
src/lib/elm_config.h
src/lib/elm_gengrid.c
src/lib/elm_genlist.c
src/lib/elm_list.c
src/lib/elm_priv.h
src/lib/elm_toolbar.c
src/lib/elm_widget.c

index 3f48258..1bf94c3 100644 (file)
@@ -26,7 +26,7 @@ group "Elm_Config" struct {
   value "scroll_smooth_history_weight" double: 0.1;
   value "scroll_smooth_future_time" double: 0.0;
   value "scroll_smooth_time_window" double: 0.01;
-  value "focus_auto_scroll_bring_in_enable" uchar: 0;
+  value "focus_autoscroll_mode" uchar: 0;
   value "scale" double: 1.0;
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
index 6f2d976..590ffbf 100644 (file)
@@ -26,7 +26,7 @@ group "Elm_Config" struct {
   value "scroll_smooth_history_weight" double: 0.1;
   value "scroll_smooth_future_time" double: 0.0;
   value "scroll_smooth_time_window" double: 0.01;
-  value "focus_auto_scroll_bring_in_enable" uchar: 0;
+  value "focus_autoscroll_mode" uchar: 0;
   value "scale" double: 1.0;
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
index 7472f1f..6d2da5b 100644 (file)
@@ -26,7 +26,7 @@ group "Elm_Config" struct {
   value "scroll_smooth_history_weight" double: 0.1;
   value "scroll_smooth_future_time" double: 0.0;
   value "scroll_smooth_time_window" double: 0.01;
-  value "focus_auto_scroll_bring_in_enable" uchar: 0;
+  value "focus_autoscroll_mode" uchar: 0;
   value "scale" double: 1.0;
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
index ac7d3ac..755cfba 100644 (file)
@@ -1591,34 +1591,30 @@ _config_focus_highlight_clip_cb(void *data EINA_UNUSED, Evas_Object *obj,
 }
 
 static void
-_config_focus_auto_scroll_bring_in_cb(void *data EINA_UNUSED, Evas_Object *obj,
+_config_focus_item_select_on_focus_cb(void *data EINA_UNUSED, Evas_Object *obj,
                                       void *event_info EINA_UNUSED)
 {
-   Eina_Bool cf = elm_config_focus_auto_scroll_bring_in_enabled_get();
+   Eina_Bool cf = elm_config_item_select_on_focus_disabled_get();
    Eina_Bool val = elm_check_state_get(obj);
 
    if (cf == val) return;
-   elm_config_focus_auto_scroll_bring_in_enabled_set(val);
+   elm_config_item_select_on_focus_disabled_set(val);
    elm_config_all_flush();
 }
 
 static void
-_config_focus_item_select_on_focus_cb(void *data EINA_UNUSED, Evas_Object *obj,
-                                      void *event_info EINA_UNUSED)
+_status_config_focus_autoscroll_changed_cb(void *data EINA_UNUSED,
+                                           Evas_Object *obj,
+                                           void *event_info EINA_UNUSED)
 {
-   Eina_Bool cf = elm_config_item_select_on_focus_disabled_get();
-   Eina_Bool val = elm_check_state_get(obj);
-
-   if (cf == val) return;
-   elm_config_item_select_on_focus_disabled_set(val);
-   elm_config_all_flush();
+   elm_config_focus_autoscroll_mode_set(elm_radio_value_get(obj));
 }
 
 static void
 _status_config_focus(Evas_Object *win,
                      Evas_Object *naviframe)
 {
-   Evas_Object *bx, *ck;
+   Evas_Object *bx, *ck, *fr;
 
    bx = elm_box_add(win);
 
@@ -1642,19 +1638,69 @@ _status_config_focus(Evas_Object *win,
              _config_focus_highlight_clip_cb, NULL);
    elm_check_state_set(ck, elm_config_focus_highlight_clip_disabled_get());
 
-   CHECK_ADD("Enable Auto Scroll Bring-in",
-             "Set whether enable/disable auto scroll bring-in feature<br/>"
-             "This is disabled by default so auto scrolling works by show not"
-             "by bring-in.",
-             _config_focus_auto_scroll_bring_in_cb, NULL);
-   elm_check_state_set(ck, elm_config_focus_auto_scroll_bring_in_enabled_get());
-
    CHECK_ADD("Disable Item Select on Focus",
              "Set whether item would be selected on item focus.<br/>"
              "This is enabled by default.",
              _config_focus_item_select_on_focus_cb, NULL);
    elm_check_state_set(ck, elm_config_item_select_on_focus_disabled_get());
 
+   fr = elm_frame_add(bx);
+   elm_object_text_set(fr, "Focus Autoscroll Mode");
+   evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.5);
+   elm_box_pack_end(bx, fr);
+   evas_object_show(fr);
+     {
+        Evas_Object *bx2, *rdg, *rd;
+        bx2 = elm_box_add(fr);
+        elm_object_content_set(fr, bx2);
+        evas_object_show(bx2);
+
+        rdg = rd = elm_radio_add(bx2);
+        elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_SHOW);
+        elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_SHOW");
+        elm_object_tooltip_text_set(rd, "Directly show the focused region<br/>"
+                                    "or item automatically inside a scroller.");
+        evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+        elm_box_pack_end(bx2, rd);
+        evas_object_show(rd);
+        evas_object_smart_callback_add(rd, "changed",
+                                       _status_config_focus_autoscroll_changed_cb,
+                                       NULL);
+
+        rd = elm_radio_add(bx2);
+        elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_NONE);
+        elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_NONE");
+        elm_object_tooltip_text_set(rd, "Do not show the focused region or<br/>"
+                                    "item automatically inside a scroller.");
+        evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+        elm_box_pack_end(bx2, rd);
+        elm_radio_group_add(rd, rdg);
+        evas_object_show(rd);
+        evas_object_smart_callback_add(rd, "changed",
+                                       _status_config_focus_autoscroll_changed_cb,
+                                       NULL);
+
+
+        rd = elm_radio_add(bx2);
+        elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN);
+        elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN");
+        elm_object_tooltip_text_set(rd, "Bring in the focused region or item<br/>"
+                                    "automatically which might invole the scrolling.");
+        evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+        elm_box_pack_end(bx2, rd);
+        elm_radio_group_add(rd, rdg);
+        evas_object_show(rd);
+        evas_object_smart_callback_add(rd, "changed",
+                                       _status_config_focus_autoscroll_changed_cb,
+                                       NULL);
+
+        elm_radio_value_set(rdg, elm_config_focus_autoscroll_mode_get());
+     }
+
    evas_object_data_set(win, "focus", bx);
 
    elm_naviframe_item_simple_push(naviframe, bx);
index 784bfa9..5d58b5b 100644 (file)
@@ -5,6 +5,8 @@
 #endif
 #include <Elementary.h>
 
+Evas_Object * _focus_autoscroll_mode_frame_create(Evas_Object *parent);
+
 static Elm_Gengrid_Item_Class *gic, *ggic;
 
 Evas_Object *grid_content_get(void *data, Evas_Object *obj, const char *part);
@@ -1391,14 +1393,6 @@ _gg_focus_focus_animate_changed_cb(void *data,
 }
 
 static void
-_gg_focus_bring_in_changed_cb(void *data EINA_UNUSED,
-                              Evas_Object *obj,
-                              void *event_info EINA_UNUSED)
-{
-   elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
-}
-
-static void
 _grid_reorder_mode(void *data, Evas_Object *obj,
                    void *event_info EINA_UNUSED)
 {
@@ -1532,15 +1526,6 @@ test_gengrid_focus(void *data EINA_UNUSED,
    evas_object_show(ck);
 
    ck = elm_check_add(bx_opt);
-   elm_object_text_set(ck, "Focus Auto scroll bring in enable");
-   evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
-   evas_object_smart_callback_add(ck, "changed", _gg_focus_bring_in_changed_cb,
-                                  NULL);
-   elm_check_state_set(ck, elm_config_focus_auto_scroll_bring_in_enabled_get());
-   elm_box_pack_end(bx_opt, ck);
-   evas_object_show(ck);
-
-   ck = elm_check_add(bx_opt);
    elm_object_text_set(ck, "Item Select on Focus disable");
    elm_check_state_set(ck, elm_config_item_select_on_focus_disabled_get());
    evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
@@ -1550,6 +1535,10 @@ test_gengrid_focus(void *data EINA_UNUSED,
    elm_box_pack_end(bx_opt, ck);
    evas_object_show(ck);
 
+   // Focus Autoscroll Mode
+   fr = _focus_autoscroll_mode_frame_create(bx);
+   elm_box_pack_end(bx, fr);
+
    //Focus movement policy
    fr = elm_frame_add(bx);
    elm_object_text_set(fr, "Focus Movement Policy");
index cdaf14c..ea9a4c6 100644 (file)
@@ -3807,12 +3807,75 @@ _focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
    printf("Button clicked: %s\n", (char *)data);
 }
 
-static void
-_gl_focus_bring_in_changed_cb(void *data EINA_UNUSED,
-                              Evas_Object *obj,
-                              void *event_info EINA_UNUSED)
+void
+_focus_autoscroll_changed_cb(void *data EINA_UNUSED,
+                             Evas_Object *obj,
+                             void *event_info EINA_UNUSED)
 {
-   elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
+   elm_config_focus_autoscroll_mode_set(elm_radio_value_get(obj));
+}
+
+/* this function is used in another tests such as list, gengrid, and toolbar. */
+Evas_Object *
+_focus_autoscroll_mode_frame_create(Evas_Object *parent)
+{
+   Evas_Object *fr, *bx, *rdg, *rd;
+
+   fr = elm_frame_add(parent);
+   elm_object_text_set(fr, "Focus Autoscroll Mode");
+   evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.5);
+   evas_object_show(fr);
+
+   bx = elm_box_add(fr);
+   elm_object_content_set(fr, bx);
+   evas_object_show(bx);
+
+   rdg = rd = elm_radio_add(bx);
+   elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_SHOW);
+   elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_SHOW");
+   elm_object_tooltip_text_set(rd, "Directly show the focused region<br/>"
+                               "or item automatically inside a scroller.");
+   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+   elm_box_pack_end(bx, rd);
+   evas_object_show(rd);
+   evas_object_smart_callback_add(rd, "changed",
+                                  _focus_autoscroll_changed_cb,
+                                  NULL);
+
+   rd = elm_radio_add(bx);
+   elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_NONE);
+   elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_NONE");
+   elm_object_tooltip_text_set(rd, "Do not show the focused region or<br/>"
+                               "item automatically inside a scroller.");
+   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+   elm_box_pack_end(bx, rd);
+   elm_radio_group_add(rd, rdg);
+   evas_object_show(rd);
+   evas_object_smart_callback_add(rd, "changed",
+                                  _focus_autoscroll_changed_cb,
+                                  NULL);
+
+
+   rd = elm_radio_add(bx);
+   elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN);
+   elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN");
+   elm_object_tooltip_text_set(rd, "Bring in the focused region or item<br/>"
+                               "automatically which might invole the scrolling.");
+   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+   elm_box_pack_end(bx, rd);
+   elm_radio_group_add(rd, rdg);
+   evas_object_show(rd);
+   evas_object_smart_callback_add(rd, "changed",
+                                  _focus_autoscroll_changed_cb,
+                                  NULL);
+
+   elm_radio_value_set(rdg, elm_config_focus_autoscroll_mode_get());
+
+   return fr;
 }
 
 void
@@ -3979,15 +4042,6 @@ test_genlist_focus(void *data EINA_UNUSED,
    evas_object_show(chk);
 
    chk = elm_check_add(bx_opt);
-   elm_object_text_set(chk, "Focus Auto scroll bring in enable");
-   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
-   evas_object_smart_callback_add(chk, "changed", _gl_focus_bring_in_changed_cb,
-                                  NULL);
-   elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get());
-   elm_box_pack_end(bx_opt, chk);
-   evas_object_show(chk);
-
-   chk = elm_check_add(bx_opt);
    elm_object_text_set(chk, "Item Select on Focus disable");
    elm_check_state_set(chk, elm_config_item_select_on_focus_disabled_get());
    evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
@@ -3997,6 +4051,10 @@ test_genlist_focus(void *data EINA_UNUSED,
    elm_box_pack_end(bx_opt, chk);
    evas_object_show(chk);
 
+   // Focus Autoscroll Mode
+   fr = _focus_autoscroll_mode_frame_create(bx);
+   elm_box_pack_end(bx, fr);
+
    // Focus Movement Policy
    fr = elm_frame_add(bx);
    elm_object_text_set(fr, "Focus Movement Policy");
index c780798..be96c75 100644 (file)
@@ -5,6 +5,8 @@
 #endif
 #include <Elementary.h>
 
+Evas_Object * _focus_autoscroll_mode_frame_create(Evas_Object *parent);
+
 struct _api_data
 {
    unsigned int state;  /* What state we are testing       */
@@ -1397,14 +1399,6 @@ _focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
 }
 
 static void
-_test_list_focus_bring_in_changed(void *data EINA_UNUSED,
-                                  Evas_Object *obj,
-                                  void *event_info EINA_UNUSED)
-{
-   elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
-}
-
-static void
 _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
 {
    Evas_Object *win, *li, *btn, *bx, *bx2, *fr, *bx_opt, *chk, *bx_btn;
@@ -1540,14 +1534,9 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
    elm_box_pack_end(bx_opt, chk);
    evas_object_show(chk);
 
-   chk = elm_check_add(bx_opt);
-   elm_object_text_set(chk, "Focus Auto scroll bring in enable");
-   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
-   evas_object_smart_callback_add(chk, "changed", _test_list_focus_bring_in_changed,
-                                  NULL);
-   elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get());
-   elm_box_pack_end(bx_opt, chk);
-   evas_object_show(chk);
+   // Focus Autoscroll Mode
+   fr = _focus_autoscroll_mode_frame_create(bx);
+   elm_box_pack_end(bx, fr);
 
    // Focus Movement Policy
    fr = elm_frame_add(bx);
index 510899f..e1d2dd2 100644 (file)
@@ -3,6 +3,8 @@
 #endif
 #include <Elementary.h>
 
+Evas_Object * _focus_autoscroll_mode_frame_create(Evas_Object *parent);
+
 static void
 _tb_sel1_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
@@ -1126,14 +1128,6 @@ test_toolbar_focus_focus_move_policy_changed(void *data EINA_UNUSED,
      elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN);
 }
 
-static void
-_test_toolbar_focus_bring_in_changed(void *data EINA_UNUSED,
-                                     Evas_Object *obj,
-                                     void *event_info EINA_UNUSED)
-{
-   elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
-}
-
 void
 test_toolbar_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
@@ -1221,14 +1215,9 @@ test_toolbar_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
                                   _test_toolbar_focus_focus_animate_check_changed,
                                   win);
 
-   chk = elm_check_add(bx_opt);
-   elm_object_text_set(chk, "Focus Auto scroll bring in enable");
-   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
-   evas_object_smart_callback_add(chk, "changed", _test_toolbar_focus_bring_in_changed,
-                                  NULL);
-   elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get());
-   elm_box_pack_end(bx_opt, chk);
-   evas_object_show(chk);
+   // Focus Autoscroll Mode
+   fr = _focus_autoscroll_mode_frame_create(bx);
+   elm_box_pack_end(bx, fr);
 
    // Focus movement policy
    fr = elm_frame_add(bx);
index ba01789..9d8632b 100644 (file)
@@ -528,7 +528,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
    ELM_CONFIG_VAL(D, T, focus_highlight_clip_disable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR);
-   ELM_CONFIG_VAL(D, T, focus_auto_scroll_bring_in_enable, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR);
    ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
    ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
@@ -2027,8 +2027,16 @@ _env_get(void)
    if (s) _elm_config->scroll_smooth_future_time = _elm_atof(s);
    s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
    if (s) _elm_config->scroll_smooth_time_window = _elm_atof(s);
-   s = getenv("ELM_FOCUS_AUTO_SCROLL_BRING_IN_ENABLE");
-   if (s) _elm_config->focus_auto_scroll_bring_in_enable = !!atoi(s);
+   s = getenv("ELM_FOCUS_AUTOSCROLL_MODE");
+   if (s)
+     {
+        if (!strcmp(s, "ELM_FOCUS_AUTOSCROLL_MODE_NONE"))
+          _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_NONE;
+        else if (!strcmp(s, "ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN"))
+          _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN;
+        else
+          _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_SHOW;
+     }
 
    s = getenv("ELM_THEME");
    if (s) eina_stringshare_replace(&_elm_config->theme, s);
@@ -2926,16 +2934,16 @@ elm_config_scroll_thumbscroll_acceleration_weight_set(double weight)
    _elm_config->thumbscroll_acceleration_weight = weight;
 }
 
-EAPI Eina_Bool
-elm_config_focus_auto_scroll_bring_in_enabled_get(void)
+EAPI Elm_Focus_Autoscroll_Mode
+elm_config_focus_autoscroll_mode_get(void)
 {
-   return _elm_config->focus_auto_scroll_bring_in_enable;
+   return _elm_config->focus_autoscroll_mode;
 }
 
 EAPI void
-elm_config_focus_auto_scroll_bring_in_enabled_set(Eina_Bool enabled)
+elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode)
 {
-   _elm_config->focus_auto_scroll_bring_in_enable = !!enabled;
+   _elm_config->focus_autoscroll_mode = mode;
 }
 
 EAPI void
index c958186..8340661 100644 (file)
@@ -551,24 +551,48 @@ EAPI double       elm_config_scroll_thumbscroll_acceleration_weight_get(void);
 EAPI void         elm_config_scroll_thumbscroll_acceleration_weight_set(double weight);
 
 /**
- * Get enable status of focus auto scroll bring in.
+ * Focus Autoscroll Mode
  *
- * @see elm_config_focus_auto_scroll_bring_in_enabled_set()
+ * @since 1.10
+ * @ingroup Focus
+ */
+typedef enum
+{
+   ELM_FOCUS_AUTOSCROLL_MODE_SHOW, /**< directly show the focused region or item automatically */
+   ELM_FOCUS_AUTOSCROLL_MODE_NONE, /**< do not show the focused region or item automatically */
+   ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN /**< bring_in the focused region or item automatically which might invole the scrolling */
+} Elm_Focus_Autoscroll_Mode;
+
+/**
+ * Get focus auto scroll mode.
+ *
+ * When a region or an item is focused and it resides inside any scroller,
+ * elementary will automatically scroll the focused area to the visible
+ * viewport.
+ *
+ * @see elm_config_focus_autoscroll_mode_set()
  * @ingroup Focus
  * @since 1.10
  */
-EAPI Eina_Bool    elm_config_focus_auto_scroll_bring_in_enabled_get(void);
+EAPI Elm_Focus_Autoscroll_Mode elm_config_focus_autoscroll_mode_get(void);
 
 /**
- * Set enable status of focus auto scroll bring in.
+ * Set focus auto scroll mode.
+ *
+ * @param mode focus auto scroll mode. This can be one of the
+ * Elm_Focus_Autoscroll_Mode enum values.
  *
- * @param enabled enable scroll bring in if @c EINA_TRUE, disable otherwise
+ * When a region or an item is focused and it resides inside any scroller,
+ * elementary will automatically scroll the focused area to the visible
+ * viewport.
+ * Focus auto scroll mode is set to @c ELM_FOCUS_AUTOSCROLL_MODE_SHOW by
+ * default historically.
  *
- * @see elm_config_focus_auto_scroll_bring_in_enabled_get()
+ * @see elm_config_focus_autoscroll_mode_get()
  * @ingroup Focus
  * @since 1.10
  */
-EAPI void         elm_config_focus_auto_scroll_bring_in_enabled_set(Eina_Bool enabled);
+EAPI void         elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode);
 
 /**
  * @}
index b91ddc5..3eebaf4 100644 (file)
@@ -1487,12 +1487,20 @@ _elm_gengrid_item_focused(Elm_Gen_Item *it)
        (elm_widget_item_disabled_get(it)))
      return;
 
-   if (!_elm_config->focus_auto_scroll_bring_in_enable)
-     elm_gengrid_item_show
+   switch (_elm_config->focus_autoscroll_mode)
+     {
+      case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
+         elm_gengrid_item_show
             ((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN);
-   else
-     elm_gengrid_item_bring_in
+         break;
+      case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
+         elm_gengrid_item_bring_in
             ((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN);
+         break;
+      default:
+         break;
+     }
+
    sd->focused_item = (Elm_Object_Item *)it;
 
    if (elm_widget_focus_highlight_enabled_get(obj))
index c220d34..c524d1a 100644 (file)
@@ -2432,12 +2432,20 @@ _elm_genlist_item_focused(Elm_Gen_Item *it)
        (elm_widget_item_disabled_get(it)))
      return;
 
-   if (!_elm_config->focus_auto_scroll_bring_in_enable)
-     elm_genlist_item_show((Elm_Object_Item *)it,
-                           ELM_GENLIST_ITEM_SCROLLTO_IN);
-   else
-     elm_genlist_item_bring_in((Elm_Object_Item *)it,
+   switch (_elm_config->focus_autoscroll_mode)
+     {
+      case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
+         elm_genlist_item_show((Elm_Object_Item *)it,
                                ELM_GENLIST_ITEM_SCROLLTO_IN);
+         break;
+      case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
+         elm_genlist_item_bring_in((Elm_Object_Item *)it,
+                                   ELM_GENLIST_ITEM_SCROLLTO_IN);
+         break;
+      default:
+         break;
+     }
+
    sd->focused_item = (Elm_Object_Item *)it;
 
    if (elm_widget_focus_highlight_enabled_get(obj))
index 9ebe5a1..fcaa40e 100644 (file)
@@ -1094,10 +1094,17 @@ _elm_list_item_focused(Elm_List_Item *it)
    evas_object_geometry_get(sd->hit_rect, &sx, &sy, &sw, &sh);
    if ((x < sx) || (y < sy)|| ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
      {
-        if (!_elm_config->focus_auto_scroll_bring_in_enable)
-          elm_list_item_show((Elm_Object_Item *)it);
-        else
-          elm_list_item_bring_in((Elm_Object_Item *)it);
+        switch (_elm_config->focus_autoscroll_mode)
+          {
+           case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
+              elm_list_item_show((Elm_Object_Item *)it);
+              break;
+           case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
+              elm_list_item_bring_in((Elm_Object_Item *)it);
+              break;
+           default:
+              break;
+          }
      }
    sd->focused_item = (Elm_Object_Item *)it;
    if (elm_widget_focus_highlight_enabled_get(WIDGET(it)))
index 7848233..2ee65cf 100644 (file)
@@ -234,7 +234,7 @@ struct _Elm_Config
    unsigned char focus_highlight_clip_disable; /**< This shows disabled status of focus highlight clip feature. This value is false by default so the focus highlight is clipped. */
    unsigned char focus_move_policy; /**< This show how the elementary focus is moved to another object. Focus can be moved by click or mouse_in. */
    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.*/
-   unsigned char focus_auto_scroll_bring_in_enable; /**< This shows the enabled status of focus auto scroll bring in feature. This is disabled by default.*/
+   Elm_Focus_Autoscroll_Mode focus_autoscroll_mode; /**< This shows the focus auto scroll mode. By default, @c ELM_FOCUS_AUTOSCROLL_MODE_SHOW is set. */
    int           toolbar_shrink_mode;
    unsigned char fileselector_expand_enable;
    unsigned char fileselector_double_tap_navigation_enable;
index dc3b589..5ad643a 100644 (file)
@@ -601,12 +601,20 @@ _elm_toolbar_item_focused(Elm_Toolbar_Item *it)
      return;
 
    sd->focused_item = it;
-   if (!_elm_config->focus_auto_scroll_bring_in_enable)
-     elm_toolbar_item_show((Elm_Object_Item *)it,
-                           ELM_TOOLBAR_ITEM_SCROLLTO_IN);
-   else
-     elm_toolbar_item_bring_in((Elm_Object_Item *)it,
+   switch (_elm_config->focus_autoscroll_mode)
+     {
+      case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
+         elm_toolbar_item_show((Elm_Object_Item *)it,
                                ELM_TOOLBAR_ITEM_SCROLLTO_IN);
+         break;
+      case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
+         elm_toolbar_item_bring_in((Elm_Object_Item *)it,
+                                   ELM_TOOLBAR_ITEM_SCROLLTO_IN);
+         break;
+      default:
+         break;
+     }
+
    if (elm_widget_focus_highlight_enabled_get(obj))
      {
         edje_object_signal_emit
index 96f3853..47f1855 100644 (file)
@@ -645,10 +645,18 @@ _elm_widget_focus_region_show(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
 
         if (_elm_scrollable_is(o) && !elm_widget_disabled_get(o))
           {
-             if (!_elm_config->focus_auto_scroll_bring_in_enable)
-               eo_do(o, elm_interface_scrollable_content_region_show(x, y, w, h));
-             else
-               eo_do(o, elm_interface_scrollable_region_bring_in(x, y, w, h));
+             switch (_elm_config->focus_autoscroll_mode)
+               {
+                case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
+                   eo_do(o, elm_interface_scrollable_content_region_show(x, y, w, h));
+                   break;
+                case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
+                   eo_do(o, elm_interface_scrollable_region_bring_in(x, y, w, h));
+                   break;
+                default:
+                   break;
+               }
+
 
              if (!elm_widget_focus_region_get(o, &x, &y, &w, &h))
                {