widget: Move item_loop_enabled to scrollable (EO)
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 30 Aug 2017 07:15:34 +0000 (16:15 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 30 Aug 2017 08:29:52 +0000 (17:29 +0900)
I was told that the scrollable interface is being redesigned for EO.
This API definitely does not belong to the base Widget class, as it's
quite specific to item-based scrollable widgets, such as lists and
grids. Since Elm.Interface_Scrollable is itself being revamped, it is a
good place to move that EO API for now.

Ref T5363

12 files changed:
src/lib/elementary/elm_gengrid.c
src/lib/elementary/elm_gengrid.eo
src/lib/elementary/elm_genlist.c
src/lib/elementary/elm_genlist.eo
src/lib/elementary/elm_interface_scrollable.c
src/lib/elementary/elm_interface_scrollable.eo
src/lib/elementary/elm_list.c
src/lib/elementary/elm_list.eo
src/lib/elementary/elm_main.c
src/lib/elementary/elm_widget.c
src/lib/elementary/elm_widget.eo
src/lib/elementary/elm_widget.h

index 47fd0d6..07fba28 100644 (file)
@@ -5541,13 +5541,13 @@ _elm_gengrid_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *
 }
 
 EOLIAN static void
-_elm_gengrid_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool enable)
+_elm_gengrid_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool enable)
 {
    sd->item_loop_enable = !!enable;
 }
 
 EOLIAN static Eina_Bool
-_elm_gengrid_elm_widget_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
+_elm_gengrid_elm_interface_scrollable_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
 {
    return sd->item_loop_enable;
 }
index d4145e7..0a6dcc6 100644 (file)
@@ -558,7 +558,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Elm.Interface_Scrollable,
       Elm.Widget.widget_event;
       Elm.Widget.focus_highlight_geometry { get; }
       Elm.Widget.focused_item { get; }
-      Elm.Widget.item_loop_enabled { get; set; }
+      Elm.Interface_Scrollable.item_loop_enabled { get; set; }
       Elm.Interface_Scrollable.bounce_allow { set; }
       Elm.Interface_Scrollable.policy { get; set; }
       Elm.Interface.Atspi_Accessible.children { get; }
index 369ef1d..0abbd87 100644 (file)
@@ -8526,13 +8526,13 @@ _elm_genlist_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *
 }
 
 EOLIAN static void
-_elm_genlist_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enable)
+_elm_genlist_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enable)
 {
    sd->item_loop_enable = !!enable;
 }
 
 EOLIAN static Eina_Bool
-_elm_genlist_elm_widget_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
+_elm_genlist_elm_interface_scrollable_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
 {
    return sd->item_loop_enable;
 }
index 9e1b041..e2a1f24 100644 (file)
@@ -543,7 +543,7 @@ class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
       Elm.Widget.widget_sub_object_del;
       Elm.Widget.widget_event;
       Elm.Widget.focused_item { get; }
-      Elm.Widget.item_loop_enabled { get; set; }
+      Elm.Interface_Scrollable.item_loop_enabled { get; set; }
       Elm.Interface_Scrollable.bounce_allow { get; set; }
       Elm.Interface_Scrollable.policy { get; set; }
       Elm.Interface.Atspi_Accessible.children { get; }
index 6b10a02..1757d5e 100644 (file)
@@ -4741,6 +4741,18 @@ _elm_interface_scrollable_efl_ui_focus_manager_focus_set(Eo *obj, Elm_Scrollable
    elm_interface_scrollable_region_bring_in(obj, geom.x, geom.y, geom.w, geom.h);
 }
 
+EOLIAN static void
+_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED, Eina_Bool enable EINA_UNUSED)
+{
+}
+
+EOLIAN static Eina_Bool
+_elm_interface_scrollable_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+
 /* Internal EO APIs and hidden overrides */
 
 #define ELM_PAN_EXTRA_OPS \
index 452cee7..c953ab8 100644 (file)
@@ -658,6 +658,12 @@ mixin Elm.Interface_Scrollable(Efl.Ui.Scrollable, Efl.Canvas.Group, Efl.Ui.Focus
             @in h: bool; [[Whether to limit the minimum vertical size]]
          }
       }
+      @property item_loop_enabled {
+         [[Whether scrolling should loop around.]]
+         values {
+            enable: bool; [[True to enable looping.]]
+         }
+      }
    }
    implements {
       class.constructor;
index abfc36a..a1c355f 100644 (file)
@@ -3134,13 +3134,13 @@ _elm_list_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
 }
 
 EOLIAN static void
-_elm_list_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool enable)
+_elm_list_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool enable)
 {
    sd->item_loop_enable = !!enable;
 }
 
 EOLIAN static Eina_Bool
-_elm_list_elm_widget_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
+_elm_list_elm_interface_scrollable_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
 {
    return sd->item_loop_enable;
 }
index b8a20db..4b34e79 100644 (file)
@@ -445,7 +445,7 @@ class Elm.List (Efl.Ui.Layout, Elm.Interface_Scrollable,
       Elm.Widget.widget_sub_object_del;
       Elm.Widget.widget_event;
       Elm.Widget.focused_item { get; }
-      Elm.Widget.item_loop_enabled { get; set; }
+      Elm.Interface_Scrollable.item_loop_enabled { get; set; }
       Elm.Interface_Scrollable.policy { set; }
       Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
       Elm.Interface.Atspi_Accessible.children { get; }
index 4752d30..012b607 100644 (file)
@@ -1862,14 +1862,16 @@ elm_object_scroll_item_loop_enabled_set(Evas_Object *obj,
                                         Eina_Bool   enable)
 {
    EINA_SAFETY_ON_NULL_RETURN(obj);
-   elm_widget_item_loop_enabled_set(obj, enable);
+   if (!efl_isa(obj, ELM_INTERFACE_SCROLLABLE_MIXIN)) return;
+   elm_interface_scrollable_item_loop_enabled_set(obj, enable);
 }
 
 EAPI Eina_Bool
 elm_object_scroll_item_loop_enabled_get(const Evas_Object *obj)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
-   return elm_widget_item_loop_enabled_get(obj);
+   if (!efl_isa(obj, ELM_INTERFACE_SCROLLABLE_MIXIN)) return EINA_FALSE;
+   return elm_interface_scrollable_item_loop_enabled_get(obj);
 }
 
 EAPI Eina_Bool
index 4cefaf0..25c64b7 100644 (file)
@@ -4015,17 +4015,6 @@ elm_widget_scroll_child_locked_y_get(const Eo *obj)
    return sd->child_drag_y_locked;
 }
 
-EOLIAN static void
-_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd EINA_UNUSED, Eina_Bool enable EINA_UNUSED)
-{
-}
-
-EOLIAN static Eina_Bool
-_elm_widget_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd EINA_UNUSED)
-{
-   return EINA_FALSE;
-}
-
 EOLIAN static Efl_Ui_Theme_Apply
 _elm_widget_theme_object_set(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle)
 {
index 7a53bf7..f083620 100644 (file)
@@ -448,12 +448,9 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
             }
          }
       }
-      @property item_loop_enabled {
-         [[Control item loop feature.]]
-         values {
-            enable: bool; [[$true if item loop is enabled, $false otherwise]]
-         }
-      }
+
+      /* FIXME: Scroll API. Not sure how those APIs should be exposed with
+       * the new scrollable API. */
       scroll_hold_push {
          [[Push scroll hold]]
       }
@@ -467,6 +464,8 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
          [[Pop scroller freeze]]
       }
 
+      /* FIXME: This is not 100% related to focus. This documentation needs
+       * further fixing. */
       @property focus_region {
          [[Region to show when focus changes within this widget.
 
index 73914af..4a9abca 100644 (file)
@@ -743,8 +743,6 @@ EAPI void             elm_widget_scroll_lock_set(Evas_Object *obj, Efl_Ui_Scroll
 EAPI Efl_Ui_Scroll_Block elm_widget_scroll_lock_get(const Evas_Object *obj);
 EAPI int              elm_widget_scroll_child_locked_x_get(const Evas_Object *obj);
 EAPI int              elm_widget_scroll_child_locked_y_get(const Evas_Object *obj);
-EAPI void             elm_widget_item_loop_enabled_set(Evas_Object *obj, Eina_Bool enable);
-EAPI Eina_Bool        elm_widget_item_loop_enabled_get(const Evas_Object *obj);
 EAPI Efl_Ui_Theme_Apply  elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
 EAPI Eina_Bool        elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
 EAPI Evas_Object     *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse);