summaryrefslogtreecommitdiff
path: root/src/lib/ecore/ecore_internal.h
diff options
context:
space:
mode:
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>2019-09-04 11:07:37 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-04 11:07:37 -0400
commit4e379f5db4861301b77bf945f7365cb0faa04feb (patch)
tree50a12adf37d0b44eaf253a9dac24e2e1a8c82e75 /src/lib/ecore/ecore_internal.h
parent8b49bdb830b8c7b921712ed467f89aa8d6e6ca3f (diff)
Efl_Ui: Move elementary and change namespace Ui for ui related models
Summary: Select and View is ui characteristic features, so Efl_Select_Model and Efl_View_Model move to elementary from ecore seems more natural. namespace also should changed to Efl.Ui as it's right place. Test Plan: run the test while building it Reviewers: cedric, felipealmeida, bu5hm4n, zmike, lauromoura Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9820
Diffstat (limited to 'src/lib/ecore/ecore_internal.h')
-rw-r--r--src/lib/ecore/ecore_internal.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/lib/ecore/ecore_internal.h b/src/lib/ecore/ecore_internal.h
index 8a54487aba..32a9472188 100644
--- a/src/lib/ecore/ecore_internal.h
+++ b/src/lib/ecore/ecore_internal.h
@@ -59,6 +59,76 @@ efl_model_list_value_get(Eina_List *childrens,
59 return v; 59 return v;
60} 60}
61 61
62#define EFL_COMPOSITE_MODEL_CHILD_INDEX "child.index"
63
64#define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \
65 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
66
67#define EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
68 Eina_Iterator *name; \
69 do \
70 { \
71 static const char *static_props__[] = { \
72 __VA_ARGS__ \
73 }; \
74 name = _efl_composite_model_properties_mix( \
75 ((obj) ? efl_model_properties_get(efl_super((obj), (klass))) : NULL), \
76 (dyn), \
77 EINA_C_ARRAY_ITERATOR_NEW(static_props__)); \
78 } \
79 while (0)
80
81
82static inline Eina_Iterator *
83_efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
84{
85 Eina_Iterator *its[3];
86 int i = 0;
87
88 if (sta) its[i++] = sta;
89 if (dyn) its[i++] = dyn;
90 if (super) its[i++] = super;
91
92 switch (i)
93 {
94 case 1: return its[0];
95 case 2: return eina_multi_iterator_new(its[0], its[1]);
96 case 3: return eina_multi_iterator_new(its[0], its[1], its[2]);
97 default: return NULL;
98 };
99}
100
101#define EFL_COMPOSITE_LOOKUP_RETURN(Remember, Parent, View, Base) \
102 Efl_Model *Remember; \
103 char buf[1024]; \
104 \
105 snprintf(buf, sizeof (buf), Base"-%p", Parent); \
106 Remember = efl_key_wref_get(View, buf); \
107 if (Remember) \
108 { \
109 efl_ref(Remember); \
110 return Remember; \
111 }
112
113#define EFL_COMPOSITE_REMEMBER_RETURN(Remember, View) \
114 efl_key_wref_set(View, buf, Remember); \
115 return Remember;
116
117
118static inline Efl_Model *
119_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index)
120{
121 EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model");
122
123 remember = efl_add_ref(self, parent,
124 efl_ui_view_model_set(efl_added, view),
125 efl_composite_model_index_set(efl_added, index),
126 efl_loop_model_volatile_make(efl_added));
127 if (!remember) return NULL;
128
129 EFL_COMPOSITE_REMEMBER_RETURN(remember, view);
130}
131
62#undef EAPI 132#undef EAPI
63#define EAPI 133#define EAPI
64 134