1 #include "evas_common.h"
2 #include "evas_private.h"
5 evas_object_inject(Evas_Object *obj, Evas *e)
9 if (obj->in_layer) return;
10 lay = evas_layer_find(e, obj->cur.layer);
13 lay = evas_layer_new(e);
14 lay->layer = obj->cur.layer;
17 lay->objects = (Evas_Object *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj));
24 evas_object_release(Evas_Object *obj, int clean_layer)
26 if (!obj->in_layer) return;
27 obj->layer->objects = (Evas_Object *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj));
31 if (obj->layer->usage <= 0)
33 evas_layer_del(obj->layer);
34 evas_layer_free(obj->layer);
42 evas_layer_new(Evas *e)
46 lay = calloc(1, sizeof(Evas_Layer));
47 if (!lay) return NULL;
53 evas_layer_pre_free(Evas_Layer *lay)
57 EINA_INLIST_FOREACH(lay->objects, obj)
59 if ((!obj->smart.parent) && (!obj->delete_me))
65 evas_layer_free(Evas_Layer *lay)
71 obj = (Evas_Object *)lay->objects;
72 evas_object_free(obj, 0);
78 evas_layer_find(Evas *e, short layer_num)
82 EINA_INLIST_FOREACH(e->layers, layer)
84 if (layer->layer == layer_num) return layer;
90 evas_layer_add(Evas_Layer *lay)
94 EINA_INLIST_FOREACH(lay->evas->layers, layer)
96 if (layer->layer > lay->layer)
98 lay->evas->layers = (Evas_Layer *)eina_inlist_prepend_relative(EINA_INLIST_GET(lay->evas->layers),
100 EINA_INLIST_GET(layer));
104 lay->evas->layers = (Evas_Layer *)eina_inlist_append(EINA_INLIST_GET(lay->evas->layers), EINA_INLIST_GET(lay));
108 evas_layer_del(Evas_Layer *lay)
113 e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
116 /* public functions */
119 * @defgroup Evas_Object_Layer_Group Object Layer Functions
121 * Functions that retrieve and set the layer that an evas object is on.
123 * @todo Document which way layers go.
127 * Sets the layer of the evas that the given object will be part of.
128 * @param obj The given evas object.
129 * @param l The number of the layer to place the object on.
130 * @ingroup Evas_Object_Layer_Group
133 evas_object_layer_set(Evas_Object *obj, short l)
137 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
140 if (evas_object_intercept_call_layer_set(obj, l)) return;
141 if (obj->smart.parent) return;
142 if (obj->cur.layer == l)
144 evas_object_raise(obj);
147 e = obj->layer->evas;
148 evas_object_release(obj, 1);
150 evas_object_inject(obj, e);
152 evas_object_change(obj);
153 if (obj->clip.clipees)
155 evas_object_inform_call_restack(obj);
158 evas_object_change(obj);
159 if (!obj->smart.smart)
161 if (evas_object_is_in_output_rect(obj,
162 obj->layer->evas->pointer.x,
163 obj->layer->evas->pointer.y, 1, 1) &&
165 if (evas_list_find(obj->layer->evas->pointer.object.in, obj))
166 evas_event_feed_mouse_move(obj->layer->evas,
167 obj->layer->evas->pointer.x,
168 obj->layer->evas->pointer.y,
169 obj->layer->evas->last_timestamp,
172 evas_object_inform_call_restack(obj);
176 * Retrieves the layer of the evas that the given object is part of.
177 * @param obj The given evas object.
178 * @return Number of the layer.
179 * @ingroup Evas_Object_Layer_Group
182 evas_object_layer_get(const Evas_Object *obj)
184 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
187 if (obj->smart.parent)
189 return obj->smart.parent->cur.layer;
191 return obj->cur.layer;