ecore: add a class to factorize efl.model.composite.
This commit is contained in:
parent
8f00bf5681
commit
0ce9fc5db0
|
@ -39,7 +39,8 @@ ecore_eolian_files_public = \
|
|||
lib/ecore/efl_interpolator_divisor.eo \
|
||||
lib/ecore/efl_interpolator_bounce.eo \
|
||||
lib/ecore/efl_interpolator_spring.eo \
|
||||
lib/ecore/efl_interpolator_cubic_bezier.eo
|
||||
lib/ecore/efl_interpolator_cubic_bezier.eo \
|
||||
lib/ecore/efl_model_composite.eo
|
||||
|
||||
ecore_eolian_files = \
|
||||
$(ecore_eolian_files_public) \
|
||||
|
@ -123,6 +124,7 @@ lib/ecore/efl_model_item.c \
|
|||
lib/ecore/efl_model_container.c \
|
||||
lib/ecore/efl_model_container_item.c \
|
||||
lib/ecore/efl_model_container_private.h \
|
||||
lib/ecore/efl_model_composite.c \
|
||||
lib/ecore/efl_model_composite_boolean.c \
|
||||
lib/ecore/efl_model_composite_selection.c \
|
||||
lib/ecore/efl_model_accessor_view.c \
|
||||
|
|
|
@ -175,6 +175,7 @@ EAPI Efl_Future *efl_future_iterator_race(Eina_Iterator *it);
|
|||
#include "efl_model_item.eo.h"
|
||||
#include "efl_model_container.eo.h"
|
||||
#include "efl_model_container_item.eo.h"
|
||||
#include "efl_model_composite.eo.h"
|
||||
#include "efl_model_composite_boolean.eo.h"
|
||||
#include "efl_model_composite_boolean_children.eo.h"
|
||||
#include "efl_model_composite_selection.eo.h"
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Efl.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "ecore_private.h"
|
||||
|
||||
#include "efl_model_composite.eo.h"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Data Efl_Model_Composite_Data;
|
||||
|
||||
struct _Efl_Model_Composite_Data
|
||||
{
|
||||
Efl_Model *source;
|
||||
};
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_object_destructor(Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
efl_unref(pd->source);
|
||||
pd->source = NULL;
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_COMPOSITE_CLASS));
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_efl_object_finalize(Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
if (pd->source == NULL)
|
||||
{
|
||||
ERR("Source of the composite model wasn't defined at construction time.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd, Efl_Model *model)
|
||||
{
|
||||
if (pd->source != NULL)
|
||||
{
|
||||
ERR("Source already set for composite model. It can only be set once.");
|
||||
return ;
|
||||
}
|
||||
pd->source = efl_ref(model);
|
||||
}
|
||||
|
||||
static Efl_Model *
|
||||
_efl_model_composite_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return pd->source;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_efl_model_property_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
return efl_model_property_set(pd->source, property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
return efl_model_property_get(pd->source, property);
|
||||
}
|
||||
|
||||
static Eina_Array *
|
||||
_efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return efl_model_properties_get(pd->source);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_composite_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return efl_model_children_count_get(pd->source);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd,
|
||||
unsigned int start,
|
||||
unsigned int count)
|
||||
{
|
||||
return efl_model_children_slice_get(pd->source, start, count);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return efl_model_child_add(pd->source);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd,
|
||||
Efl_Object *child)
|
||||
{
|
||||
efl_model_child_del(pd->source, child);
|
||||
}
|
||||
|
||||
#include "efl_model_composite.eo.c"
|
|
@ -0,0 +1,15 @@
|
|||
class Efl.Model_Composite (Efl.Loop_Consumer, Efl.Model, Efl.Ui.View)
|
||||
{
|
||||
[[Efl model for all composite class which provide a unified API to set source of data]]
|
||||
implements {
|
||||
Efl.Object.destructor;
|
||||
Efl.Object.finalize;
|
||||
Efl.Ui.View.model { set; get; }
|
||||
Efl.Model.property { set; get; }
|
||||
Efl.Model.properties { get; }
|
||||
Efl.Model.children_count { get; }
|
||||
Efl.Model.children_slice_get;
|
||||
Efl.Model.child_add;
|
||||
Efl.Model.child_del;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue