elementary: add Efl.Ui.Grid_View by leveraging MVVM and Collection/Position_Manager infrastructure.

Co-authored-by: Marcel Hollerbach <mail@marcel-hollerbach.de>

Differential Revision: https://phab.enlightenment.org/D9960
This commit is contained in:
Cedric Bail 2019-09-15 23:18:50 -07:00
parent 78b69d45b5
commit 5096cd32ad
5 changed files with 47 additions and 1 deletions

View File

@ -335,6 +335,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_view_model.eo.h>
# include <efl_ui_collection_view.eo.h>
# include <efl_ui_list_view.eo.h>
# include <efl_ui_grid_view.eo.h>
# include <efl_ui_scroller.eo.h>
# include <efl_ui_pan.eo.h>

View File

@ -11,7 +11,7 @@ class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements
object. By using different @.position_manager objects this widget can show unidimensional lists or
two-dimensional grids of items, for example.
This class is intended to act as a base for widgets like List_View or Grid_View,
This class is intended to act as a base for widgets like List_View or @Efl.Ui.Grid_View,
which hide this complexity from the user.
Items are generated by the @Efl.Ui.Factory defined with .factory.set to match the content of the

View File

@ -0,0 +1,26 @@
#ifdef HAVE_CONFIG_H
#include "elementary_config.h"
#endif
#define ELM_LAYOUT_PROTECTED
#define EFL_UI_SCROLL_MANAGER_PROTECTED
#define EFL_UI_SCROLLBAR_PROTECTED
#include <Efl_Ui.h>
#define MY_CLASS EFL_UI_GRID_VIEW_CLASS
#define MY_CLASS_PFX efl_ui_grid_view
#define MY_CLASS_NAME "Efl.Ui.Grid_View"
EOLIAN static Eo *
_efl_ui_grid_view_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_ui_collection_view_position_manager_set(obj, efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS));
return obj;
}
#include "efl_ui_grid_view.eo.c"

View File

@ -0,0 +1,17 @@
class @beta Efl.Ui.Grid_View extends Efl.Ui.Collection_View
{
[[A scrollable grid of @Efl.Ui.Item objects, typically @Efl.Ui.Grid_Default_Item objects.
Items are added asynchronously by an @Efl.Ui.Factory from the definition of an @Efl.Model.
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.
]]
data: null;
implements {
Efl.Object.constructor;
}
}

View File

@ -186,6 +186,7 @@ pub_eo_files = [
'efl_ui_view_model.eo',
'efl_ui_collection_view.eo',
'efl_ui_collection_view_focus_manager.eo',
'efl_ui_grid_view.eo',
]
foreach eo_file : pub_eo_files
@ -899,6 +900,7 @@ elementary_src = [
'efl_ui_grid_default_item.c',
'efl_ui_grid.c',
'efl_ui_list_view.c',
'efl_ui_grid_view.c',
'efl_ui_layout_factory.c',
'efl_ui_scroller.c',
'efl_ui_scroll_manager.c',