diff --git a/src/bin/elementary/test_ui_collection.c b/src/bin/elementary/test_ui_collection.c index 2f74809d29..2397e14211 100644 --- a/src/bin/elementary/test_ui_collection.c +++ b/src/bin/elementary/test_ui_collection.c @@ -8,13 +8,13 @@ static void _all_select(void *data, const Efl_Event *ev EINA_UNUSED) { - efl_ui_selectable_all_select(data); + efl_ui_multi_selectable_all_select(data); } static void _all_unselect(void *data, const Efl_Event *ev EINA_UNUSED) { - efl_ui_selectable_all_unselect(data); + efl_ui_multi_selectable_all_unselect(data); } static void @@ -168,7 +168,7 @@ _select_value_cb(void *data, const Efl_Event *ev) { Efl_Ui_Collection *c = data; - efl_ui_selectable_select_mode_set(c, efl_ui_radio_group_selected_value_get(ev->object)); + efl_ui_multi_selectable_select_mode_set(c, efl_ui_radio_group_selected_value_get(ev->object)); } void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class *item, const char *name) diff --git a/src/examples/elementary/efl_ui_collection_view_example_1.c b/src/examples/elementary/efl_ui_collection_view_example_1.c index 72960651fb..3255b17d4d 100644 --- a/src/examples/elementary/efl_ui_collection_view_example_1.c +++ b/src/examples/elementary/efl_ui_collection_view_example_1.c @@ -96,7 +96,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev) li = efl_add(EFL_UI_COLLECTION_VIEW_CLASS, win, efl_ui_collection_view_position_manager_set(efl_added, position_manager), efl_ui_view_model_set(efl_added, model), - efl_ui_multi_selectable_async_select_mode_set(efl_added, mode), + efl_ui_multi_selectable_select_mode_set(efl_added, mode), efl_ui_collection_view_factory_set(efl_added, factory)); efl_content_set(win, li); diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c index ac4976a3c1..edf6d5dd4b 100644 --- a/src/examples/elementary/efl_ui_list_example_1.c +++ b/src/examples/elementary/efl_ui_list_example_1.c @@ -37,7 +37,7 @@ _list_selected(void *data EINA_UNUSED, const Efl_Event *ev) Eo *item = ev->info, *tmp; printf("list item [%p:%d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_selectable_selected_get(item)? "selected" : "unselected")); - Eina_Iterator *selects = efl_ui_selectable_selected_iterator_new(list); + Eina_Iterator *selects = efl_ui_multi_selectable_selected_iterator_new(list); EINA_ITERATOR_FOREACH(selects, tmp) printf("selected [%p:%d] ", tmp, efl_ui_item_index_get(tmp)); @@ -77,7 +77,7 @@ static void _select_radio_changed(void *data, const Efl_Event *ev) { Eo *list = data; - efl_ui_selectable_select_mode_set(list, efl_ui_radio_group_selected_value_get(ev->object)); + efl_ui_multi_selectable_select_mode_set(list, efl_ui_radio_group_selected_value_get(ev->object)); } static void diff --git a/src/examples/elementary/efl_ui_list_view_example_3.c b/src/examples/elementary/efl_ui_list_view_example_3.c index c9f6b0db97..dcf6082926 100644 --- a/src/examples/elementary/efl_ui_list_view_example_3.c +++ b/src/examples/elementary/efl_ui_list_view_example_3.c @@ -110,7 +110,7 @@ static void _bt_none_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *li = data; - efl_ui_multi_selectable_async_select_mode_set(li, EFL_UI_SELECT_MODE_NONE); + efl_ui_multi_selectable_select_mode_set(li, EFL_UI_SELECT_MODE_NONE); } static void @@ -124,7 +124,7 @@ static void _bt_default_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *li = data; - efl_ui_multi_selectable_async_select_mode_set(li, EFL_UI_SELECT_MODE_SINGLE); + efl_ui_multi_selectable_select_mode_set(li, EFL_UI_SELECT_MODE_SINGLE); } static void diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 9c8744d006..b3b07b5181 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -298,6 +298,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include +# include # include # include # include @@ -307,7 +309,6 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include -# include # include # include diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index 6c3c5fe226..3e54f79b24 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -261,7 +261,7 @@ _efl_ui_collection_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA } EOLIAN static Eina_Iterator* -_efl_ui_collection_efl_ui_multi_selectable_selected_iterator_new(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_object_range_selected_iterator_new(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { return eina_list_iterator_new(pd->selected); } @@ -1147,13 +1147,13 @@ _range_selection_find(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_range_select(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) +_efl_ui_collection_efl_ui_multi_selectable_object_range_range_select(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) { _range_selection_find(obj, pd, a, b, EINA_TRUE); } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_range_unselect(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) +_efl_ui_collection_efl_ui_multi_selectable_object_range_range_unselect(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) { _range_selection_find(obj, pd, a, b, EINA_FALSE); } diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index 6071c2ae02..342feea116 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -1,7 +1,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Pack_Linear, Efl.Ui.Layout_Orientable, - Efl.Ui.Multi_Selectable, + Efl.Ui.Multi_Selectable_Object_Range, Efl.Ui.Focus.Manager_Sub, Efl.Ui.Widget_Focus_Manager, Efl.Ui.Item_Clickable @@ -24,7 +24,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements If all items do not fit in the current widget size scrolling facilities are provided. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Object_Range.selected_iterator_new. @since 1.23 ]] @@ -84,12 +84,12 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Widget.focus_state_apply; Efl.Ui.Focus.Manager.move; Efl.Ui.Single_Selectable.last_selected { get; } - Efl.Ui.Multi_Selectable.selected_iterator_new; Efl.Ui.Multi_Selectable.select_mode {get; set;} Efl.Ui.Multi_Selectable.all_select; Efl.Ui.Multi_Selectable.all_unselect; - Efl.Ui.Multi_Selectable.range_select; - Efl.Ui.Multi_Selectable.range_unselect; + Efl.Ui.Multi_Selectable_Object_Range.selected_iterator_new; + Efl.Ui.Multi_Selectable_Object_Range.range_select; + Efl.Ui.Multi_Selectable_Object_Range.range_unselect; Efl.Ui.Single_Selectable.fallback_selection {get; set;} } } diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index e3d4c96ff0..e5cff428b4 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -1921,11 +1921,11 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event) // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC mselect = ev->current; while (mselect && - !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE) && + !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_INDEX_RANGE_INTERFACE) && efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS)) mselect = efl_ui_view_model_get(mselect); - if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE)) + if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_INDEX_RANGE_INTERFACE)) { mselect = NULL; selection = EINA_FALSE; diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo index 330c95693c..65a1ee9e62 100644 --- a/src/lib/elementary/efl_ui_collection_view.eo +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -3,7 +3,7 @@ class Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.Manager_Sub, Efl.Ui.Widget_Focus_Manager, Efl.Ui.Item_Clickable - composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, Efl.Ui.Multi_Selectable_Async, Efl.Ui.Single_Selectable + composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, Efl.Ui.Multi_Selectable_Index_Range, Efl.Ui.Single_Selectable { [[This widget displays a list of items in an arrangement controlled by an external @.position_manager object. By using different @.position_manager objects this widget can show unidimensional lists or @@ -21,8 +21,8 @@ class Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements If all items do not fit in the current widget size scrolling facilities are provided. - Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Index_Range.selected_ndx_iterator_new. @since 1.23 ]] diff --git a/src/lib/elementary/efl_ui_grid.eo b/src/lib/elementary/efl_ui_grid.eo index d461760eda..ad4a4aee68 100644 --- a/src/lib/elementary/efl_ui_grid.eo +++ b/src/lib/elementary/efl_ui_grid.eo @@ -8,7 +8,7 @@ class Efl.Ui.Grid extends Efl.Ui.Collection @Efl.Ui.Layout_Orientable.orientation. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Object_Range.selected_iterator_new. @Efl.Ui.Grid supports grouping by using @Efl.Ui.Group_Item objects. Group headers are displayed at the top of the viewport if items belonging to the group diff --git a/src/lib/elementary/efl_ui_grid_view.eo b/src/lib/elementary/efl_ui_grid_view.eo index 18e513e8c9..3ad70c25d2 100644 --- a/src/lib/elementary/efl_ui_grid_view.eo +++ b/src/lib/elementary/efl_ui_grid_view.eo @@ -7,8 +7,8 @@ class @beta Efl.Ui.Grid_View extends Efl.Ui.Collection_View The orientation (vertical or horizontal) of the grid can be set with @Efl.Ui.Layout_Orientable.orientation. - Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Index_Range.selected_ndx_iterator_new. ]] data: null; implements { diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index f3c35ac9cf..349416ee8a 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -30,7 +30,7 @@ static Efl_Ui_Select_Mode _fetch_state(Eo *obj) { if (efl_isa(obj, EFL_UI_MULTI_SELECTABLE_INTERFACE)) - return efl_ui_selectable_select_mode_get(obj); + return efl_ui_multi_selectable_select_mode_get(obj); if (efl_isa(obj, EFL_UI_SINGLE_SELECTABLE_INTERFACE)) return EFL_UI_SELECT_MODE_SINGLE; ERR("Uncaught state %s", efl_debug_name_get(obj)); @@ -236,6 +236,7 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_item, Efl_Ui_Item_Data) #include "efl_ui_item.eo.c" #include "efl_ui_selectable.eo.c" #include "efl_ui_multi_selectable.eo.c" +#include "efl_ui_multi_selectable_object_range.eo.c" #include "efl_ui_single_selectable.eo.c" #include "efl_ui_item_clickable.eo.c" diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo index 0bd3045223..73ef34b9e8 100644 --- a/src/lib/elementary/efl_ui_list.eo +++ b/src/lib/elementary/efl_ui_list.eo @@ -8,7 +8,7 @@ class Efl.Ui.List extends Efl.Ui.Collection @Efl.Ui.Layout_Orientable.orientation. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Object_Range.selected_iterator_new. @Efl.Ui.List supports grouping by using @Efl.Ui.Group_Item objects. Group headers are displayed at the top or left side of the viewport if items belonging to the group diff --git a/src/lib/elementary/efl_ui_list_view.eo b/src/lib/elementary/efl_ui_list_view.eo index c4de87da5a..af46bd32d0 100644 --- a/src/lib/elementary/efl_ui_list_view.eo +++ b/src/lib/elementary/efl_ui_list_view.eo @@ -7,8 +7,8 @@ class @beta Efl.Ui.List_View extends Efl.Ui.Collection_View The orientation (vertical or horizontal) of the list can be set with @Efl.Ui.Layout_Orientable.orientation. - Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Index_Range.selected_ndx_iterator_new. ]] data: null; implements { diff --git a/src/lib/elementary/efl_ui_multi_selectable.eo b/src/lib/elementary/efl_ui_multi_selectable.eo index 251f640185..c5237c8118 100644 --- a/src/lib/elementary/efl_ui_multi_selectable.eo +++ b/src/lib/elementary/efl_ui_multi_selectable.eo @@ -6,47 +6,15 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable The implementor of this interface provides the possibility to select multiple Selectables. If not, only @Efl.Ui.Single_Selectable should be implemented.]] - c_prefix: efl_ui_selectable; + c_prefix: efl_ui_multi_selectable; methods { @property select_mode { [[The mode type for children selection.]] - set {} - get {} values { mode: Efl.Ui.Select_Mode; [[Type of selection of children]] } } - selected_iterator_new { - [[Get the selected items in a iterator. The iterator sequence will be decided by selection.]] - return: iterator @move @no_unused; [[User has to free the iterator after usage.]] - } - range_select @beta { - [[Select a range of @Efl.Ui.Selectable. - - This will select the range of selectables from a to b or from b to a depending on which one comes first. - If a or b are not part of the widget, a error is returned, and no change is applied. - $null is not allowed as either of the parameters. - Both of the passed values will also be selected. - ]] - params { - a : Efl.Ui.Selectable; [[One side of the range.]] - b : Efl.Ui.Selectable; [[The other side of the range.]] - } - } - range_unselect @beta { - [[Unselect a range of @Efl.Ui.Selectable. - - This will unselect the range of selectables from a to b or from b to a depending on which one comes first. - If a or b are not part of the widget, a error is returned, and no change is applied. - $null is not allowed as either of the parameters. - Both of the passed values will also be unselected. - ]] - params { - a : Efl.Ui.Selectable; [[One side of the range.]] - b : Efl.Ui.Selectable; [[The other side of the range.]] - } - } all_select { [[Select all @Efl.Ui.Selectable]] } diff --git a/src/lib/elementary/efl_ui_multi_selectable_async.eo b/src/lib/elementary/efl_ui_multi_selectable_async.eo deleted file mode 100644 index 3a09682358..0000000000 --- a/src/lib/elementary/efl_ui_multi_selectable_async.eo +++ /dev/null @@ -1,63 +0,0 @@ -import efl_ui; - -interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable -{ - [[Interface for getting access to a range of selected items for widgets that provide them asynchronously. - - The implementor of this interface provides the possibility to select multiple @Efl.Ui.Selectable. - If not, only @Efl.Ui.Single_Selectable should be implemented. - A widget can only provide either this interface or @Efl.Ui.Multi_Selectable, but not both.]] - methods - { - @property select_mode { - [[The mode type for children selection.]] - set {} - get {} - values { - mode: Efl.Ui.Select_Mode; [[Type of selection of children]] - } - } - selected_iterator_new { - [[Gets an iterator of all the selected child of this model. - ]] - return: iterator @move @no_unused; [[The iterator gives indices of selected children. - It is valid until any change is made on the model.]] - } - unselected_iterator_new { - [[Gets an iterator of all the child of this model that are not selected. - ]] - return: iterator @move @no_unused; [[The iterator gives indices of unselected children. - It is valid until any change is made on the model.]] - } - range_select @beta { - [[Select a range of @Efl.Ui.Selectable. - - This will select the range of selectables from $a to $b or from $b to $a depending on which one comes first. - If $a or $b are not in the range the widget, an error is returned, and no change is applied. - Both of the passed values will also be selected. - ]] - params { - a : uint64; [[One side of the range.]] - b : uint64; [[The other side of the range.]] - } - } - range_unselect @beta { - [[Unselect a range of @Efl.Ui.Selectable. - - This will unselect the range of selectables from $a to $b or from $b to $a depending on which one comes first. - If $a or $b are not in the range of the widget, an error is returned, and no change is applied. - Both of the passed values will also be unselected. - ]] - params { - a : uint64; [[One side of the range.]] - b : uint64; [[The other side of the range.]] - } - } - all_select { - [[Select all @Efl.Ui.Selectable]] - } - all_unselect { - [[Unselect all @Efl.Ui.Selectable]] - } - } -} diff --git a/src/lib/elementary/efl_ui_multi_selectable_index_range.eo b/src/lib/elementary/efl_ui_multi_selectable_index_range.eo new file mode 100644 index 0000000000..39747ab8b4 --- /dev/null +++ b/src/lib/elementary/efl_ui_multi_selectable_index_range.eo @@ -0,0 +1,53 @@ +import efl_ui; + +interface @beta Efl.Ui.Multi_Selectable_Index_Range extends Efl.Ui.Multi_Selectable +{ + [[Interface for getting access to a range of selected items through their indices. + + The implementor of this interface provides the possibility to select multiple @Efl.Ui.Selectable objects. + If not, only @Efl.Ui.Single_Selectable should be implemented. + A widget can only provide either this interface or @Efl.Ui.Multi_Selectable_Object_Range, but not both.]] + c_prefix: efl_ui_multi_selectable; + methods + { + selected_ndx_iterator_new { + [[Gets an iterator over the indices of all the selected children. + ]] + return: iterator @move @no_unused; [[The iterator gives the indices of the selected children. + It is valid until any change is made to the selection state.]] + } + unselected_ndx_iterator_new { + [[Gets an iterator over the indices of all the unselected children. + ]] + return: iterator @move @no_unused; [[The iterator gives the indices of the unselected children. + It is valid until any change is made to the selection state.]] + } + ndx_range_select @beta { + [[Select a range of @Efl.Ui.Selectable objects using their indices inside the container. + + This will select the range of @Efl.Ui.Selectable objects from $a to $b or from $b to $a depending on + which one comes first. + If $a or $b are not part of the widget, an error is returned, and no change is applied. + $NULL is not allowed as either of the parameters. + ]] + params { + a : uint64; [[One side of the range.]] + b : uint64; [[The other side of the range.]] + } + } + ndx_range_unselect @beta { + [[Unselect a range of @Efl.Ui.Selectable objects using their indices inside the container. + + This will unselect the range of @Efl.Ui.Selectable objects from $a to $b or from $b to $a depending on + which one comes first. + If $a or $b are not part of the widget, an error is returned, and no change is applied. + $NULL is not allowed as either of the parameters. + Both of the passed values will also be unselected. + ]] + params { + a : uint64; [[One side of the range.]] + b : uint64; [[The other side of the range.]] + } + } + } +} diff --git a/src/lib/elementary/efl_ui_multi_selectable_object_range.eo b/src/lib/elementary/efl_ui_multi_selectable_object_range.eo new file mode 100644 index 0000000000..f88beb9efa --- /dev/null +++ b/src/lib/elementary/efl_ui_multi_selectable_object_range.eo @@ -0,0 +1,46 @@ +import efl_ui; + +interface @beta Efl.Ui.Multi_Selectable_Object_Range extends Efl.Ui.Multi_Selectable +{ + [[Interface for getting access to a range of selected items. + + The implementor of this interface provides the possibility to select multiple Selectables. + If not, only @Efl.Ui.Single_Selectable should be implemented. + A widget can only provide either this interface or @Efl.Ui.Multi_Selectable_Index_Range, but not both.]] + c_prefix: efl_ui_multi_selectable; + methods + { + selected_iterator_new { + [[Get the selected items in an iterator. The iterator sequence will be decided by selection.]] + return: iterator @move @no_unused; [[User has to free the iterator after usage.]] + } + range_select @beta { + [[Select a range of @Efl.Ui.Selectable. + + This will select the range of @Efl.Ui.Selectable objects from $a to $b or from $b to $a depending on + which one comes first. + If $a or $b are not part of the widget, an error is returned, and no change is applied. + $NULL is not allowed as either of the parameters. + Both of the passed values will also be selected. + ]] + params { + a : Efl.Ui.Selectable; [[One side of the range.]] + b : Efl.Ui.Selectable; [[The other side of the range.]] + } + } + range_unselect @beta { + [[Unselect a range of @Efl.Ui.Selectable. + + This will unselect the range of @Efl.Ui.Selectable objects from $a to $b or from $b to $a depending on + which one comes first. + If $a or $b are not part of the widget, an error is returned, and no change is applied. + $NULL is not allowed as either of the parameters. + Both of the passed values will also be unselected. + ]] + params { + a : Efl.Ui.Selectable; [[One side of the range.]] + b : Efl.Ui.Selectable; [[The other side of the range.]] + } + } + } +} diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index c6092a50a6..016f720a15 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -469,7 +469,7 @@ _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_D } static Eina_Iterator * -_efl_ui_select_model_efl_ui_multi_selectable_async_selected_iterator_new(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_index_range_selected_ndx_iterator_new(Eo *obj, Efl_Ui_Select_Model_Data *pd) { if (pd->parent && pd->parent->selection == EFL_UI_SELECT_MODE_NONE) @@ -478,7 +478,7 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_selected_iterator_new(Eo *obj } static Eina_Iterator * -_efl_ui_select_model_efl_ui_multi_selectable_async_unselected_iterator_new(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_index_range_unselected_ndx_iterator_new(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_FALSE); @@ -492,7 +492,7 @@ _efl_ui_select_model_efl_ui_single_selectable_last_selected_get(const Eo *obj EI } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_set(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_select_mode_set(Eo *obj, Efl_Ui_Select_Model_Data *pd, Efl_Ui_Select_Mode mode) { @@ -501,11 +501,11 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_set(Eo *obj, case EFL_UI_SELECT_MODE_SINGLE: mode = EFL_UI_SELECT_MODE_SINGLE; if (pd->selection == EFL_UI_SELECT_MODE_MULTI) - efl_ui_multi_selectable_async_all_unselect(obj); + efl_ui_multi_selectable_all_unselect(obj); break; case EFL_UI_SELECT_MODE_NONE: if (pd->selection == EFL_UI_SELECT_MODE_MULTI) - efl_ui_multi_selectable_async_all_unselect(obj); + efl_ui_multi_selectable_all_unselect(obj); else if (pd->last_model) { Eina_Value unselect = eina_value_bool_init(EINA_FALSE); @@ -526,14 +526,14 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_set(Eo *obj, } static Efl_Ui_Select_Mode -_efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_get(const Eo *obj EINA_UNUSED, +_efl_ui_select_model_efl_ui_multi_selectable_select_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd) { return pd->selection; } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_all_select(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_all_select(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { unsigned long count, i; @@ -553,16 +553,16 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_all_select(Eo *obj, } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_all_unselect(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_all_unselect(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { uint64_t count = efl_model_children_count_get(obj); - efl_ui_multi_selectable_async_range_unselect(obj, 0, count - 1); + efl_ui_multi_selectable_ndx_range_unselect(obj, 0, count - 1); } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_range_select(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_index_range_ndx_range_select(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED, uint64_t a, uint64_t b) { @@ -604,7 +604,7 @@ _children_unselect_then(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Va #define BATCH_MAX 100 static void -_efl_ui_select_model_efl_ui_multi_selectable_async_range_unselect(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_index_range_ndx_range_unselect(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED, uint64_t a, uint64_t b) { @@ -695,4 +695,4 @@ _efl_ui_select_model_efl_ui_selectable_selected_get(const Eo *obj, } #include "efl_ui_select_model.eo.c" -#include "efl_ui_multi_selectable_async.eo.c" +#include "efl_ui_multi_selectable_index_range.eo.c" diff --git a/src/lib/elementary/efl_ui_select_model.eo b/src/lib/elementary/efl_ui_select_model.eo index 7fa0f8411a..abe5137a18 100644 --- a/src/lib/elementary/efl_ui_select_model.eo +++ b/src/lib/elementary/efl_ui_select_model.eo @@ -1,5 +1,5 @@ class @beta Efl.Ui.Select_Model extends Efl.Boolean_Model - implements Efl.Ui.Multi_Selectable_Async, + implements Efl.Ui.Multi_Selectable_Index_Range, Efl.Ui.Selectable { [[Efl ui select model class]] @@ -9,13 +9,13 @@ class @beta Efl.Ui.Select_Model extends Efl.Boolean_Model Efl.Model.property { get; set; } Efl.Model.properties { get; } Efl.Ui.Single_Selectable.last_selected { get; } - Efl.Ui.Multi_Selectable_Async.selected_iterator_new; - Efl.Ui.Multi_Selectable_Async.unselected_iterator_new; - Efl.Ui.Multi_Selectable_Async.select_mode {get; set;} - Efl.Ui.Multi_Selectable_Async.all_select; - Efl.Ui.Multi_Selectable_Async.all_unselect; - Efl.Ui.Multi_Selectable_Async.range_select; - Efl.Ui.Multi_Selectable_Async.range_unselect; + Efl.Ui.Multi_Selectable.select_mode {get; set;} + Efl.Ui.Multi_Selectable.all_select; + Efl.Ui.Multi_Selectable.all_unselect; + Efl.Ui.Multi_Selectable_Index_Range.selected_ndx_iterator_new; + Efl.Ui.Multi_Selectable_Index_Range.unselected_ndx_iterator_new; + Efl.Ui.Multi_Selectable_Index_Range.ndx_range_select; + Efl.Ui.Multi_Selectable_Index_Range.ndx_range_unselect; Efl.Ui.Single_Selectable.fallback_selection {get; set;} Efl.Ui.Selectable.selected {get; set;} } diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 7e21417aef..e9aaa55f57 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -178,7 +178,8 @@ pub_eo_files = [ 'efl_ui_position_manager_grid.eo', 'efl_ui_selectable.eo', 'efl_ui_multi_selectable.eo', - 'efl_ui_multi_selectable_async.eo', + 'efl_ui_multi_selectable_object_range.eo', + 'efl_ui_multi_selectable_index_range.eo', 'efl_ui_single_selectable.eo', 'efl_ui_position_manager_data_access_v1.eo', 'efl_ui_tab_bar_default_item.eo', diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c index e2b61c5677..63f5340052 100644 --- a/src/tests/elementary/efl_ui_test_select_model.c +++ b/src/tests/elementary/efl_ui_test_select_model.c @@ -111,12 +111,12 @@ EFL_START_TEST(efl_test_select_model) ecore_main_loop_begin(); - it = efl_ui_multi_selectable_async_selected_iterator_new(model); + it = efl_ui_multi_selectable_selected_ndx_iterator_new(model); EINA_ITERATOR_FOREACH(it, index) fail_if(*index != 2); eina_iterator_free(it); - it = efl_ui_multi_selectable_async_unselected_iterator_new(model); + it = efl_ui_multi_selectable_unselected_ndx_iterator_new(model); EINA_ITERATOR_FOREACH(it, index) fail_if(*index == 2); eina_iterator_free(it); diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c index bb016474d3..3a02ed9e16 100644 --- a/src/tests/elementary/spec/efl_test_multi_selectable.c +++ b/src/tests/elementary/spec/efl_test_multi_selectable.c @@ -36,7 +36,7 @@ EFL_START_TEST(test_multi_select) int c = 0; Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -52,7 +52,7 @@ EFL_START_TEST(test_multi_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -70,7 +70,7 @@ EFL_START_TEST(test_multi_select_removal) { int c = 0; Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -88,7 +88,7 @@ EFL_START_TEST(test_multi_select_removal) c = 0; ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -101,7 +101,7 @@ EFL_START_TEST(test_single_select) int c = 0; Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -116,7 +116,7 @@ EFL_START_TEST(test_single_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2)); @@ -134,7 +134,7 @@ EFL_START_TEST(test_none_select) Eina_Array *arr_selected; int c = 0; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -147,7 +147,7 @@ EFL_START_TEST(test_none_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE); ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -159,9 +159,9 @@ EFL_START_TEST(all_select_api) { Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_all_select(widget); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_all_select(widget); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 3); @@ -176,11 +176,11 @@ EFL_START_TEST(all_unselect_api) { Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); - efl_ui_selectable_all_unselect(widget); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + efl_ui_multi_selectable_all_unselect(widget); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); @@ -192,11 +192,11 @@ EFL_START_TEST(range_unselect) { Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_all_select(widget); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_all_select(widget); - efl_ui_selectable_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + efl_ui_multi_selectable_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); eina_array_free(arr_selected); @@ -207,11 +207,11 @@ EFL_START_TEST(range_unselect2) { Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_all_select(widget); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_all_select(widget); - efl_ui_selectable_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + efl_ui_multi_selectable_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); eina_array_free(arr_selected); @@ -222,9 +222,9 @@ EFL_START_TEST(range_select) { Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -236,9 +236,9 @@ EFL_START_TEST(range_select2) { Eina_Array *arr_selected; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); - _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); + _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -250,9 +250,9 @@ EFL_START_TEST(change_mode_from_multi_to_single) { int sel = 0; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_all_select(widget); - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_all_select(widget); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); for (int i = 0; i < efl_content_count(widget); ++i) { if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) @@ -267,9 +267,9 @@ EFL_START_TEST(change_mode_from_multi_to_none) { int sel = 0; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_selectable_all_select(widget); - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); + efl_ui_multi_selectable_all_select(widget); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); for (int i = 0; i < efl_content_count(widget); ++i) { if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) @@ -283,9 +283,9 @@ EFL_START_TEST(change_mode_from_single_to_none) { int sel = 0; - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); - efl_ui_selectable_all_select(widget); - efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); + efl_ui_multi_selectable_all_select(widget); + efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); for (int i = 0; i < efl_content_count(widget); ++i) { if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))