efl_ui_multi_selectable: clean this up

this commit merges common functions from efl_ui_multi_selectable and
efl_ui_multi_selectable_async. Additionally, the two different aspects
of accessing the elements in a multi_selectable widget (numerical or
object based) are now abstracted into interfaces called range_numeric and
range_object. numeric APIs are also prefixed with id's, so its possible
for one widget to implement both (if there will ever be the demand to do
that in future).

The main reason for this split is:
- there is no good common path between mvvm based multi_selectable and
object based multi_Selectable, so there is no way that both sides would
benefit, without the other one suffering.
- If we find later on the demand to implement both on one widget, we now
can fully do that
- Common API is available for both types, so its less API and less
confusion for the API user.

ref T7871
ref T8265

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10675
This commit is contained in:
Marcel Hollerbach 2019-11-20 12:36:02 +00:00
parent 3b743715a0
commit f7868fd28c
23 changed files with 192 additions and 185 deletions

View File

@ -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)

View File

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

View File

@ -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

View File

@ -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

View File

@ -298,6 +298,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_selectable.eo.h>
# include <efl_ui_single_selectable.eo.h>
# include <efl_ui_multi_selectable.eo.h>
# include <efl_ui_multi_selectable_object_range.eo.h>
# include <efl_ui_multi_selectable_index_range.eo.h>
# include <efl_ui_popup.eo.h>
# include <efl_ui_alert_popup.eo.h>
# include <efl_ui_popup_part_backwall.eo.h>
@ -307,7 +309,6 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_tab_bar.eo.h>
# include <efl_ui_tab_page.eo.h>
# include <efl_ui_tab_pager.eo.h>
# include <efl_ui_multi_selectable_async.eo.h>
# include <efl_ui_select_model.eo.h>
# include <efl_ui_list_view.eo.h>

View File

@ -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);
}

View File

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

View File

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

View File

@ -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
]]

View File

@ -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

View File

@ -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 {

View File

@ -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"

View File

@ -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

View File

@ -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 {

View File

@ -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<Efl.Ui.Selectable> @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]]
}

View File

@ -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<uint64> @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<uint64> @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]]
}
}
}

View File

@ -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<uint64> @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<uint64> @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.]]
}
}
}
}

View File

@ -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<Efl.Ui.Selectable> @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.]]
}
}
}
}

View File

@ -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"

View File

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

View File

@ -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',

View File

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

View File

@ -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)))