summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-17 11:11:00 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-17 11:11:00 -0300
commitda6f25bee077c4caae44115ef98ee074015cb372 (patch)
tree5f616b7d258b7a2e33f439b64bfa49693ca65351 /src
parentf247a55b5052cb73f365e18f08128b64b2b9d524 (diff)
csharp: Add Efl.Model implementations to internal model
Summary: CollectionView tries to access some properties from the base model so we need to provide some implementation of the property getter/setter. Reviewers: SanghyeonLee, cedric, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10300
Diffstat (limited to 'src')
-rw-r--r--src/lib/efl_mono/efl_mono_model_internal.c53
-rw-r--r--src/lib/efl_mono/efl_mono_model_internal.eo1
2 files changed, 35 insertions, 19 deletions
diff --git a/src/lib/efl_mono/efl_mono_model_internal.c b/src/lib/efl_mono/efl_mono_model_internal.c
index cda6d66..1d4f79b 100644
--- a/src/lib/efl_mono/efl_mono_model_internal.c
+++ b/src/lib/efl_mono/efl_mono_model_internal.c
@@ -101,11 +101,12 @@ _efl_mono_model_internal_add_property(Eo *obj EINA_UNUSED, Efl_Mono_Model_Intern
101 eina_array_push (pd->properties_names, eina_stringshare_add(info->name)); 101 eina_array_push (pd->properties_names, eina_stringshare_add(info->name));
102} 102}
103 103
104static const char* _efl_mono_model_properties_names[] = { };
104 105
105static Eina_Iterator * 106static Eina_Iterator *
106_efl_mono_model_internal_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED) 107_efl_mono_model_internal_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED)
107{ 108{
108 return eina_array_iterator_new (NULL); 109 return EINA_C_ARRAY_ITERATOR_NEW(_efl_mono_model_properties_names);
109} 110}
110 111
111static Efl_Object* 112static Efl_Object*
@@ -130,6 +131,38 @@ _efl_mono_model_internal_efl_model_children_count_get(const Eo *obj EINA_UNUSED,
130} 131}
131 132
132static Eina_Future * 133static Eina_Future *
134_efl_mono_model_internal_efl_model_children_slice_get(Eo *obj, Efl_Mono_Model_Internal_Data *pd, unsigned int start, unsigned int count EINA_UNUSED)
135{
136 unsigned int i;
137 Eina_Value array = EINA_VALUE_EMPTY;
138 Efl_Mono_Model_Internal_Child_Data* pcd;
139
140 eina_value_array_setup(&array, EINA_VALUE_TYPE_OBJECT, count % 8);
141
142 for (i = start; i != start + count; ++i)
143 {
144 pcd = eina_array_data_get(pd->items, i);
145 eina_value_array_append (&array, pcd->child);
146 }
147
148 return efl_loop_future_resolved(obj, array);
149}
150
151static Eina_Future *
152_efl_mono_model_internal_efl_model_property_set(Eo *obj, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED, const char *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
153{
154 return efl_loop_future_rejected(obj, ENOSYS);
155}
156
157static Eina_Value *
158_efl_mono_model_internal_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED, const char *property EINA_UNUSED)
159{
160 return eina_value_error_new(ENOSYS);
161}
162
163/// Model_Internal_Child implementations
164
165static Eina_Future *
133_efl_mono_model_internal_child_efl_model_property_set(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd, const char *property, Eina_Value *value) 166_efl_mono_model_internal_child_efl_model_property_set(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd, const char *property, Eina_Value *value)
134{ 167{
135 int i = _find_property_index (property, pd->model_pd->properties_names); 168 int i = _find_property_index (property, pd->model_pd->properties_names);
@@ -180,24 +213,6 @@ _efl_mono_model_internal_child_efl_model_property_get(const Eo *obj EINA_UNUSED,
180 } 213 }
181} 214}
182 215
183static Eina_Future *
184_efl_mono_model_internal_efl_model_children_slice_get(Eo *obj, Efl_Mono_Model_Internal_Data *pd, unsigned int start, unsigned int count EINA_UNUSED)
185{
186 unsigned int i;
187 Eina_Value array = EINA_VALUE_EMPTY;
188 Efl_Mono_Model_Internal_Child_Data* pcd;
189
190 eina_value_array_setup(&array, EINA_VALUE_TYPE_OBJECT, count % 8);
191
192 for (i = start; i != start + count; ++i)
193 {
194 pcd = eina_array_data_get(pd->items, i);
195 eina_value_array_append (&array, pcd->child);
196 }
197
198 return efl_loop_future_resolved(obj, array);
199}
200
201static Eo * 216static Eo *
202_efl_mono_model_internal_child_efl_object_constructor(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd EINA_UNUSED) 217_efl_mono_model_internal_child_efl_object_constructor(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd EINA_UNUSED)
203{ 218{
diff --git a/src/lib/efl_mono/efl_mono_model_internal.eo b/src/lib/efl_mono/efl_mono_model_internal.eo
index 71b3313..a146ef7 100644
--- a/src/lib/efl_mono/efl_mono_model_internal.eo
+++ b/src/lib/efl_mono/efl_mono_model_internal.eo
@@ -23,5 +23,6 @@ class @beta Efl.Mono_Model_Internal extends Efl.Loop_Consumer implements Efl.Mod
23 Efl.Model.child_add; 23 Efl.Model.child_add;
24 Efl.Model.children_count { get; } 24 Efl.Model.children_count { get; }
25 Efl.Model.children_slice_get; 25 Efl.Model.children_slice_get;
26 Efl.Model.property { get; set; }
26 } 27 }
27} 28}