diff options
author | Cedric Bail <cedric.bail@free.fr> | 2019-09-15 23:18:50 -0700 |
---|---|---|
committer | Cedric Bail <cedric.bail@free.fr> | 2019-09-17 20:35:16 -0700 |
commit | bab9180cf711a3e7b092d70b6593f4942b29fc80 (patch) | |
tree | bb4abd474589b9dd336666934777548879e7c090 | |
parent | b4343bd2a0a1c7212df1b067ec7877f72ce5d9fd (diff) | |
download | efl-bab9180cf711a3e7b092d70b6593f4942b29fc80.tar.gz |
elementary: add Efl.Ui.Grid_View by leveraging MVVM and Collection/Position_Manager infrastructure.
Differential Revision: https://phab.enlightenment.org/D9960
-rw-r--r-- | src/lib/elementary/Efl_Ui.h | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_collection_view.eo | 2 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_grid_view.c | 28 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_grid_view.eo | 17 | ||||
-rw-r--r-- | src/lib/elementary/meson.build | 1 |
5 files changed, 48 insertions, 1 deletions
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 20ad8fd387..5738e65753 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -286,6 +286,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> /** * Initialize Elementary diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo index 0509ae81ca..56d62fdca0 100644 --- a/src/lib/elementary/efl_ui_collection_view.eo +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -14,7 +14,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 diff --git a/src/lib/elementary/efl_ui_grid_view.c b/src/lib/elementary/efl_ui_grid_view.c new file mode 100644 index 0000000000..f648fd5666 --- /dev/null +++ b/src/lib/elementary/efl_ui_grid_view.c @@ -0,0 +1,28 @@ +#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> +#include "elm_priv.h" +#include "efl_ui_item_private.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_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" diff --git a/src/lib/elementary/efl_ui_grid_view.eo b/src/lib/elementary/efl_ui_grid_view.eo new file mode 100644 index 0000000000..d3f5dc6622 --- /dev/null +++ b/src/lib/elementary/efl_ui_grid_view.eo @@ -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_items_get. + ]] + data: null; + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 0bc0347d6a..2018aa78a1 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -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 |