summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/canvas/evas_layer.c
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2012-10-09 01:58:41 +0000
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2012-10-09 01:58:41 +0000
commita01418aff884f9d6f3d68e4fcee1414e736a7313 (patch)
tree89d28034bc658515e91e8b49c76f2351193e0bb2 /legacy/evas/src/lib/canvas/evas_layer.c
parent9ac7594b3a6d33bcf6125230dfb43a68af68ed0d (diff)
eo: changes made for the support of the Eo concept
Signed-off-by: Daniel Zaoui <daniel.zaoui@samsung.com> SVN revision: 77604
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_layer.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_layer.c114
1 files changed, 70 insertions, 44 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_layer.c b/legacy/evas/src/lib/canvas/evas_layer.c
index 7b89069..fa86aa9 100644
--- a/legacy/evas/src/lib/canvas/evas_layer.c
+++ b/legacy/evas/src/lib/canvas/evas_layer.c
@@ -4,7 +4,7 @@
4static void _evas_layer_free(Evas_Layer *lay); 4static void _evas_layer_free(Evas_Layer *lay);
5 5
6void 6void
7evas_object_inject(Evas_Object *obj, Evas *e) 7evas_object_inject(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas *e)
8{ 8{
9 Evas_Layer *lay; 9 Evas_Layer *lay;
10 10
@@ -16,17 +16,17 @@ evas_object_inject(Evas_Object *obj, Evas *e)
16 lay->layer = obj->cur.layer; 16 lay->layer = obj->cur.layer;
17 evas_layer_add(lay); 17 evas_layer_add(lay);
18 } 18 }
19 lay->objects = (Evas_Object *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj)); 19 lay->objects = (Evas_Object_Protected_Data *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj));
20 lay->usage++; 20 lay->usage++;
21 obj->layer = lay; 21 obj->layer = lay;
22 obj->in_layer = 1; 22 obj->in_layer = 1;
23} 23}
24 24
25void 25void
26evas_object_release(Evas_Object *obj, int clean_layer) 26evas_object_release(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, int clean_layer)
27{ 27{
28 if (!obj->in_layer) return; 28 if (!obj->in_layer) return;
29 obj->layer->objects = (Evas_Object *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj)); 29 obj->layer->objects = (Evas_Object_Protected_Data *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj));
30 obj->layer->usage--; 30 obj->layer->usage--;
31 if (clean_layer) 31 if (clean_layer)
32 { 32 {
@@ -41,8 +41,9 @@ evas_object_release(Evas_Object *obj, int clean_layer)
41} 41}
42 42
43Evas_Layer * 43Evas_Layer *
44evas_layer_new(Evas *e) 44evas_layer_new(Evas *eo_e)
45{ 45{
46 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
46 Evas_Layer *lay; 47 Evas_Layer *lay;
47 48
48 lay = calloc(1, sizeof(Evas_Layer)); 49 lay = calloc(1, sizeof(Evas_Layer));
@@ -60,12 +61,12 @@ _evas_layer_free(Evas_Layer *lay)
60void 61void
61evas_layer_pre_free(Evas_Layer *lay) 62evas_layer_pre_free(Evas_Layer *lay)
62{ 63{
63 Evas_Object *obj; 64 Evas_Object_Protected_Data *obj;
64 65
65 EINA_INLIST_FOREACH(lay->objects, obj) 66 EINA_INLIST_FOREACH(lay->objects, obj)
66 { 67 {
67 if ((!obj->smart.parent) && (!obj->delete_me)) 68 if ((!obj->smart.parent) && (!obj->delete_me))
68 evas_object_del(obj); 69 evas_object_del(obj->object);
69 } 70 }
70} 71}
71 72
@@ -74,16 +75,17 @@ evas_layer_free_objects(Evas_Layer *lay)
74{ 75{
75 while (lay->objects) 76 while (lay->objects)
76 { 77 {
77 Evas_Object *obj; 78 Evas_Object_Protected_Data *obj;
78 79
79 obj = (Evas_Object *)lay->objects; 80 obj = (Evas_Object_Protected_Data *)lay->objects;
80 evas_object_free(obj, 0); 81 evas_object_free(obj->object, 0);
81 } 82 }
82} 83}
83 84
84void 85void
85evas_layer_clean(Evas *e) 86evas_layer_clean(Evas *eo_e)
86{ 87{
88 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
87 Evas_Layer *tmp; 89 Evas_Layer *tmp;
88 90
89 while (e->layers) 91 while (e->layers)
@@ -95,8 +97,9 @@ evas_layer_clean(Evas *e)
95} 97}
96 98
97Evas_Layer * 99Evas_Layer *
98evas_layer_find(Evas *e, short layer_num) 100evas_layer_find(Evas *eo_e, short layer_num)
99{ 101{
102 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
100 Evas_Layer *layer; 103 Evas_Layer *layer;
101 104
102 EINA_INLIST_FOREACH(e->layers, layer) 105 EINA_INLIST_FOREACH(e->layers, layer)
@@ -127,30 +130,33 @@ evas_layer_add(Evas_Layer *lay)
127void 130void
128evas_layer_del(Evas_Layer *lay) 131evas_layer_del(Evas_Layer *lay)
129{ 132{
130 Evas *e; 133 Evas_Public_Data *e;
131 134
132 e = lay->evas; 135 e = lay->evas;
133 e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay)); 136 e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
134} 137}
135 138
136static void 139static void
137_evas_object_layer_set_child(Evas_Object *obj, Evas_Object *par, short l) 140_evas_object_layer_set_child(Evas_Object *eo_obj, Evas_Object *par, short l)
138{ 141{
142 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
143 Evas_Object_Protected_Data *par_obj = eo_data_get(par, EVAS_OBJ_CLASS);
144
139 if (obj->delete_me) return; 145 if (obj->delete_me) return;
140 if (obj->cur.layer == l) return; 146 if (obj->cur.layer == l) return;
141 evas_object_release(obj, 1); 147 evas_object_release(eo_obj, obj, 1);
142 obj->cur.layer = l; 148 obj->cur.layer = l;
143 obj->layer = par->layer; 149 obj->layer = par_obj->layer;
144 obj->layer->usage++; 150 obj->layer->usage++;
145 if (obj->smart.smart) 151 if (obj->is_smart)
146 { 152 {
147 Eina_Inlist *contained; 153 Eina_Inlist *contained;
148 Evas_Object *member; 154 Evas_Object_Protected_Data *member;
149 155
150 contained = (Eina_Inlist *)evas_object_smart_members_get_direct(obj); 156 contained = (Eina_Inlist *)evas_object_smart_members_get_direct(eo_obj);
151 EINA_INLIST_FOREACH(contained, member) 157 EINA_INLIST_FOREACH(contained, member)
152 { 158 {
153 _evas_object_layer_set_child(member, obj, l); 159 _evas_object_layer_set_child(member->object, eo_obj, l);
154 } 160 }
155 } 161 }
156} 162}
@@ -158,41 +164,50 @@ _evas_object_layer_set_child(Evas_Object *obj, Evas_Object *par, short l)
158/* public functions */ 164/* public functions */
159 165
160EAPI void 166EAPI void
161evas_object_layer_set(Evas_Object *obj, short l) 167evas_object_layer_set(Evas_Object *eo_obj, short l)
162{ 168{
163 Evas *e; 169 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
164
165 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
166 return; 170 return;
167 MAGIC_CHECK_END(); 171 MAGIC_CHECK_END();
172 eo_do(eo_obj, evas_obj_layer_set(l));
173}
174
175void
176_layer_set(Eo *eo_obj, void *_obj, va_list *list)
177{
178 short l = va_arg(*list, int);
179
180 Evas *eo_e;
181 Evas_Object_Protected_Data *obj = _obj;
182
168 if (obj->delete_me) return; 183 if (obj->delete_me) return;
169 if (evas_object_intercept_call_layer_set(obj, l)) return; 184 if (evas_object_intercept_call_layer_set(eo_obj, l)) return;
170 if (obj->smart.parent) return; 185 if (obj->smart.parent) return;
171 if (obj->cur.layer == l) 186 if (obj->cur.layer == l)
172 { 187 {
173 evas_object_raise(obj); 188 evas_object_raise(eo_obj);
174 return; 189 return;
175 } 190 }
176 e = obj->layer->evas; 191 eo_e = obj->layer->evas->evas;
177 evas_object_release(obj, 1); 192 evas_object_release(eo_obj, obj, 1);
178 obj->cur.layer = l; 193 obj->cur.layer = l;
179 evas_object_inject(obj, e); 194 evas_object_inject(eo_obj, obj, eo_e);
180 obj->restack = 1; 195 obj->restack = 1;
181 evas_object_change(obj); 196 evas_object_change(eo_obj, obj);
182 if (obj->clip.clipees) 197 if (obj->clip.clipees)
183 { 198 {
184 evas_object_inform_call_restack(obj); 199 evas_object_inform_call_restack(eo_obj);
185 return; 200 return;
186 } 201 }
187 evas_object_change(obj); 202 evas_object_change(eo_obj, obj);
188 if (!obj->smart.smart) 203 if (!obj->is_smart)
189 { 204 {
190 if (evas_object_is_in_output_rect(obj, 205 if (evas_object_is_in_output_rect(eo_obj, obj,
191 obj->layer->evas->pointer.x, 206 obj->layer->evas->pointer.x,
192 obj->layer->evas->pointer.y, 1, 1) && 207 obj->layer->evas->pointer.y, 1, 1) &&
193 obj->cur.visible) 208 obj->cur.visible)
194 if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj)) 209 if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj))
195 evas_event_feed_mouse_move(obj->layer->evas, 210 evas_event_feed_mouse_move(obj->layer->evas->evas,
196 obj->layer->evas->pointer.x, 211 obj->layer->evas->pointer.x,
197 obj->layer->evas->pointer.y, 212 obj->layer->evas->pointer.y,
198 obj->layer->evas->last_timestamp, 213 obj->layer->evas->last_timestamp,
@@ -201,26 +216,37 @@ evas_object_layer_set(Evas_Object *obj, short l)
201 else 216 else
202 { 217 {
203 Eina_Inlist *contained; 218 Eina_Inlist *contained;
204 Evas_Object *member; 219 Evas_Object_Protected_Data *member;
205 220
206 contained = (Eina_Inlist *)evas_object_smart_members_get_direct(obj); 221 contained = (Eina_Inlist *)evas_object_smart_members_get_direct(eo_obj);
207 EINA_INLIST_FOREACH(contained, member) 222 EINA_INLIST_FOREACH(contained, member)
208 { 223 {
209 _evas_object_layer_set_child(member, obj, l); 224 _evas_object_layer_set_child(member->object, eo_obj, l);
210 } 225 }
211 } 226 }
212 evas_object_inform_call_restack(obj); 227 evas_object_inform_call_restack(eo_obj);
213} 228}
214 229
215EAPI short 230EAPI short
216evas_object_layer_get(const Evas_Object *obj) 231evas_object_layer_get(const Evas_Object *eo_obj)
217{ 232{
218 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); 233 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
219 return 0; 234 return 0;
220 MAGIC_CHECK_END(); 235 MAGIC_CHECK_END();
236 short layer = 0;
237 eo_do((Eo *)eo_obj, evas_obj_layer_get(&layer));
238 return layer;
239}
240
241void
242_layer_get(Eo *eo_obj EINA_UNUSED, void *_obj, va_list *list)
243{
244 short *layer = va_arg(*list, short *);
245 const Evas_Object_Protected_Data *obj = _obj;
221 if (obj->smart.parent) 246 if (obj->smart.parent)
222 { 247 {
223 return obj->smart.parent->cur.layer; 248 Evas_Object_Protected_Data *smart_parent_obj = eo_data_get(obj->smart.parent, EVAS_OBJ_CLASS);
249 *layer = smart_parent_obj->cur.layer;
224 } 250 }
225 return obj->cur.layer; 251 *layer = obj->cur.layer;
226} 252}