widget: Move item_loop_enabled to scrollable (EO)

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
This commit is contained in:
Jean-Philippe Andre 2017-08-30 16:15:34 +09:00
parent a82ab33bed
commit 692282e67a
12 changed files with 36 additions and 30 deletions

View 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;
}

View 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; }

View 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;
}

View 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; }

View 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 \

View 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;

View 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;
}

View 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; }

View 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

View 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)
{

View 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.

View 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);