1 #include "evas_common.h"
2 #include "evas_private.h"
5 evas_object_above_get_internal(const Evas_Object *obj)
7 if (((Evas_Object_List *)obj)->next)
8 return (Evas_Object *)(((Evas_Object_List *)obj)->next);
11 if (((Evas_Object_List *)(((Evas_Object *)obj)->layer))->next)
15 l = (Evas_Layer *)(((Evas_Object_List *)(((Evas_Object *)obj)->layer))->next);
23 evas_object_below_get_internal(const Evas_Object *obj)
25 if (((Evas_Object_List *)obj)->prev)
26 return (Evas_Object *)(((Evas_Object_List *)obj)->prev);
29 if (((Evas_Object_List *)(((Evas_Object *)obj)->layer))->prev)
33 l = (Evas_Layer *)(((Evas_Object_List *)(((Evas_Object *)obj)->layer))->prev);
34 return (Evas_Object *)(((Evas_Object_List *)(l->objects))->last);
41 * Raise @p obj to the top of its layer.
43 * @param obj the object to raise
47 evas_object_raise(Evas_Object *obj)
49 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
52 if (evas_object_intercept_call_raise(obj)) return;
53 if (!(((Evas_Object_List *)obj)->next))
55 evas_object_inform_call_restack(obj);
58 if (obj->smart.parent)
59 evas_object_smart_member_raise(obj);
64 obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj);
65 obj->layer->objects = evas_object_list_append(obj->layer->objects, obj);
68 if (obj->clip.clipees)
70 evas_object_inform_call_restack(obj);
73 if (obj->layer) evas_render_invalidate(obj->layer->evas);
75 evas_object_change(obj);
76 evas_object_inform_call_restack(obj);
77 if (obj->layer->evas->events_frozen <= 0)
79 if (!evas_event_passes_through(obj))
81 if (!obj->smart.smart)
83 if (evas_object_is_in_output_rect(obj,
84 obj->layer->evas->pointer.x,
85 obj->layer->evas->pointer.y, 1, 1) &&
87 evas_event_feed_mouse_move(obj->layer->evas,
88 obj->layer->evas->pointer.x,
89 obj->layer->evas->pointer.y,
90 obj->layer->evas->last_timestamp,
98 * Lower @p obj to the bottom of its layer.
100 * @param obj the object to lower
104 evas_object_lower(Evas_Object *obj)
106 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
109 if (evas_object_intercept_call_lower(obj)) return;
110 if (!(((Evas_Object_List *)obj)->prev))
112 evas_object_inform_call_restack(obj);
115 if (obj->smart.parent)
116 evas_object_smart_member_lower(obj);
121 obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj);
122 obj->layer->objects = evas_object_list_prepend(obj->layer->objects, obj);
125 if (obj->clip.clipees)
127 evas_object_inform_call_restack(obj);
130 if (obj->layer) evas_render_invalidate(obj->layer->evas);
132 evas_object_change(obj);
133 evas_object_inform_call_restack(obj);
134 if (obj->layer->evas->events_frozen <= 0)
136 if (!evas_event_passes_through(obj))
138 if (!obj->smart.smart)
140 if (evas_object_is_in_output_rect(obj,
141 obj->layer->evas->pointer.x,
142 obj->layer->evas->pointer.y, 1, 1) &&
144 evas_event_feed_mouse_move(obj->layer->evas,
145 obj->layer->evas->pointer.x,
146 obj->layer->evas->pointer.y,
147 obj->layer->evas->last_timestamp,
155 * Stack @p obj immediately above @p above
157 * If @p obj is a member of a smart object, then @p above must also be
158 * a member of the same smart object.
160 * Similarly, if @p obj is not a member of smart object, @p above may
163 * @param obj the object to stack
164 * @param above the object above which to stack
168 evas_object_stack_above(Evas_Object *obj, Evas_Object *above)
170 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
173 MAGIC_CHECK(above, Evas_Object, MAGIC_OBJ);
176 if (evas_object_intercept_call_stack_above(obj, above)) return;
179 evas_object_raise(obj);
182 if (((Evas_Object_List *)obj)->prev == (Evas_Object_List *)above)
184 evas_object_inform_call_restack(obj);
187 if (obj->smart.parent)
189 if (obj->smart.parent != above->smart.parent)
191 // printf("BITCH! evas_object_stack_above(), %p not inside same smart as %p!\n", obj, above);
194 evas_object_smart_member_stack_above(obj, above);
198 if (above->smart.parent) return;
199 if (obj->layer != above->layer)
205 obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj);
206 obj->layer->objects = evas_object_list_append_relative(obj->layer->objects, obj, above);
209 if (obj->clip.clipees)
211 evas_object_inform_call_restack(obj);
214 if (obj->layer) evas_render_invalidate(obj->layer->evas);
216 evas_object_change(obj);
217 evas_object_inform_call_restack(obj);
218 if (obj->layer->evas->events_frozen <= 0)
220 if (!evas_event_passes_through(obj))
222 if (!obj->smart.smart)
224 if (evas_object_is_in_output_rect(obj,
225 obj->layer->evas->pointer.x,
226 obj->layer->evas->pointer.y, 1, 1) &&
228 evas_event_feed_mouse_move(obj->layer->evas,
229 obj->layer->evas->pointer.x,
230 obj->layer->evas->pointer.y,
231 obj->layer->evas->last_timestamp,
239 * Stack @p obj immediately below @p below
241 * If @p obj is a member of a smart object, then @p below must also be
242 * a member of the same smart object.
244 * Similarly, if @p obj is not a member of smart object, @p below may
247 * @param obj the object to stack
248 * @param below the object below which to stack
252 evas_object_stack_below(Evas_Object *obj, Evas_Object *below)
254 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
257 MAGIC_CHECK(below, Evas_Object, MAGIC_OBJ);
260 if (evas_object_intercept_call_stack_below(obj, below)) return;
263 evas_object_lower(obj);
266 if (((Evas_Object_List *)obj)->next == (Evas_Object_List *)below)
268 evas_object_inform_call_restack(obj);
271 if (obj->smart.parent)
273 if (obj->smart.parent != below->smart.parent)
275 // printf("BITCH! evas_object_stack_below(), %p not inside same smart as %p!\n", obj, below);
278 evas_object_smart_member_stack_below(obj, below);
282 if (below->smart.parent) return;
283 if (obj->layer != below->layer)
289 obj->layer->objects = evas_object_list_remove(obj->layer->objects, obj);
290 obj->layer->objects = evas_object_list_prepend_relative(obj->layer->objects, obj, below);
293 if (obj->clip.clipees)
295 evas_object_inform_call_restack(obj);
298 if (obj->layer) evas_render_invalidate(obj->layer->evas);
300 evas_object_change(obj);
301 evas_object_inform_call_restack(obj);
302 if (obj->layer->evas->events_frozen <= 0)
304 if (!evas_event_passes_through(obj))
306 if (!obj->smart.smart)
308 if (evas_object_is_in_output_rect(obj,
309 obj->layer->evas->pointer.x,
310 obj->layer->evas->pointer.y, 1, 1) &&
312 evas_event_feed_mouse_move(obj->layer->evas,
313 obj->layer->evas->pointer.x,
314 obj->layer->evas->pointer.y,
315 obj->layer->evas->last_timestamp,
323 * Get the evas object above @p obj
325 * @param obj an Evas_Object
326 * @return the Evas_Object directly above
330 evas_object_above_get(const Evas_Object *obj)
332 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
335 if (obj->smart.parent)
339 obj = (Evas_Object *)(((Evas_Object_List *)(obj))->next);
340 if ((obj) && (!obj->delete_me)) return (Evas_Object *)obj;
345 obj = evas_object_above_get_internal(obj);
348 if (!obj->delete_me) return (Evas_Object *)obj;
349 obj = evas_object_above_get_internal(obj);
355 * Get the evas object below @p obj
357 * @param obj an Evas_Object
358 * @return the Evas_Object directly below
362 evas_object_below_get(const Evas_Object *obj)
364 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
367 if (obj->smart.parent)
371 obj = (Evas_Object *)(((Evas_Object_List *)(obj))->prev);
372 if ((obj) && (!obj->delete_me)) return (Evas_Object *)obj;
377 obj = evas_object_below_get_internal(obj);
380 if (!obj->delete_me) return (Evas_Object *)obj;
381 obj = evas_object_below_get_internal(obj);
387 * Get the lowest evas object on the Evas @p e
390 * @return the lowest object
394 evas_object_bottom_get(const Evas *e)
396 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
403 obj = e->layers->objects;
406 if (!obj->delete_me) return obj;
407 obj = evas_object_above_get_internal(obj);
414 * Get the highest evas object on the Evas @p e
417 * @return the highest object
421 evas_object_top_get(const Evas *e)
423 Evas_Object *obj = NULL;
424 Evas_Object_List *list;
427 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
431 list = (Evas_Object_List *) e->layers;
432 if (!list) return NULL;
434 layer = (Evas_Layer *) list->last;
435 if (!layer) return NULL;
437 list = (Evas_Object_List *) layer->objects;
438 if (!list) return NULL;
440 obj = (Evas_Object *) list->last;
441 if (!obj) return NULL;
445 if (!obj->delete_me) return obj;
446 obj = evas_object_below_get_internal(obj);