2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
#include "Evas.h"
|
|
|
|
|
|
|
|
/* all public */
|
2003-03-04 18:30:20 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
2002-11-08 00:02:15 -08:00
|
|
|
Evas_Smart *
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_smart_new(const char *name,
|
|
|
|
void (*func_add) (Evas_Object *o),
|
|
|
|
void (*func_del) (Evas_Object *o),
|
|
|
|
void (*func_layer_set) (Evas_Object *o, int l),
|
|
|
|
void (*func_raise) (Evas_Object *o),
|
|
|
|
void (*func_lower) (Evas_Object *o),
|
|
|
|
void (*func_stack_above) (Evas_Object *o, Evas_Object *above),
|
|
|
|
void (*func_stack_below) (Evas_Object *o, Evas_Object *below),
|
2003-10-17 20:34:00 -07:00
|
|
|
void (*func_move) (Evas_Object *o, Evas_Coord x, Evas_Coord y),
|
|
|
|
void (*func_resize) (Evas_Object *o, Evas_Coord w, Evas_Coord h),
|
2003-01-09 20:58:51 -08:00
|
|
|
void (*func_show) (Evas_Object *o),
|
|
|
|
void (*func_hide) (Evas_Object *o),
|
|
|
|
void (*func_color_set) (Evas_Object *o, int r, int g, int b, int a),
|
|
|
|
void (*func_clip_set) (Evas_Object *o, Evas_Object *clip),
|
|
|
|
void (*func_clip_unset) (Evas_Object *o),
|
|
|
|
const void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Smart *s;
|
|
|
|
|
|
|
|
if (!name) return NULL;
|
|
|
|
|
2003-01-09 20:58:51 -08:00
|
|
|
s = evas_mem_calloc(sizeof(Evas_Smart));
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!s) return NULL;
|
|
|
|
|
|
|
|
s->magic = MAGIC_SMART;
|
|
|
|
|
2003-10-08 20:05:17 -07:00
|
|
|
s->class_allocated = 1;
|
|
|
|
|
|
|
|
s->smart_class = evas_mem_calloc(sizeof(Evas_Smart_Class));
|
|
|
|
if (!s->smart_class)
|
2003-01-09 20:58:51 -08:00
|
|
|
{
|
|
|
|
free(s);
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-10-08 20:05:17 -07:00
|
|
|
s->smart_class->name = name;
|
|
|
|
s->smart_class->add = func_add;
|
|
|
|
s->smart_class->del = func_del;
|
|
|
|
s->smart_class->layer_set = func_layer_set;
|
|
|
|
s->smart_class->raise = func_raise;
|
|
|
|
s->smart_class->lower = func_lower;
|
|
|
|
s->smart_class->stack_above = func_stack_above;
|
|
|
|
s->smart_class->stack_below = func_stack_below;
|
|
|
|
s->smart_class->move = func_move;
|
|
|
|
s->smart_class->resize = func_resize;
|
|
|
|
s->smart_class->show = func_show;
|
|
|
|
s->smart_class->hide = func_hide;
|
|
|
|
s->smart_class->color_set = func_color_set;
|
|
|
|
s->smart_class->clip_set = func_clip_set;
|
|
|
|
s->smart_class->clip_unset = func_clip_unset;
|
|
|
|
s->smart_class->data = (void *)data;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
2002-11-08 00:02:15 -08:00
|
|
|
void
|
|
|
|
evas_smart_free(Evas_Smart *s)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
s->delete_me = 1;
|
|
|
|
if (s->usage > 0) return;
|
2003-10-08 20:05:17 -07:00
|
|
|
if (s->class_allocated) free(s->smart_class);
|
2002-11-08 00:02:15 -08:00
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
|
2003-10-08 20:05:17 -07:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
Evas_Smart *
|
|
|
|
evas_smart_class_new(Evas_Smart_Class *sc)
|
|
|
|
{
|
|
|
|
Evas_Smart *s;
|
|
|
|
|
|
|
|
if (!sc) return NULL;
|
|
|
|
|
|
|
|
s = evas_mem_calloc(sizeof(Evas_Smart));
|
|
|
|
if (!s) return NULL;
|
|
|
|
|
|
|
|
s->magic = MAGIC_SMART;
|
|
|
|
|
|
|
|
s->smart_class = sc;
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
Evas_Smart_Class *
|
|
|
|
evas_smart_class_get(Evas_Smart *s)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return s->smart_class;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
|
|
|
* To be documented.
|
|
|
|
*
|
|
|
|
* FIXME: To be fixed.
|
|
|
|
*
|
|
|
|
*/
|
2002-11-08 00:02:15 -08:00
|
|
|
void *
|
|
|
|
evas_smart_data_get(Evas_Smart *s)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
2003-10-17 20:34:00 -07:00
|
|
|
return (void *)s->smart_class->data;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* internal funcs */
|
|
|
|
void
|
|
|
|
evas_object_smart_use(Evas_Smart *s)
|
|
|
|
{
|
|
|
|
s->usage++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_object_smart_unuse(Evas_Smart *s)
|
|
|
|
{
|
|
|
|
s->usage--;
|
2004-02-01 17:33:46 -08:00
|
|
|
if ((s->usage <= 0) && (s->delete_me)) evas_smart_free(s);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|