forked from enlightenment/efl
elementary: add internal Efl_Ui_Model_Size.
This model enable View that require to compute the size of their items to rely on an interface to provide the properties they need to get the object size. This is the base class for all the sizing logic of the new List/Grid View. Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7658
This commit is contained in:
parent
1dadeac05e
commit
0d5d832b87
|
@ -176,6 +176,7 @@ elm_private_eolian_files = \
|
|||
lib/elementary/efl_datetime_manager.eo \
|
||||
lib/elementary/efl_ui_list_view_relayout.eo \
|
||||
lib/elementary/efl_ui_list_view_precise_layouter.eo \
|
||||
lib/elementary/efl_ui_model_size.eo \
|
||||
$(NULL)
|
||||
|
||||
# Legacy classes - not part of public EO API
|
||||
|
@ -886,6 +887,7 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/efl_ui_widget_focus_manager.c \
|
||||
lib/elementary/efl_ui_caching_factory.c \
|
||||
lib/elementary/efl_ui_widget_factory.c \
|
||||
lib/elementary/efl_ui_model_size.c \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
const char *_efl_model_property_itemw = "item.width";
|
||||
const char *_efl_model_property_itemh = "item.height";
|
||||
const char *_efl_model_property_selfw = "self.width";
|
||||
const char *_efl_model_property_selfh = "self.height";
|
||||
const char *_efl_model_property_totalw = "total.width";
|
||||
const char *_efl_model_property_totalh = "total.height";
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_ui_model_size_properties_child(void)
|
||||
{
|
||||
const char *properties[] = {
|
||||
_efl_model_property_itemw, _efl_model_property_itemh, _efl_model_property_selfh, _efl_model_property_selfw
|
||||
};
|
||||
return EINA_C_ARRAY_ITERATOR_NEW(properties);
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_ui_model_size_properties_root(void)
|
||||
{
|
||||
const char *properties[] = {
|
||||
_efl_model_property_itemw, _efl_model_property_itemh
|
||||
};
|
||||
return EINA_C_ARRAY_ITERATOR_NEW(properties);
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_ui_model_size_efl_model_properties_get(const Eo *obj, void *pd EINA_UNUSED)
|
||||
{
|
||||
Eina_Iterator *super;
|
||||
Eina_Iterator *prop;
|
||||
|
||||
super = efl_model_properties_get(efl_super(obj, EFL_UI_MODEL_SIZE_CLASS));
|
||||
if (efl_isa(efl_parent_get(obj), EFL_UI_MODEL_SIZE_CLASS))
|
||||
prop = _efl_ui_model_size_properties_child();
|
||||
else
|
||||
prop = _efl_ui_model_size_properties_root();
|
||||
|
||||
return eina_multi_iterator_new(super, prop);
|
||||
}
|
||||
|
||||
#include "efl_ui_model_size.eo.c"
|
|
@ -0,0 +1,19 @@
|
|||
class Efl.Ui.Model_Size extends Efl.Model_Composite
|
||||
{
|
||||
[[Class to be used to store object item size for List/Grid View.
|
||||
|
||||
This model provide the following properties that can be retrived by
|
||||
@Efl.Model.properties.get :
|
||||
- "$self.width" and "$self.height" define the size of this object from the point of
|
||||
view of the @Efl.Ui.View that use it. It only apply on children and not on the
|
||||
top root object.
|
||||
- "$item.width" and "$item.height" define all the children size and is available
|
||||
only on @Efl.Ui.Model_Size that do have children.
|
||||
- "$total.width" and "$total.height" define the accumulated size used by all the children.
|
||||
Only vertical list accumulation logic is implemented at this point.]]
|
||||
|
||||
data: null;
|
||||
implements {
|
||||
Efl.Model.properties { get; }
|
||||
}
|
||||
}
|
|
@ -69,6 +69,14 @@
|
|||
# include "elm_widget_item_static_focus.eo.h"
|
||||
#include "efl_ui_selection_manager.eo.h"
|
||||
# include "efl_datetime_manager.eo.h"
|
||||
# include "efl_ui_model_size.eo.h"
|
||||
|
||||
extern const char *_efl_model_property_itemw;
|
||||
extern const char *_efl_model_property_itemh;
|
||||
extern const char *_efl_model_property_selfw;
|
||||
extern const char *_efl_model_property_selfh;
|
||||
extern const char *_efl_model_property_totalw;
|
||||
extern const char *_efl_model_property_totalh;
|
||||
|
||||
# ifdef HAVE_LANGINFO_H
|
||||
# include <langinfo.h>
|
||||
|
|
|
@ -339,6 +339,7 @@ priv_eo_files = [
|
|||
'efl_datetime_manager.eo',
|
||||
'efl_ui_list_view_precise_layouter.eo',
|
||||
'efl_ui_list_view_relayout.eo',
|
||||
'efl_ui_model_size.eo',
|
||||
]
|
||||
|
||||
priv_eo_file_target = []
|
||||
|
@ -905,7 +906,8 @@ elementary_src = [
|
|||
'efl_ui_tab_page.c',
|
||||
'efl_ui_widget_focus_manager.c',
|
||||
'efl_ui_caching_factory.c',
|
||||
'efl_ui_widget_factory.c'
|
||||
'efl_ui_widget_factory.c',
|
||||
'efl_ui_model_size.c'
|
||||
]
|
||||
|
||||
elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]
|
||||
|
|
Loading…
Reference in New Issue