2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_object_inject(Evas_Object *obj, Evas *e)
|
|
|
|
{
|
|
|
|
Evas_Layer *lay;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-10-26 19:44:36 -07:00
|
|
|
if (obj->in_layer) return;
|
2002-11-08 00:02:15 -08:00
|
|
|
lay = evas_layer_find(e, obj->cur.layer);
|
|
|
|
if (!lay)
|
|
|
|
{
|
|
|
|
lay = evas_layer_new(e);
|
|
|
|
lay->layer = obj->cur.layer;
|
|
|
|
evas_layer_add(lay);
|
|
|
|
}
|
2008-10-17 04:23:18 -07:00
|
|
|
lay->objects = (Evas_Object *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj));
|
2005-11-08 03:59:21 -08:00
|
|
|
lay->usage++;
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->layer = lay;
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->in_layer = 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_object_release(Evas_Object *obj, int clean_layer)
|
|
|
|
{
|
2005-10-26 19:44:36 -07:00
|
|
|
if (!obj->in_layer) return;
|
2008-10-17 04:23:18 -07:00
|
|
|
obj->layer->objects = (Evas_Object *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj));
|
2005-11-08 03:59:21 -08:00
|
|
|
obj->layer->usage--;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (clean_layer)
|
|
|
|
{
|
2005-11-08 03:59:21 -08:00
|
|
|
if (obj->layer->usage <= 0)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
evas_layer_del(obj->layer);
|
|
|
|
evas_layer_free(obj->layer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
obj->layer = NULL;
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->in_layer = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Layer *
|
|
|
|
evas_layer_new(Evas *e)
|
|
|
|
{
|
|
|
|
Evas_Layer *lay;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
lay = calloc(1, sizeof(Evas_Layer));
|
|
|
|
if (!lay) return NULL;
|
|
|
|
lay->evas = e;
|
|
|
|
return lay;
|
|
|
|
}
|
|
|
|
|
2003-01-09 21:38:47 -08:00
|
|
|
void
|
|
|
|
evas_layer_pre_free(Evas_Layer *lay)
|
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Object *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(lay->objects, obj)
|
2003-01-09 21:38:47 -08:00
|
|
|
{
|
2006-10-15 07:39:16 -07:00
|
|
|
if ((!obj->smart.parent) && (!obj->delete_me))
|
|
|
|
evas_object_del(obj);
|
2003-01-09 21:38:47 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
void
|
|
|
|
evas_layer_free(Evas_Layer *lay)
|
|
|
|
{
|
|
|
|
while (lay->objects)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
obj = (Evas_Object *)lay->objects;
|
|
|
|
evas_object_free(obj, 0);
|
|
|
|
}
|
|
|
|
free(lay);
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Layer *
|
2008-04-30 23:18:21 -07:00
|
|
|
evas_layer_find(Evas *e, short layer_num)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Layer *layer;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(e->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
if (layer->layer == layer_num) return layer;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_layer_add(Evas_Layer *lay)
|
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Layer *layer;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(lay->evas->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
if (layer->layer > lay->layer)
|
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
lay->evas->layers = (Evas_Layer *)eina_inlist_prepend_relative(EINA_INLIST_GET(lay->evas->layers),
|
|
|
|
EINA_INLIST_GET(lay),
|
|
|
|
EINA_INLIST_GET(layer));
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-10-17 04:23:18 -07:00
|
|
|
lay->evas->layers = (Evas_Layer *)eina_inlist_append(EINA_INLIST_GET(lay->evas->layers), EINA_INLIST_GET(lay));
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_layer_del(Evas_Layer *lay)
|
|
|
|
{
|
|
|
|
Evas *e;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
e = lay->evas;
|
2008-10-17 04:23:18 -07:00
|
|
|
e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2008-11-01 15:21:10 -07:00
|
|
|
* @addtogroup Evas_Object_Group
|
2008-11-01 14:50:36 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2004-08-23 16:04:34 -07:00
|
|
|
/**
|
|
|
|
* Sets the layer of the evas that the given object will be part of.
|
|
|
|
* @param obj The given evas object.
|
|
|
|
* @param l The number of the layer to place the object on.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2008-04-30 23:18:21 -07:00
|
|
|
evas_object_layer_set(Evas_Object *obj, short l)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas *e;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2002-12-14 16:33:57 -08:00
|
|
|
if (evas_object_intercept_call_layer_set(obj, l)) return;
|
2005-10-26 19:44:36 -07:00
|
|
|
if (obj->smart.parent) return;
|
2005-05-21 19:49:50 -07:00
|
|
|
if (obj->cur.layer == l)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
evas_object_raise(obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
e = obj->layer->evas;
|
|
|
|
evas_object_release(obj, 1);
|
|
|
|
obj->cur.layer = l;
|
|
|
|
evas_object_inject(obj, e);
|
|
|
|
obj->restack = 1;
|
2005-10-27 03:33:47 -07:00
|
|
|
evas_object_change(obj);
|
2002-12-09 22:45:18 -08:00
|
|
|
if (obj->clip.clipees)
|
|
|
|
{
|
|
|
|
evas_object_inform_call_restack(obj);
|
|
|
|
return;
|
|
|
|
}
|
2007-07-09 03:39:49 -07:00
|
|
|
evas_object_change(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!obj->smart.smart)
|
|
|
|
{
|
2005-05-21 19:49:50 -07:00
|
|
|
if (evas_object_is_in_output_rect(obj,
|
|
|
|
obj->layer->evas->pointer.x,
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->layer->evas->pointer.y, 1, 1) &&
|
|
|
|
obj->cur.visible)
|
2008-10-21 09:31:05 -07:00
|
|
|
if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj))
|
2005-07-25 02:55:47 -07:00
|
|
|
evas_event_feed_mouse_move(obj->layer->evas,
|
|
|
|
obj->layer->evas->pointer.x,
|
|
|
|
obj->layer->evas->pointer.y,
|
|
|
|
obj->layer->evas->last_timestamp,
|
|
|
|
NULL);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2002-12-09 22:45:18 -08:00
|
|
|
evas_object_inform_call_restack(obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-23 16:04:34 -07:00
|
|
|
* Retrieves the layer of the evas that the given object is part of.
|
|
|
|
* @param obj The given evas object.
|
|
|
|
* @return Number of the layer.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2008-04-30 23:18:21 -07:00
|
|
|
EAPI short
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_layer_get(const Evas_Object *obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2007-12-12 15:52:18 -08:00
|
|
|
if (obj->smart.parent)
|
|
|
|
{
|
|
|
|
return obj->smart.parent->cur.layer;
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
return obj->cur.layer;
|
|
|
|
}
|
2008-11-01 14:50:36 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|