diff options
author | Cedric Bail <cedric@osg.samsung.com> | 2017-10-25 15:13:32 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2018-04-30 14:21:11 -0700 |
commit | 8f00bf568112fdc913099ce5fc67fb4b2324f5d8 (patch) | |
tree | 8181803c29a1cf7e761bd100204b0f1cd9a4ac9f /src/lib/efl/Efl_Model_Common.h | |
parent | 04c63cb489b2dda2f738df2435ef183209d06ead (diff) |
efl: make efl.model use of eina_value and eina_future instead of efl_future.
Diffstat (limited to 'src/lib/efl/Efl_Model_Common.h')
-rw-r--r-- | src/lib/efl/Efl_Model_Common.h | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/lib/efl/Efl_Model_Common.h b/src/lib/efl/Efl_Model_Common.h index 5c565c64ab..b4b5690917 100644 --- a/src/lib/efl/Efl_Model_Common.h +++ b/src/lib/efl/Efl_Model_Common.h | |||
@@ -20,15 +20,11 @@ EAPI extern Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT; /**< @since 1.19 */ | |||
20 | */ | 20 | */ |
21 | struct _Efl_Model_Children_Event | 21 | struct _Efl_Model_Children_Event |
22 | { | 22 | { |
23 | Eo *child; /**< child, for child_add */ | ||
24 | /** | 23 | /** |
25 | * index is a hint and is intended | 24 | * index is a hint and is intended |
26 | * to provide a way for applications | 25 | * to provide a way for applications |
27 | * to control/know children relative | 26 | * to control/know children relative |
28 | * positions through listings. | 27 | * positions through listings. |
29 | * | ||
30 | * NOTE: If listing is performed asynchronously | ||
31 | * exact order may not be guaranteed. | ||
32 | */ | 28 | */ |
33 | unsigned int index; | 29 | unsigned int index; |
34 | }; | 30 | }; |
@@ -42,20 +38,6 @@ typedef struct _Efl_Model_Children_Event Efl_Model_Children_Event; | |||
42 | 38 | ||
43 | EAPI int efl_model_init(void); | 39 | EAPI int efl_model_init(void); |
44 | 40 | ||
45 | /** | ||
46 | * @brief Slices a list | ||
47 | * | ||
48 | * If the @p start and @p count are 0, a new accessor of the entire list is returned | ||
49 | * | ||
50 | * @param list The list to get the slice | ||
51 | * @param start The nth element to start the slice | ||
52 | * @param count The number of elements | ||
53 | * @return The accessor to the sliced elements or @c NULL if error | ||
54 | * | ||
55 | * @since 1.17 | ||
56 | */ | ||
57 | EAPI Eina_Accessor *efl_model_list_slice(Eina_List *list, unsigned start, unsigned count) EINA_ARG_NONNULL(1); | ||
58 | |||
59 | 41 | ||
60 | /** | 42 | /** |
61 | * @brief Notifies a property changed event with an @c EFL_MODEL_EVENT_PROPERTIES_CHANGED | 43 | * @brief Notifies a property changed event with an @c EFL_MODEL_EVENT_PROPERTIES_CHANGED |
@@ -65,7 +47,9 @@ EAPI Eina_Accessor *efl_model_list_slice(Eina_List *list, unsigned start, unsign | |||
65 | * | 47 | * |
66 | * @since 1.17 | 48 | * @since 1.17 |
67 | */ | 49 | */ |
68 | EAPI void efl_model_property_changed_notify(Efl_Model *model, const char *property); | 50 | EAPI void _efl_model_properties_changed_internal(const Efl_Model *model, ...); |
51 | |||
52 | #define efl_model_properties_changed(Model, ...) _efl_model_properties_changed_internal(Model, ##__VA_ARGS__, NULL) | ||
69 | 53 | ||
70 | /** | 54 | /** |
71 | * @brief Notifies a property invalidated event with an @c EFL_MODEL_EVENT_PROPERTIES_CHANGED | 55 | * @brief Notifies a property invalidated event with an @c EFL_MODEL_EVENT_PROPERTIES_CHANGED |
@@ -107,4 +91,34 @@ EAPI Eina_Value_Struct_Desc *efl_model_value_struct_description_new(unsigned int | |||
107 | */ | 91 | */ |
108 | EAPI void efl_model_value_struct_description_free(Eina_Value_Struct_Desc *desc); | 92 | EAPI void efl_model_value_struct_description_free(Eina_Value_Struct_Desc *desc); |
109 | 93 | ||
94 | |||
95 | static inline Eina_Value | ||
96 | efl_model_list_value_get(Eina_List *childrens, | ||
97 | unsigned int start, | ||
98 | unsigned int count) | ||
99 | { | ||
100 | Eina_Value v = EINA_VALUE_EMPTY; | ||
101 | Eina_List *l; | ||
102 | Eo *child; | ||
103 | |||
104 | eina_value_array_setup(&v, EINA_VALUE_TYPE_OBJECT, eina_list_count(childrens)); | ||
105 | |||
106 | EINA_LIST_FOREACH(childrens, l, child) | ||
107 | { | ||
108 | if (start != 0) | ||
109 | { | ||
110 | start--; | ||
111 | continue; | ||
112 | } | ||
113 | if (count == 0) | ||
114 | continue; | ||
115 | count--; | ||
116 | |||
117 | eina_value_array_append(&v, child); | ||
118 | } | ||
119 | |||
120 | return v; | ||
121 | } | ||
122 | |||
123 | |||
110 | #endif | 124 | #endif |