2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
#include "Eo.h"
|
|
|
|
|
|
|
|
EAPI Eo_Op EVAS_OBJ_SMART_BASE_ID = EO_NOOP;
|
|
|
|
|
|
|
|
#define MY_CLASS EVAS_OBJ_SMART_CLASS
|
|
|
|
|
|
|
|
#define MY_CLASS_NAME "Evas_Object_Smart"
|
|
|
|
|
|
|
|
extern Eina_Hash* signals_hash_table;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
typedef struct _Evas_Object_Smart Evas_Object_Smart;
|
|
|
|
typedef struct _Evas_Smart_Callback Evas_Smart_Callback;
|
|
|
|
|
|
|
|
struct _Evas_Object_Smart
|
|
|
|
{
|
|
|
|
void *engine_data;
|
2008-04-30 22:48:03 -07:00
|
|
|
void *data;
|
2008-10-21 09:31:05 -07:00
|
|
|
Eina_List *callbacks;
|
2011-08-29 16:45:24 -07:00
|
|
|
Eina_Inlist *contained;
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Inlist *smart_callbacks_infos;
|
2010-01-11 06:24:41 -08:00
|
|
|
Evas_Smart_Cb_Description_Array callbacks_descriptions;
|
2008-04-30 22:48:03 -07:00
|
|
|
int walking_list;
|
2012-05-06 19:11:35 -07:00
|
|
|
int member_count;
|
2009-06-17 03:01:52 -07:00
|
|
|
Eina_Bool deletions_waiting : 1;
|
|
|
|
Eina_Bool need_recalculate : 1;
|
2012-06-07 00:10:36 -07:00
|
|
|
Eina_Bool update_boundingbox_needed : 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evas_Smart_Callback
|
|
|
|
{
|
2006-05-31 11:33:46 -07:00
|
|
|
const char *event;
|
2011-04-12 02:23:57 -07:00
|
|
|
Evas_Smart_Cb func;
|
2002-11-08 00:02:15 -08:00
|
|
|
void *func_data;
|
2011-08-17 04:55:29 -07:00
|
|
|
Evas_Callback_Priority priority;
|
2007-06-28 16:22:20 -07:00
|
|
|
char delete_me : 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* private methods for smart objects */
|
2012-10-08 18:58:41 -07:00
|
|
|
static void evas_object_smart_callbacks_clear(Evas_Object *eo_obj);
|
|
|
|
static void evas_object_smart_init(Evas_Object *eo_obj);
|
|
|
|
static void evas_object_smart_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *output, void *context, void *surface, int x, int y);
|
|
|
|
static void evas_object_smart_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
|
|
|
static void evas_object_smart_render_post(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
|
|
|
|
|
|
|
static unsigned int evas_object_smart_id_get(Evas_Object *eo_obj);
|
|
|
|
static unsigned int evas_object_smart_visual_id_get(Evas_Object *eo_obj);
|
|
|
|
static void *evas_object_smart_engine_data_get(Evas_Object *eo_obj);
|
2008-08-25 22:45:04 -07:00
|
|
|
|
2007-05-06 04:29:37 -07:00
|
|
|
static const Evas_Object_Func object_func =
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
/* methods (compulsory) */
|
2012-10-08 18:58:41 -07:00
|
|
|
NULL,
|
2011-05-07 01:01:42 -07:00
|
|
|
evas_object_smart_render,
|
|
|
|
evas_object_smart_render_pre,
|
|
|
|
evas_object_smart_render_post,
|
|
|
|
evas_object_smart_id_get,
|
|
|
|
evas_object_smart_visual_id_get,
|
|
|
|
evas_object_smart_engine_data_get,
|
|
|
|
/* these are optional. NULL = nothing */
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
2010-11-26 02:01:18 -08:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
EVAS_MEMPOOL(_mp_cb);
|
2002-11-08 00:02:15 -08:00
|
|
|
/* public funcs */
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_data_set(Evas_Object *eo_obj, void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(eo_obj, evas_obj_smart_data_set(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_data_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
void *data = va_arg(*list, void *);
|
|
|
|
Evas_Object_Smart *o = _pd;
|
2008-04-30 22:48:03 -07:00
|
|
|
o->data = data;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_data_get(const Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
void *data = NULL;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_data_get(&data));
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_data_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
const Evas_Object_Smart *o = _pd;
|
|
|
|
void **data = va_arg(*list, void **);
|
|
|
|
*data = o->data;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:23:03 -07:00
|
|
|
EAPI const void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_interface_get(const Evas_Object *eo_obj,
|
2012-07-04 14:23:03 -07:00
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
Evas_Smart *s;
|
2012-08-06 09:19:25 -07:00
|
|
|
unsigned int i;
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2012-07-04 14:23:03 -07:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!eo_isa(eo_obj, EVAS_OBJ_SMART_CLASS)) return NULL;
|
|
|
|
|
|
|
|
s = evas_object_smart_smart_get(eo_obj);
|
2012-08-06 17:57:09 -07:00
|
|
|
if (!s) return NULL;
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (s)
|
2012-07-04 14:23:03 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
for (i = 0; i < s->interfaces.size; i++)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Interface *iface;
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
iface = s->interfaces.array[i];
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (iface->name == name)
|
|
|
|
return iface;
|
|
|
|
}
|
2012-07-04 14:23:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_interface_data_get(const Evas_Object *eo_obj,
|
2012-07-04 14:23:03 -07:00
|
|
|
const Evas_Smart_Interface *iface)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
Evas_Smart *s;
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2012-07-04 14:23:03 -07:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
s = evas_object_smart_smart_get(eo_obj);
|
2012-08-06 17:57:09 -07:00
|
|
|
if (!s) return NULL;
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (s)
|
2012-07-04 14:23:03 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
for (i = 0; i < s->interfaces.size; i++)
|
|
|
|
{
|
|
|
|
if (iface == s->interfaces.array[i])
|
|
|
|
return obj->interface_privates[i];
|
|
|
|
}
|
2012-07-04 14:23:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Smart *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_smart_get(const Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Smart *smart = NULL;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_smart_get(&smart));
|
|
|
|
return smart;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
_smart_smart_get(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart **smart = va_arg(*list, Evas_Smart **);
|
|
|
|
if (smart) *smart = obj->smart.smart;
|
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_smart_member_add(Evas_Object *eo_obj, Evas_Object *smart_obj)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(smart_obj, evas_obj_smart_member_add(eo_obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_member_add(Eo *smart_obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Object *eo_obj = va_arg(*list, Evas_Object *);
|
|
|
|
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Protected_Data *smart = eo_data_get(smart_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Smart *o = _pd;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2006-07-30 07:30:24 -07:00
|
|
|
if (obj->delete_me)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CRIT("Adding deleted object %p to smart obj %p", eo_obj, smart_obj);
|
2011-05-07 01:01:42 -07:00
|
|
|
abort();
|
|
|
|
return;
|
2006-07-30 07:30:24 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
if (smart->delete_me)
|
2006-07-30 07:30:24 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CRIT("Adding object %p to deleted smart obj %p", eo_obj, smart_obj);
|
2011-05-07 01:01:42 -07:00
|
|
|
abort();
|
|
|
|
return;
|
2006-07-30 07:30:24 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!smart->layer)
|
2009-10-07 05:47:01 -07:00
|
|
|
{
|
2011-05-07 01:01:42 -07:00
|
|
|
CRIT("No evas surface associated with smart object (%p)", smart_obj);
|
|
|
|
abort();
|
|
|
|
return;
|
2009-10-07 05:47:01 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
if ((obj->layer && smart->layer) &&
|
|
|
|
(obj->layer->evas != smart->layer->evas))
|
2009-03-17 10:45:37 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CRIT("Adding object %p from Evas (%p) from another Evas (%p)", eo_obj, obj->layer->evas, smart->layer->evas);
|
2011-05-07 01:01:42 -07:00
|
|
|
abort();
|
|
|
|
return;
|
2009-03-17 10:45:37 -07:00
|
|
|
}
|
|
|
|
|
2006-07-30 07:30:24 -07:00
|
|
|
if (obj->smart.parent == smart_obj) return;
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (obj->smart.parent) evas_object_smart_member_del(eo_obj);
|
2009-03-17 10:45:37 -07:00
|
|
|
|
2012-05-06 19:11:35 -07:00
|
|
|
o->member_count++;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_release(eo_obj, obj, 1);
|
|
|
|
obj->layer = smart->layer;
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->cur.layer = obj->layer->layer;
|
2005-11-08 03:59:21 -08:00
|
|
|
obj->layer->usage++;
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->smart.parent = smart_obj;
|
2008-10-17 04:23:18 -07:00
|
|
|
o->contained = eina_inlist_append(o->contained, EINA_INLIST_GET(obj));
|
2012-10-18 04:30:04 -07:00
|
|
|
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE,
|
|
|
|
EINA_TRUE);
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->restack = 1;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
|
|
|
if (smart->smart.smart && smart->smart.smart->smart_class->member_add)
|
|
|
|
smart->smart.smart->smart_class->member_add(smart_obj, eo_obj);
|
|
|
|
evas_object_update_bounding_box(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_del(Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
if (!obj) return;
|
|
|
|
if (!obj->smart.parent) return;
|
|
|
|
Evas_Object *smart_obj = obj->smart.parent;
|
|
|
|
|
|
|
|
eo_do(smart_obj, evas_obj_smart_member_del(eo_obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_member_del(Eo *smart_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Object *eo_obj = va_arg(*list, Evas_Object *);
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
if (!obj->smart.parent) return;
|
2008-04-30 22:48:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *smart = eo_data_get(smart_obj, EVAS_OBJ_CLASS);
|
|
|
|
if (smart->smart.smart && smart->smart.smart->smart_class->member_del)
|
|
|
|
smart->smart.smart->smart_class->member_del(smart_obj, eo_obj);
|
2008-10-24 19:49:19 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Smart *o = eo_data_get(smart_obj, MY_CLASS);
|
2008-10-17 04:23:18 -07:00
|
|
|
o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(obj));
|
2012-05-06 19:11:35 -07:00
|
|
|
o->member_count--;
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->smart.parent = NULL;
|
2012-10-18 04:30:04 -07:00
|
|
|
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE, EINA_TRUE);
|
2005-11-08 03:59:21 -08:00
|
|
|
obj->layer->usage--;
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->cur.layer = obj->layer->layer;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inject(eo_obj, obj, obj->layer->evas->evas);
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->restack = 1;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-08-02 19:14:53 -07:00
|
|
|
EAPI Evas_Object *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_parent_get(const Evas_Object *eo_obj)
|
2006-08-02 19:14:53 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2006-08-02 19:14:53 -07:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object *smart_parent = NULL;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_parent_get(&smart_parent));
|
|
|
|
return smart_parent;
|
|
|
|
}
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
_type_check(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
const char *type = va_arg(*list, const char *);
|
|
|
|
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
|
|
|
if (0 == strcmp(type, "Evas_Object_Smart"))
|
|
|
|
*type_check = EINA_TRUE;
|
|
|
|
else
|
|
|
|
eo_do_super(eo_obj, evas_obj_type_check(type, type_check));
|
2006-08-02 19:14:53 -07:00
|
|
|
}
|
|
|
|
|
2010-03-22 18:22:20 -07:00
|
|
|
EAPI Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type)
|
2010-03-22 18:22:20 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2010-03-22 18:22:20 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Bool type_check = EINA_FALSE;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_type_check(type, &type_check));
|
|
|
|
return type_check;
|
2010-03-22 18:22:20 -07:00
|
|
|
}
|
|
|
|
|
2010-03-24 01:43:39 -07:00
|
|
|
EAPI Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_type_check_ptr(const Evas_Object *eo_obj, const char *type)
|
2010-03-24 01:43:39 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2010-03-24 01:43:39 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Bool type_check_ptr = EINA_FALSE;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_type_check_ptr(type, &type_check_ptr));
|
|
|
|
return type_check_ptr;
|
2010-03-24 01:43:39 -07:00
|
|
|
}
|
|
|
|
|
2008-10-21 09:31:05 -07:00
|
|
|
EAPI Eina_List *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_members_get(const Evas_Object *eo_obj)
|
2006-08-02 19:14:53 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2008-04-30 22:48:03 -07:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!eo_isa(eo_obj, MY_CLASS)) return NULL;
|
|
|
|
Eina_List *list = NULL;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_members_get(&list));
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_members_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_List **members_list = va_arg(*list, Eina_List **);
|
|
|
|
const Evas_Object_Smart *o = _pd;
|
|
|
|
Eina_List *members;
|
|
|
|
|
|
|
|
Eina_Inlist *member;
|
2008-04-30 22:48:03 -07:00
|
|
|
|
2006-08-02 19:14:53 -07:00
|
|
|
members = NULL;
|
2008-04-30 22:48:03 -07:00
|
|
|
for (member = o->contained; member; member = member->next)
|
2012-10-08 18:58:41 -07:00
|
|
|
members = eina_list_append(members, ((Evas_Object_Protected_Data *)member)->object);
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
*members_list = members;
|
2006-08-02 19:14:53 -07:00
|
|
|
}
|
|
|
|
|
2008-10-17 04:23:18 -07:00
|
|
|
const Eina_Inlist *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_members_get_direct(const Evas_Object *eo_obj)
|
2008-04-30 22:48:03 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2009-12-09 18:26:50 -08:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!eo_isa(eo_obj, MY_CLASS)) return NULL;
|
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2008-04-30 22:48:03 -07:00
|
|
|
return o->contained;
|
|
|
|
}
|
|
|
|
|
2010-10-06 20:54:51 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_smart_members_all_del(Evas_Object *eo_obj)
|
2010-10-06 20:54:51 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
|
|
|
Evas_Object_Protected_Data *memobj;
|
2012-06-13 00:55:24 -07:00
|
|
|
Eina_Inlist *itrn;
|
|
|
|
EINA_INLIST_FOREACH_SAFE(o->contained, itrn, memobj)
|
2012-06-11 01:35:07 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_del((Evas_Object *)((Evas_Object_Protected_Data *)memobj->object));
|
2012-06-11 01:35:07 -07:00
|
|
|
}
|
2010-10-06 20:54:51 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:23:03 -07:00
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_smart_class_ifaces_private_data_alloc(Evas_Object *eo_obj,
|
2012-07-04 14:23:03 -07:00
|
|
|
Evas_Smart *s)
|
|
|
|
{
|
|
|
|
unsigned int i, total_priv_sz = 0;
|
|
|
|
const Evas_Smart_Class *sc;
|
|
|
|
unsigned char *ptr;
|
|
|
|
|
|
|
|
/* get total size of interfaces private data */
|
|
|
|
for (sc = s->smart_class; sc; sc = sc->parent)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Interface **ifaces_array = sc->interfaces;
|
|
|
|
if (!ifaces_array) continue;
|
|
|
|
|
|
|
|
while (*ifaces_array)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Interface *iface = *ifaces_array;
|
|
|
|
|
|
|
|
if (!iface->name) break;
|
|
|
|
|
|
|
|
if (iface->private_size > 0)
|
|
|
|
{
|
|
|
|
unsigned int size = iface->private_size;
|
|
|
|
|
|
|
|
if (size % sizeof(void *) != 0)
|
|
|
|
size += sizeof(void *) - (size % sizeof(void *));
|
|
|
|
total_priv_sz += size;
|
|
|
|
}
|
|
|
|
|
|
|
|
ifaces_array++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
2012-07-04 14:23:03 -07:00
|
|
|
obj->interface_privates = malloc
|
|
|
|
(s->interfaces.size * sizeof(void *) + total_priv_sz);
|
|
|
|
if (!obj->interface_privates)
|
|
|
|
{
|
|
|
|
ERR("malloc failed!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make private data array ptrs point to right places, WHICH LIE ON
|
|
|
|
* THE SAME STRUCT, AFTER THE # OF INTERFACES COUNT */
|
|
|
|
ptr = (unsigned char *)(obj->interface_privates + s->interfaces.size);
|
|
|
|
for (i = 0; i < s->interfaces.size; i++)
|
|
|
|
{
|
|
|
|
unsigned int size;
|
|
|
|
|
|
|
|
size = s->interfaces.array[i]->private_size;
|
|
|
|
|
|
|
|
if (size == 0)
|
|
|
|
{
|
|
|
|
obj->interface_privates[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
obj->interface_privates[i] = ptr;
|
|
|
|
memset(ptr, 0, size);
|
|
|
|
|
|
|
|
if (size % sizeof(void *) != 0)
|
|
|
|
size += sizeof(void *) - (size % sizeof(void *));
|
|
|
|
ptr += size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Object *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_add(Evas *eo_e, Evas_Smart *s)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object *eo_obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
|
2002-11-08 00:02:15 -08:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_obj = eo_add(EVAS_OBJ_SMART_CLASS, eo_e);
|
|
|
|
eo_do(eo_obj, evas_obj_smart_attach(s));
|
|
|
|
eo_unref(eo_obj);
|
|
|
|
return eo_obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_constructor(Eo *eo_obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
eo_do_super(eo_obj, eo_constructor());
|
|
|
|
evas_object_smart_init(eo_obj);
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
evas_object_inject(eo_obj, obj, evas_object_evas_get(eo_parent_get(eo_obj)));
|
|
|
|
eo_do(eo_obj,
|
|
|
|
evas_obj_type_set(MY_CLASS_NAME),
|
|
|
|
evas_obj_smart_add());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_add(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->add) s->smart_class->add(eo_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_del(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_resize(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Coord w = va_arg(*list, Evas_Coord);
|
|
|
|
Evas_Coord h = va_arg(*list, Evas_Coord);
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->resize) s->smart_class->resize(eo_obj, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_move(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Coord x = va_arg(*list, Evas_Coord);
|
|
|
|
Evas_Coord y = va_arg(*list, Evas_Coord);
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->move) s->smart_class->move(eo_obj, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_show(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->show) s->smart_class->show(eo_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_hide(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->hide) s->smart_class->hide(eo_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_color_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
int r = va_arg(*list, int);
|
|
|
|
int g = va_arg(*list, int);
|
|
|
|
int b = va_arg(*list, int);
|
|
|
|
int a = va_arg(*list, int);
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->color_set) s->smart_class->color_set(eo_obj, r, g, b, a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_clip_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Object *clip = va_arg(*list, Evas_Object *);
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->clip_set) s->smart_class->clip_set(eo_obj, clip);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_clip_unset(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
// If this function is reached, so we do nothing except trying to call
|
|
|
|
// the function of the legacy smart class.
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Smart *s = obj->smart.smart;
|
|
|
|
if (s && s->smart_class->clip_unset) s->smart_class->clip_unset(eo_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_attach(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Smart *s = va_arg(*list, Evas_Smart *);
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART);
|
2012-10-08 18:58:41 -07:00
|
|
|
return;
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
unsigned int i;
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->smart.smart = s;
|
2003-10-08 20:05:17 -07:00
|
|
|
obj->type = s->smart_class->name;
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_smart_use(s);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_smart_class_ifaces_private_data_alloc(eo_obj, s);
|
2012-07-04 14:23:03 -07:00
|
|
|
|
|
|
|
for (i = 0; i < s->interfaces.size; i++)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Interface *iface;
|
|
|
|
|
|
|
|
iface = s->interfaces.array[i];
|
|
|
|
if (iface->add)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!iface->add(eo_obj))
|
2012-07-04 14:23:03 -07:00
|
|
|
{
|
|
|
|
ERR("failed to create interface %s\n", iface->name);
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_del(eo_obj);
|
|
|
|
return;
|
2012-07-04 14:23:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(eo_obj, evas_obj_smart_add());
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2011-08-17 04:55:29 -07:00
|
|
|
static int
|
|
|
|
_callback_priority_cmp(const void *_a, const void *_b)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Callback *a, *b;
|
|
|
|
a = (const Evas_Smart_Callback *) _a;
|
|
|
|
b = (const Evas_Smart_Callback *) _b;
|
|
|
|
if (a->priority < b->priority)
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_add(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func, const void *data)
|
2011-08-17 04:55:29 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_priority_add(eo_obj, event,
|
2011-08-17 04:55:29 -07:00
|
|
|
EVAS_CALLBACK_PRIORITY_DEFAULT, func, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event, Evas_Callback_Priority priority, Evas_Smart_Cb func, const void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
|
|
|
Evas_Smart_Callback *cb;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
o = eo_data_get(eo_obj, MY_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!event) return;
|
|
|
|
if (!func) return;
|
2012-06-16 18:32:10 -07:00
|
|
|
EVAS_MEMPOOL_INIT(_mp_cb, "evas_smart_callback", Evas_Smart_Callback, 32, );
|
2010-11-26 02:01:18 -08:00
|
|
|
cb = EVAS_MEMPOOL_ALLOC(_mp_cb, Evas_Smart_Callback);
|
|
|
|
if (!cb) return;
|
|
|
|
EVAS_MEMPOOL_PREP(_mp_cb, cb, Evas_Smart_Callback);
|
2008-10-15 07:38:34 -07:00
|
|
|
cb->event = eina_stringshare_add(event);
|
2002-11-08 00:02:15 -08:00
|
|
|
cb->func = func;
|
2003-01-09 20:58:51 -08:00
|
|
|
cb->func_data = (void *)data;
|
2011-08-17 04:55:29 -07:00
|
|
|
cb->priority = priority;
|
|
|
|
o->callbacks = eina_list_sorted_insert(o->callbacks, _callback_priority_cmp,
|
|
|
|
cb);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_del(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
2008-10-21 09:31:05 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evas_Smart_Callback *cb;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2003-10-17 20:34:00 -07:00
|
|
|
return NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
o = eo_data_get(eo_obj, MY_CLASS);
|
|
|
|
|
2003-10-17 20:34:00 -07:00
|
|
|
if (!event) return NULL;
|
2008-10-21 09:31:05 -07:00
|
|
|
EINA_LIST_FOREACH(o->callbacks, l, cb)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2011-05-07 01:01:42 -07:00
|
|
|
if ((!strcmp(cb->event, event)) && (cb->func == func))
|
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
|
|
|
|
data = cb->func_data;
|
|
|
|
cb->delete_me = 1;
|
|
|
|
o->deletions_waiting = 1;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callbacks_clear(eo_obj);
|
2011-05-07 01:01:42 -07:00
|
|
|
return data;
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-16 09:25:40 -08:00
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_del_full(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func, const void *data)
|
2012-01-16 09:25:40 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Smart_Callback *cb;
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2012-01-16 09:25:40 -08:00
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
o = eo_data_get(eo_obj, MY_CLASS);
|
2012-01-16 09:25:40 -08:00
|
|
|
if (!event) return NULL;
|
|
|
|
EINA_LIST_FOREACH(o->callbacks, l, cb)
|
|
|
|
{
|
|
|
|
if ((!strcmp(cb->event, event)) && (cb->func == func) && (cb->func_data == data))
|
|
|
|
{
|
2012-01-18 15:33:07 -08:00
|
|
|
void *ret;
|
2012-01-16 09:25:40 -08:00
|
|
|
|
2012-01-18 15:33:07 -08:00
|
|
|
ret = cb->func_data;
|
2012-01-16 09:25:40 -08:00
|
|
|
cb->delete_me = 1;
|
|
|
|
o->deletions_waiting = 1;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callbacks_clear(eo_obj);
|
2012-01-18 15:33:07 -08:00
|
|
|
return ret;
|
2012-01-16 09:25:40 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_call(Evas_Object *eo_obj, const char *event, void *event_info)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
2008-10-21 09:31:05 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evas_Smart_Callback *cb;
|
2009-09-03 20:53:18 -07:00
|
|
|
const char *strshare;
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2002-11-08 00:02:15 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
o = eo_data_get(eo_obj, MY_CLASS);
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!event) return;
|
2003-01-19 20:36:17 -08:00
|
|
|
if (obj->delete_me) return;
|
2008-04-30 22:48:03 -07:00
|
|
|
o->walking_list++;
|
2009-09-03 20:53:18 -07:00
|
|
|
strshare = eina_stringshare_add(event);
|
2008-10-21 09:31:05 -07:00
|
|
|
EINA_LIST_FOREACH(o->callbacks, l, cb)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2011-05-07 01:01:42 -07:00
|
|
|
if (!cb->delete_me)
|
|
|
|
{
|
|
|
|
if (cb->event == strshare)
|
2012-10-08 18:58:41 -07:00
|
|
|
cb->func(cb->func_data, eo_obj, event_info);
|
2011-05-07 01:01:42 -07:00
|
|
|
}
|
|
|
|
if (obj->delete_me)
|
|
|
|
break;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2009-09-03 20:53:18 -07:00
|
|
|
eina_stringshare_del(strshare);
|
2008-04-30 22:48:03 -07:00
|
|
|
o->walking_list--;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callbacks_clear(eo_obj);
|
|
|
|
|
|
|
|
const _Evas_Event_Description *event_desc = eina_hash_find(signals_hash_table, event);
|
|
|
|
if (event_desc)
|
|
|
|
eo_do(eo_obj, eo_event_callback_call(event_desc->eo_desc, event_info, NULL));
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2010-01-11 06:24:41 -08:00
|
|
|
EAPI Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(Evas_Object *eo_obj, const Evas_Smart_Cb_Description *descriptions)
|
2010-01-11 06:24:41 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2011-07-28 23:49:25 -07:00
|
|
|
return EINA_FALSE;
|
2010-01-11 06:24:41 -08:00
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Bool result = EINA_FALSE;
|
|
|
|
eo_do(eo_obj, evas_obj_smart_callbacks_descriptions_set(descriptions, &result));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_callbacks_descriptions_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Cb_Description *descriptions = va_arg(*list, Evas_Smart_Cb_Description *);
|
|
|
|
Eina_Bool *result = va_arg(*list, Eina_Bool *);
|
|
|
|
if (result) *result = EINA_TRUE;
|
|
|
|
|
|
|
|
const Evas_Smart_Cb_Description *d;
|
|
|
|
Evas_Object_Smart *o = _pd;
|
|
|
|
unsigned int i, count = 0;
|
2010-01-11 06:24:41 -08:00
|
|
|
|
|
|
|
if ((!descriptions) || (!descriptions->name))
|
|
|
|
{
|
2011-05-07 01:01:42 -07:00
|
|
|
evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, 0);
|
2012-10-08 18:58:41 -07:00
|
|
|
return;
|
2010-01-11 06:24:41 -08:00
|
|
|
}
|
|
|
|
|
2010-08-21 06:52:25 -07:00
|
|
|
for (count = 0, d = descriptions; d->name; d++)
|
2010-01-11 06:24:41 -08:00
|
|
|
count++;
|
|
|
|
|
|
|
|
evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, count);
|
2012-10-08 18:58:41 -07:00
|
|
|
if (count == 0) return;
|
2010-04-01 08:56:06 -07:00
|
|
|
|
2010-01-11 06:24:41 -08:00
|
|
|
for (i = 0, d = descriptions; i < count; d++, i++)
|
|
|
|
o->callbacks_descriptions.array[i] = d;
|
|
|
|
|
|
|
|
evas_smart_cb_descriptions_fix(&o->callbacks_descriptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_get(const Evas_Object *eo_obj, const Evas_Smart_Cb_Description ***class_descriptions, unsigned int *class_count, const Evas_Smart_Cb_Description ***instance_descriptions, unsigned int *instance_count)
|
2010-01-11 06:24:41 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2010-01-11 06:24:41 -08:00
|
|
|
if (class_descriptions) *class_descriptions = NULL;
|
|
|
|
if (class_count) *class_count = 0;
|
|
|
|
if (instance_descriptions) *instance_descriptions = NULL;
|
|
|
|
if (instance_count) *instance_count = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_callbacks_descriptions_get(class_descriptions, class_count, instance_descriptions, instance_count));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_callbacks_descriptions_get(Eo *eo_obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Cb_Description ***class_descriptions = va_arg(*list, const Evas_Smart_Cb_Description ***);
|
|
|
|
unsigned int *class_count = va_arg(*list, unsigned int *);
|
|
|
|
const Evas_Smart_Cb_Description ***instance_descriptions = va_arg(*list, const Evas_Smart_Cb_Description ***);
|
|
|
|
unsigned int *instance_count = va_arg(*list, unsigned int *);
|
|
|
|
const Evas_Object_Smart *o = _pd;
|
2010-01-11 06:24:41 -08:00
|
|
|
if (class_descriptions) *class_descriptions = NULL;
|
|
|
|
if (class_count) *class_count = 0;
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
if (obj->smart.smart && class_descriptions)
|
|
|
|
*class_descriptions = obj->smart.smart->callbacks.array;
|
|
|
|
if (obj->smart.smart && class_count)
|
2010-01-11 06:24:41 -08:00
|
|
|
*class_count = obj->smart.smart->callbacks.size;
|
|
|
|
|
|
|
|
if (instance_descriptions)
|
|
|
|
*instance_descriptions = o->callbacks_descriptions.array;
|
|
|
|
if (instance_count)
|
|
|
|
*instance_count = o->callbacks_descriptions.size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callback_description_find(const Evas_Object *eo_obj, const char *name, const Evas_Smart_Cb_Description **class_description, const Evas_Smart_Cb_Description **instance_description)
|
2010-01-11 06:24:41 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
if (class_description) *class_description = NULL;
|
|
|
|
if (instance_description) *instance_description = NULL;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_callback_description_find(name, class_description, instance_description));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_callback_description_find(Eo *eo_obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
const char *name = va_arg(*list, const char *);
|
|
|
|
const Evas_Smart_Cb_Description **class_description = va_arg(*list, const Evas_Smart_Cb_Description **);
|
|
|
|
const Evas_Smart_Cb_Description **instance_description = va_arg(*list, const Evas_Smart_Cb_Description **);
|
2010-01-11 06:24:41 -08:00
|
|
|
|
|
|
|
if (!name)
|
|
|
|
{
|
2011-05-07 01:01:42 -07:00
|
|
|
if (class_description) *class_description = NULL;
|
|
|
|
if (instance_description) *instance_description = NULL;
|
|
|
|
return;
|
2010-01-11 06:24:41 -08:00
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
const Evas_Object_Smart *o = _pd;
|
2010-01-11 06:24:41 -08:00
|
|
|
if (class_description)
|
|
|
|
*class_description = evas_smart_cb_description_find
|
2011-05-07 01:01:42 -07:00
|
|
|
(&obj->smart.smart->callbacks, name);
|
2010-01-11 06:24:41 -08:00
|
|
|
|
|
|
|
if (instance_description)
|
|
|
|
*instance_description = evas_smart_cb_description_find
|
2011-05-07 01:01:42 -07:00
|
|
|
(&o->callbacks_descriptions, name);
|
2010-01-11 06:24:41 -08:00
|
|
|
}
|
|
|
|
|
2008-09-06 18:25:49 -07:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_need_recalculate_set(Evas_Object *eo_obj, Eina_Bool value)
|
2008-09-06 18:25:49 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2008-09-06 18:25:49 -07:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(eo_obj, evas_obj_smart_need_recalculate_set(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_need_recalculate_set(Eo *eo_obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_Bool value = va_arg(*list, int);
|
|
|
|
Evas_Object_Smart *o = _pd;
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
2008-09-06 18:25:49 -07:00
|
|
|
|
2011-08-29 16:45:24 -07:00
|
|
|
// XXX: do i need this?
|
|
|
|
if (obj->delete_me) return;
|
2011-10-12 19:22:29 -07:00
|
|
|
|
|
|
|
/* remove this entry from calc_list or processed list */
|
|
|
|
if (eina_clist_element_is_linked(&obj->calc_entry))
|
|
|
|
eina_clist_remove(&obj->calc_entry);
|
|
|
|
|
2008-09-06 18:25:49 -07:00
|
|
|
value = !!value;
|
2011-08-29 16:45:24 -07:00
|
|
|
if (value)
|
2011-10-12 19:22:29 -07:00
|
|
|
eina_clist_add_tail(&obj->layer->evas->calc_list, &obj->calc_entry);
|
2011-11-16 20:31:43 -08:00
|
|
|
else
|
|
|
|
eina_clist_add_tail(&obj->layer->evas->calc_done, &obj->calc_entry);
|
2011-10-12 19:22:29 -07:00
|
|
|
|
2011-08-29 16:45:24 -07:00
|
|
|
if (o->need_recalculate == value) return;
|
2011-07-20 02:14:41 -07:00
|
|
|
|
2011-10-25 05:25:15 -07:00
|
|
|
if (obj->recalculate_cycle > 254)
|
2011-07-20 02:14:41 -07:00
|
|
|
{
|
|
|
|
ERR("Object %p is not stable during recalc loop", obj);
|
2011-08-29 16:45:24 -07:00
|
|
|
return;
|
2011-07-20 02:14:41 -07:00
|
|
|
}
|
2011-08-29 16:45:24 -07:00
|
|
|
if (obj->layer->evas->in_smart_calc) obj->recalculate_cycle++;
|
2008-09-06 18:25:49 -07:00
|
|
|
o->need_recalculate = value;
|
|
|
|
}
|
|
|
|
|
2009-06-17 03:01:52 -07:00
|
|
|
EAPI Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_need_recalculate_get(const Evas_Object *eo_obj)
|
2008-09-06 18:25:49 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2011-07-28 23:49:25 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-06 18:25:49 -07:00
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
Eina_Bool need_recalculate = EINA_FALSE;
|
|
|
|
eo_do((Eo *)eo_obj, evas_obj_smart_need_recalculate_get(&need_recalculate));
|
|
|
|
return need_recalculate;
|
|
|
|
}
|
2008-09-06 18:25:49 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
_smart_need_recalculate_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_Bool *need_recalculate = va_arg(*list, Eina_Bool *);
|
|
|
|
const Evas_Object_Smart *o = _pd;
|
|
|
|
if (need_recalculate) *need_recalculate = o->need_recalculate;
|
2008-09-06 18:25:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_calculate(Evas_Object *eo_obj)
|
2008-09-06 18:25:49 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2008-10-24 19:49:19 -07:00
|
|
|
return;
|
2008-09-06 18:25:49 -07:00
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(eo_obj, evas_obj_smart_calculate());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_calculate(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Smart *o = _pd;
|
2008-09-06 18:25:49 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!obj->smart.smart || !obj->smart.smart->smart_class->calculate)
|
2008-12-11 13:55:22 -08:00
|
|
|
return;
|
|
|
|
|
2011-07-07 08:24:16 -07:00
|
|
|
o->need_recalculate = 0;
|
2012-10-08 18:58:41 -07:00
|
|
|
obj->smart.smart->smart_class->calculate(eo_obj);
|
2008-09-06 18:25:49 -07:00
|
|
|
}
|
|
|
|
|
2009-10-08 07:28:21 -07:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_smart_objects_calculate(Evas *eo_e)
|
2009-10-08 07:28:21 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(eo_e, evas_canvas_smart_objects_calculate());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_canvas_smart_objects_calculate(Eo *eo_e, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
evas_call_smarts_calculate(eo_e);
|
2009-10-08 07:28:21 -07:00
|
|
|
}
|
|
|
|
|
2011-08-26 05:26:45 -07:00
|
|
|
EAPI int
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_smart_objects_calculate_count_get(const Evas *eo_e)
|
2011-08-26 05:26:45 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
|
2011-08-26 05:26:45 -07:00
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
int ret = 0;
|
|
|
|
eo_do((Eo *)eo_e, evas_canvas_smart_objects_calculate_count_get(&ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_canvas_smart_objects_calculate_count_get(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
int *ret = va_arg(*list, int *);
|
|
|
|
const Evas_Public_Data *e = _pd;
|
|
|
|
*ret = e->smart_calc_count;
|
2011-08-26 05:26:45 -07:00
|
|
|
}
|
|
|
|
|
2008-09-06 18:25:49 -07:00
|
|
|
/**
|
|
|
|
* Call calculate() on all smart objects that need_recalculate.
|
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_call_smarts_calculate(Evas *eo_e)
|
2008-09-06 18:25:49 -07:00
|
|
|
{
|
2011-10-12 19:22:29 -07:00
|
|
|
Eina_Clist *elem;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
|
|
|
Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
|
2008-09-06 18:25:49 -07:00
|
|
|
|
2011-08-29 16:45:24 -07:00
|
|
|
// printf("+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALC-----------v\n");
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_freeze(eo_e);
|
2011-07-20 02:14:41 -07:00
|
|
|
e->in_smart_calc++;
|
2011-10-12 19:22:29 -07:00
|
|
|
|
|
|
|
while (NULL != (elem = eina_clist_head(&e->calc_list)))
|
2008-09-06 18:25:49 -07:00
|
|
|
{
|
2011-10-12 19:22:29 -07:00
|
|
|
Evas_Object_Smart *o;
|
|
|
|
|
|
|
|
/* move the item to the processed list */
|
2012-10-08 18:58:41 -07:00
|
|
|
obj = EINA_CLIST_ENTRY(elem, Evas_Object_Protected_Data, calc_entry);
|
2011-10-12 19:22:29 -07:00
|
|
|
eina_clist_remove(&obj->calc_entry);
|
2011-08-29 16:45:24 -07:00
|
|
|
if (obj->delete_me) continue;
|
2011-11-16 20:31:43 -08:00
|
|
|
eina_clist_add_tail(&e->calc_done, &obj->calc_entry);
|
2011-10-12 19:22:29 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
o = eo_data_get(obj->object, MY_CLASS);
|
2011-10-12 19:22:29 -07:00
|
|
|
|
2011-05-07 01:01:42 -07:00
|
|
|
if (o->need_recalculate)
|
|
|
|
{
|
2011-07-07 08:24:16 -07:00
|
|
|
o->need_recalculate = 0;
|
2012-10-08 18:58:41 -07:00
|
|
|
if (obj->smart.smart && obj->smart.smart->smart_class->calculate)
|
|
|
|
obj->smart.smart->smart_class->calculate(obj->object);
|
|
|
|
else
|
|
|
|
eo_do(obj->object, evas_obj_smart_calculate());
|
2011-05-07 01:01:42 -07:00
|
|
|
}
|
2008-09-06 18:25:49 -07:00
|
|
|
}
|
2011-10-12 19:22:29 -07:00
|
|
|
|
2011-11-16 20:31:43 -08:00
|
|
|
while (NULL != (elem = eina_clist_head(&e->calc_done)))
|
2011-07-20 02:14:41 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
obj = EINA_CLIST_ENTRY(elem, Evas_Object_Protected_Data, calc_entry);
|
2011-07-20 02:14:41 -07:00
|
|
|
obj->recalculate_cycle = 0;
|
2011-10-12 19:22:29 -07:00
|
|
|
eina_clist_remove(&obj->calc_entry);
|
2011-07-20 02:14:41 -07:00
|
|
|
}
|
2011-10-12 19:22:29 -07:00
|
|
|
|
2011-07-20 02:14:41 -07:00
|
|
|
e->in_smart_calc--;
|
2011-08-29 16:45:24 -07:00
|
|
|
if (e->in_smart_calc == 0) e->smart_calc_count++;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_thaw(eo_e);
|
|
|
|
evas_event_thaw_eval(eo_e);
|
2008-09-06 18:25:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_changed(Evas_Object *eo_obj)
|
2008-09-06 18:25:49 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2008-09-06 18:25:49 -07:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_do(eo_obj, evas_obj_smart_changed());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_changed(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
eo_do(eo_obj, evas_obj_smart_need_recalculate_set(1));
|
2008-09-06 18:25:49 -07:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* internal calls */
|
2003-01-19 20:36:17 -08:00
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_callbacks_clear(Evas_Object *eo_obj)
|
2003-01-19 20:36:17 -08:00
|
|
|
{
|
2008-04-30 22:48:03 -07:00
|
|
|
Evas_Object_Smart *o;
|
2008-10-21 09:31:05 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evas_Smart_Callback *cb;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
o = eo_data_get(eo_obj, MY_CLASS);
|
2008-04-30 22:48:03 -07:00
|
|
|
|
|
|
|
if (o->walking_list) return;
|
|
|
|
if (!o->deletions_waiting) return;
|
|
|
|
for (l = o->callbacks; l;)
|
2003-01-19 20:36:17 -08:00
|
|
|
{
|
2011-05-07 01:01:42 -07:00
|
|
|
cb = eina_list_data_get(l);
|
|
|
|
l = eina_list_next(l);
|
|
|
|
if (cb->delete_me)
|
|
|
|
{
|
|
|
|
o->callbacks = eina_list_remove(o->callbacks, cb);
|
|
|
|
if (cb->event) eina_stringshare_del(cb->event);
|
2010-11-26 02:01:18 -08:00
|
|
|
EVAS_MEMPOOL_FREE(_mp_cb, cb);
|
2011-05-07 01:01:42 -07:00
|
|
|
}
|
2003-01-19 20:36:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_del(Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
Evas_Smart *s;
|
2012-07-04 14:23:03 -07:00
|
|
|
unsigned int i;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-10-15 05:15:36 -07:00
|
|
|
if (obj->delete_me) return;
|
2011-07-28 23:49:25 -07:00
|
|
|
s = obj->smart.smart;
|
2012-10-08 18:58:41 -07:00
|
|
|
if (s && s->smart_class->del)
|
|
|
|
s->smart_class->del(eo_obj);
|
|
|
|
else
|
|
|
|
eo_do(eo_obj, evas_obj_smart_del());
|
|
|
|
if (obj->smart.parent) evas_object_smart_member_del(eo_obj);
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (s)
|
2012-07-04 14:23:03 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
for (i = 0; i < s->interfaces.size; i++)
|
|
|
|
{
|
|
|
|
const Evas_Smart_Interface *iface;
|
2012-07-04 14:23:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
iface = s->interfaces.array[i];
|
|
|
|
if (iface->del) iface->del(eo_obj);
|
|
|
|
}
|
2012-07-04 14:23:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
free(obj->interface_privates);
|
|
|
|
obj->interface_privates = NULL;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (s) evas_object_smart_unuse(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_cleanup(Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-04-26 19:35:48 -07:00
|
|
|
if (obj->smart.parent)
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_del(eo_obj);
|
2008-04-30 22:48:03 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (obj->is_smart)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2011-10-12 19:22:29 -07:00
|
|
|
if (obj->calc_entry.next)
|
|
|
|
eina_clist_remove(&obj->calc_entry);
|
2011-08-29 16:45:24 -07:00
|
|
|
|
2011-05-07 01:01:42 -07:00
|
|
|
while (o->contained)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
|
|
|
Evas_Object *contained_obj = ((Evas_Object_Protected_Data *)o->contained)->object;
|
|
|
|
evas_object_smart_member_del(contained_obj);
|
|
|
|
}
|
2008-04-30 22:48:03 -07:00
|
|
|
|
2011-05-07 01:01:42 -07:00
|
|
|
while (o->callbacks)
|
|
|
|
{
|
2011-10-25 01:37:43 -07:00
|
|
|
Evas_Smart_Callback *cb = o->callbacks->data;
|
2011-05-07 01:01:42 -07:00
|
|
|
o->callbacks = eina_list_remove(o->callbacks, cb);
|
|
|
|
if (cb->event) eina_stringshare_del(cb->event);
|
2010-11-26 02:01:18 -08:00
|
|
|
EVAS_MEMPOOL_FREE(_mp_cb, cb);
|
2011-05-07 01:01:42 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2011-05-07 01:01:42 -07:00
|
|
|
evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, 0);
|
|
|
|
o->data = NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2008-04-30 22:48:03 -07:00
|
|
|
|
2003-10-17 20:34:00 -07:00
|
|
|
obj->smart.parent = NULL;
|
2003-01-19 19:54:00 -08:00
|
|
|
obj->smart.smart = NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2005-07-22 03:28:11 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_cache_invalidate(Evas_Object *eo_obj,
|
2011-10-27 03:36:09 -07:00
|
|
|
Eina_Bool pass_events,
|
2012-10-18 04:30:04 -07:00
|
|
|
Eina_Bool freeze_events,
|
|
|
|
Eina_Bool source_invisible)
|
2005-07-22 03:28:11 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2011-05-06 04:04:32 -07:00
|
|
|
return;
|
2011-05-06 03:55:24 -07:00
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Protected_Data *member;
|
|
|
|
|
2011-10-27 03:36:09 -07:00
|
|
|
if (pass_events)
|
|
|
|
obj->parent_cache.pass_events_valid = EINA_FALSE;
|
|
|
|
if (freeze_events)
|
|
|
|
obj->parent_cache.freeze_events_valid = EINA_FALSE;
|
2012-10-18 04:30:04 -07:00
|
|
|
if (source_invisible)
|
2012-10-25 08:24:27 -07:00
|
|
|
obj->parent_cache.src_invisible_valid = EINA_FALSE;
|
2011-05-06 04:04:32 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!obj->is_smart) return;
|
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2011-10-27 03:36:09 -07:00
|
|
|
EINA_INLIST_FOREACH(o->contained, member)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
|
|
|
Evas_Object *eo_member = member->object;
|
2012-10-18 04:30:04 -07:00
|
|
|
evas_object_smart_member_cache_invalidate(eo_member, pass_events,
|
|
|
|
freeze_events,
|
|
|
|
source_invisible);
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2005-07-22 03:28:11 -07:00
|
|
|
}
|
|
|
|
|
2008-04-30 22:48:03 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_raise(Evas_Object *eo_member)
|
2008-04-30 22:48:03 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *member = eo_data_get(eo_member, EVAS_OBJ_CLASS);
|
|
|
|
o = eo_data_get(member->smart.parent, MY_CLASS);
|
2008-10-17 04:23:18 -07:00
|
|
|
o->contained = eina_inlist_demote(o->contained, EINA_INLIST_GET(member));
|
2008-04-30 22:48:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_lower(Evas_Object *eo_member)
|
2008-04-30 22:48:03 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *member = eo_data_get(eo_member, EVAS_OBJ_CLASS);
|
|
|
|
o = eo_data_get(member->smart.parent, MY_CLASS);
|
2008-10-17 04:23:18 -07:00
|
|
|
o->contained = eina_inlist_promote(o->contained, EINA_INLIST_GET(member));
|
2008-04-30 22:48:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_stack_above(Evas_Object *eo_member, Evas_Object *eo_other)
|
2008-04-30 22:48:03 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *member = eo_data_get(eo_member, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Protected_Data *other = eo_data_get(eo_other, EVAS_OBJ_CLASS);
|
|
|
|
o = eo_data_get(member->smart.parent, MY_CLASS);
|
2008-10-17 04:23:18 -07:00
|
|
|
o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(member));
|
|
|
|
o->contained = eina_inlist_append_relative(o->contained, EINA_INLIST_GET(member), EINA_INLIST_GET(other));
|
2008-04-30 22:48:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_member_stack_below(Evas_Object *eo_member, Evas_Object *eo_other)
|
2008-04-30 22:48:03 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Smart *o;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *member = eo_data_get(eo_member, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Protected_Data *other = eo_data_get(eo_other, EVAS_OBJ_CLASS);
|
|
|
|
o = eo_data_get(member->smart.parent, MY_CLASS);
|
2008-10-17 04:23:18 -07:00
|
|
|
o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(member));
|
|
|
|
o->contained = eina_inlist_prepend_relative(o->contained, EINA_INLIST_GET(member), EINA_INLIST_GET(other));
|
2008-04-30 22:48:03 -07:00
|
|
|
}
|
|
|
|
|
2012-06-07 00:10:36 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj)
|
2012-06-07 00:10:36 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2012-06-07 00:10:36 -07:00
|
|
|
|
|
|
|
if (o->update_boundingbox_needed) return ;
|
|
|
|
o->update_boundingbox_needed = EINA_TRUE;
|
|
|
|
|
|
|
|
if (obj->smart.parent) evas_object_smart_need_bounding_box_update(obj->smart.parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-10 00:23:00 -07:00
|
|
|
evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
2012-06-07 00:10:36 -07:00
|
|
|
{
|
2012-10-10 00:23:00 -07:00
|
|
|
Evas_Object_Smart *os;
|
2012-06-07 00:10:36 -07:00
|
|
|
Eina_Inlist *list;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *o;
|
2012-06-07 00:10:36 -07:00
|
|
|
Evas_Coord minx;
|
|
|
|
Evas_Coord miny;
|
|
|
|
Evas_Coord maxw = 0;
|
|
|
|
Evas_Coord maxh = 0;
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2012-10-10 00:23:00 -07:00
|
|
|
|
|
|
|
os = eo_data_get(eo_obj, MY_CLASS);
|
2012-06-07 00:10:36 -07:00
|
|
|
|
|
|
|
if (!os->update_boundingbox_needed) return ;
|
|
|
|
os->update_boundingbox_needed = EINA_FALSE;
|
|
|
|
|
|
|
|
minx = obj->layer->evas->output.w;
|
|
|
|
miny = obj->layer->evas->output.h;
|
|
|
|
|
|
|
|
list = os->contained;
|
|
|
|
EINA_INLIST_FOREACH(list, o)
|
|
|
|
{
|
|
|
|
Evas_Coord tx;
|
|
|
|
Evas_Coord ty;
|
|
|
|
Evas_Coord tw;
|
|
|
|
Evas_Coord th;
|
|
|
|
|
|
|
|
if (o == obj) continue ;
|
2012-06-07 20:45:40 -07:00
|
|
|
if (o->clip.clipees || o->is_static_clip) continue ;
|
2012-06-07 00:10:36 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (eo_isa(o->object, EVAS_OBJ_SMART_CLASS))
|
2012-06-07 00:10:36 -07:00
|
|
|
{
|
2012-10-10 00:23:00 -07:00
|
|
|
evas_object_smart_bounding_box_update(o->object, o);
|
2012-06-07 00:10:36 -07:00
|
|
|
|
|
|
|
tx = o->cur.bounding_box.x;
|
|
|
|
ty = o->cur.bounding_box.y;
|
|
|
|
tw = o->cur.bounding_box.x + o->cur.bounding_box.w;
|
|
|
|
th = o->cur.bounding_box.y + o->cur.bounding_box.h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tx = o->cur.geometry.x;
|
|
|
|
ty = o->cur.geometry.y;
|
|
|
|
tw = o->cur.geometry.x + o->cur.geometry.w;
|
|
|
|
th = o->cur.geometry.y + o->cur.geometry.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tx < minx) minx = tx;
|
|
|
|
if (ty < miny) miny = ty;
|
|
|
|
if (tw > maxw) maxw = tw;
|
|
|
|
if (th > maxh) maxh = th;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (minx != obj->cur.bounding_box.x)
|
|
|
|
{
|
|
|
|
obj->cur.bounding_box.w += obj->cur.bounding_box.x - minx;
|
|
|
|
obj->cur.bounding_box.x = minx;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (miny != obj->cur.bounding_box.y)
|
|
|
|
{
|
|
|
|
obj->cur.bounding_box.h += obj->cur.bounding_box.y - miny;
|
|
|
|
obj->cur.bounding_box.y = miny;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (maxw != obj->cur.bounding_box.x + obj->cur.bounding_box.w)
|
|
|
|
{
|
|
|
|
obj->cur.bounding_box.w = maxw - obj->cur.bounding_box.x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (maxh != obj->cur.bounding_box.y + obj->cur.bounding_box.h)
|
|
|
|
{
|
|
|
|
obj->cur.bounding_box.h = maxh - obj->cur.bounding_box.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* all nice and private */
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_init(Evas_Object *eo_obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
|
|
obj->is_smart = EINA_TRUE;
|
2002-11-08 00:02:15 -08:00
|
|
|
/* set up default settings for this kind of object */
|
|
|
|
obj->cur.color.r = 255;
|
|
|
|
obj->cur.color.g = 255;
|
|
|
|
obj->cur.color.b = 255;
|
|
|
|
obj->cur.color.a = 255;
|
2007-10-04 21:52:10 -07:00
|
|
|
obj->cur.geometry.x = 0;
|
|
|
|
obj->cur.geometry.y = 0;
|
|
|
|
obj->cur.geometry.w = 0;
|
|
|
|
obj->cur.geometry.h = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->cur.layer = 0;
|
|
|
|
/* set up object-specific settings */
|
|
|
|
obj->prev = obj->cur;
|
|
|
|
/* set up methods (compulsory) */
|
|
|
|
obj->func = &object_func;
|
|
|
|
}
|
|
|
|
|
2005-05-21 19:49:50 -07:00
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_render(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED, void *output EINA_UNUSED, void *context EINA_UNUSED, void *surface EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2003-10-17 20:34:00 -07:00
|
|
|
return;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
if (obj->pre_render_done) return;
|
2012-07-04 02:39:23 -07:00
|
|
|
if (!obj->child_has_map && !obj->cur.cached_surface)
|
2012-05-02 20:58:27 -07:00
|
|
|
{
|
|
|
|
#if 0
|
2012-05-06 19:11:35 -07:00
|
|
|
Evas_Object_Smart *o;
|
|
|
|
|
2012-07-04 02:39:23 -07:00
|
|
|
fprintf(stderr, "");
|
2012-05-06 19:11:35 -07:00
|
|
|
o = (Evas_Object_Smart *)(obj->object_data);
|
2012-07-04 02:39:23 -07:00
|
|
|
if (/* o->member_count > 1 && */
|
2012-05-06 19:11:35 -07:00
|
|
|
obj->cur.bounding_box.w == obj->prev.bounding_box.w &&
|
2012-05-02 20:58:27 -07:00
|
|
|
obj->cur.bounding_box.h == obj->prev.bounding_box.h &&
|
|
|
|
(obj->cur.bounding_box.x != obj->prev.bounding_box.x ||
|
|
|
|
obj->cur.bounding_box.y != obj->prev.bounding_box.y))
|
|
|
|
{
|
2012-07-04 02:39:23 -07:00
|
|
|
Eina_Bool cache_map = EINA_FALSE;
|
|
|
|
|
|
|
|
/* Check parent speed */
|
|
|
|
/* - same speed => do not map this object */
|
|
|
|
/* - different speed => map this object */
|
|
|
|
/* - if parent is mapped then map this object */
|
|
|
|
|
|
|
|
if (!obj->smart.parent || obj->smart.parent->child_has_map)
|
|
|
|
{
|
|
|
|
cache_map = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_evas_render_has_map(obj->smart.parent))
|
|
|
|
{
|
|
|
|
cache_map = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int speed_x, speed_y;
|
|
|
|
int speed_px, speed_py;
|
|
|
|
|
|
|
|
speed_x = obj->cur.geometry.x - obj->prev.geometry.x;
|
|
|
|
speed_y = obj->cur.geometry.y - obj->prev.geometry.y;
|
|
|
|
|
|
|
|
speed_px = obj->smart.parent->cur.geometry.x - obj->smart.parent->prev.geometry.x;
|
|
|
|
speed_py = obj->smart.parent->cur.geometry.y - obj->smart.parent->prev.geometry.y;
|
|
|
|
|
|
|
|
/* speed_x = obj->cur.bounding_box.x - obj->prev.bounding_box.x; */
|
|
|
|
/* speed_y = obj->cur.bounding_box.y - obj->prev.bounding_box.y; */
|
|
|
|
|
|
|
|
/* speed_px = obj->smart.parent->cur.bounding_box.x - obj->smart.parent->prev.bounding_box.x; */
|
|
|
|
/* speed_py = obj->smart.parent->cur.bounding_box.y - obj->smart.parent->prev.bounding_box.y; */
|
|
|
|
|
|
|
|
fprintf(stderr, "speed: '%s',%p (%i, %i) vs '%s',%p (%i, %i)\n",
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_type_get(eo_obj), obj, speed_x, speed_y,
|
2012-07-04 02:39:23 -07:00
|
|
|
evas_object_type_get(obj->smart.parent), obj->smart.parent, speed_px, speed_py);
|
|
|
|
|
|
|
|
if (speed_x != speed_px || speed_y != speed_py)
|
|
|
|
cache_map = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cache_map)
|
|
|
|
fprintf(stderr, "Wouhou, I can detect moving smart object (%s, %p [%i, %i, %i, %i] < %s, %p [%i, %i, %i, %i])\n",
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_type_get(eo_obj), obj,
|
2012-07-04 02:39:23 -07:00
|
|
|
obj->cur.bounding_box.x - obj->prev.bounding_box.x,
|
|
|
|
obj->cur.bounding_box.y - obj->prev.bounding_box.y,
|
|
|
|
obj->cur.bounding_box.w, obj->cur.bounding_box.h,
|
|
|
|
evas_object_type_get(obj->smart.parent), obj->smart.parent,
|
|
|
|
obj->smart.parent->cur.bounding_box.x - obj->smart.parent->prev.bounding_box.x,
|
|
|
|
obj->smart.parent->cur.bounding_box.y - obj->smart.parent->prev.bounding_box.y,
|
|
|
|
obj->smart.parent->cur.bounding_box.w, obj->smart.parent->cur.bounding_box.h);
|
|
|
|
|
|
|
|
obj->cur.cached_surface = cache_map;
|
2012-05-02 20:58:27 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2012-07-19 04:07:54 -07:00
|
|
|
|
2012-10-25 08:24:27 -07:00
|
|
|
if (obj->changed_map || obj->changed_src_visible)
|
2012-10-21 23:45:15 -07:00
|
|
|
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
|
|
|
|
eo_obj, obj);
|
2012-05-29 23:29:14 -07:00
|
|
|
|
|
|
|
obj->pre_render_done = EINA_TRUE;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_render_post(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_cur_prev(eo_obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2008-08-25 22:45:04 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static unsigned int evas_object_smart_id_get(Evas_Object *eo_obj)
|
2008-08-30 19:04:31 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2008-08-30 19:04:31 -07:00
|
|
|
if (!o) return 0;
|
|
|
|
return MAGIC_OBJ_SMART;
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static unsigned int evas_object_smart_visual_id_get(Evas_Object *eo_obj)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2008-08-25 22:45:04 -07:00
|
|
|
if (!o) return 0;
|
|
|
|
return MAGIC_OBJ_CONTAINER;
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void *evas_object_smart_engine_data_get(Evas_Object *eo_obj)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
|
2008-08-25 22:45:04 -07:00
|
|
|
if (!o) return NULL;
|
|
|
|
return o->engine_data;
|
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_class_constructor(Eo_Class *klass)
|
|
|
|
{
|
|
|
|
const Eo_Op_Func_Description func_desc[] = {
|
|
|
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_CHECK), _type_check),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DATA_SET), _smart_data_set),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_SMART_GET), _smart_smart_get),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD), _smart_member_add),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL), _smart_member_del),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET), _smart_members_get),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET), _smart_callbacks_descriptions_set),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET), _smart_callbacks_descriptions_get),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND), _smart_callback_description_find),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_SET), _smart_need_recalculate_set),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_GET), _smart_need_recalculate_get),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALCULATE), _smart_calculate),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CHANGED), _smart_changed),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SMART_DATA_GET), _smart_data_get),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ATTACH), _smart_attach),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _smart_add),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _smart_del),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_RESIZE), _smart_resize),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MOVE), _smart_move),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_SHOW), _smart_show),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_HIDE), _smart_hide),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_COLOR_SET), _smart_color_set),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CLIP_SET), _smart_clip_set),
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CLIP_UNSET), _smart_clip_unset),
|
|
|
|
EO_OP_FUNC_SENTINEL
|
|
|
|
};
|
|
|
|
|
|
|
|
eo_class_funcs_set(klass, func_desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Eo_Op_Description op_desc[] = {
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_DATA_SET, "Store a pointer to user data for a given smart object."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_SMART_GET, "Get the #Evas_Smart from which obj smart object was created."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD, "Set an Evas object as a member of a given smart object."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL, "Removes a member object from a given smart object."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET, "Retrieves the list of the member objects of a given Evas smart"),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET, "Set an smart object instance's smart callbacks descriptions."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET, "Retrieve an smart object's know smart callback descriptions (both"),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND, "Find callback description for callback called name."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_SET, "Set or unset the flag signalling that a given smart object needs to"),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_GET, "Get the value of the flag signalling that a given smart object needs to"),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALCULATE, "Call the calculate() smart function immediately on a given smart"),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CHANGED, "Mark smart object as changed, dirty."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_ATTACH, "Attach an object to a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_ADD, "Add an object to a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_DEL, "Remove an object from a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_RESIZE, "Resize an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MOVE, "Move an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_SHOW, "Show an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_HIDE, "Hide an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_COLOR_SET, "Set color of an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CLIP_SET, "Set a clipper of an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CLIP_UNSET, "Unset a clipper of an object on a canvas."),
|
|
|
|
EO_OP_DESCRIPTION_SENTINEL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const Eo_Class_Description class_desc = {
|
|
|
|
EO_VERSION,
|
|
|
|
MY_CLASS_NAME,
|
|
|
|
EO_CLASS_TYPE_REGULAR,
|
|
|
|
EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_SMART_BASE_ID, op_desc, EVAS_OBJ_SMART_SUB_ID_LAST),
|
|
|
|
NULL,
|
|
|
|
sizeof(Evas_Object_Smart),
|
|
|
|
_class_constructor,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
EO_DEFINE_CLASS(evas_object_smart_class_get, &class_desc, EVAS_OBJ_CLASS, EVAS_SMART_SIGNAL_INTERFACE, NULL);
|
|
|
|
|