2005-02-07 05:51:09 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2004-11-24 19:37:45 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
|
|
|
typedef struct _E_Smart_Data E_Smart_Data;
|
|
|
|
|
|
|
|
struct _E_Smart_Data
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Object *obj;
|
2008-02-05 04:00:19 -08:00
|
|
|
int size;
|
2008-07-19 07:09:46 -07:00
|
|
|
unsigned char fill_inside : 1;
|
|
|
|
unsigned char scale_up : 1;
|
2009-04-04 20:49:16 -07:00
|
|
|
unsigned char preload : 1;
|
2009-10-21 23:47:02 -07:00
|
|
|
unsigned char loading : 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* local subsystem functions */
|
|
|
|
static void _e_icon_smart_reconfigure(E_Smart_Data *sd);
|
|
|
|
static void _e_icon_smart_init(void);
|
|
|
|
static void _e_icon_smart_add(Evas_Object *obj);
|
|
|
|
static void _e_icon_smart_del(Evas_Object *obj);
|
|
|
|
static void _e_icon_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
|
|
|
static void _e_icon_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
|
|
|
static void _e_icon_smart_show(Evas_Object *obj);
|
|
|
|
static void _e_icon_smart_hide(Evas_Object *obj);
|
|
|
|
static void _e_icon_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
|
|
|
|
static void _e_icon_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
|
|
|
|
static void _e_icon_smart_clip_unset(Evas_Object *obj);
|
2009-05-15 04:47:28 -07:00
|
|
|
static void _e_icon_obj_prepare(Evas_Object *obj, E_Smart_Data *sd);
|
|
|
|
static void _e_icon_preloaded(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
2004-11-24 19:37:45 -08:00
|
|
|
|
|
|
|
/* local subsystem globals */
|
|
|
|
static Evas_Smart *_e_smart = NULL;
|
|
|
|
|
|
|
|
/* externally accessible functions */
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI Evas_Object *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_add(Evas *evas)
|
|
|
|
{
|
|
|
|
_e_icon_smart_init();
|
|
|
|
return evas_object_smart_add(evas, _e_smart);
|
|
|
|
}
|
|
|
|
|
2009-05-15 04:47:28 -07:00
|
|
|
static void
|
|
|
|
_e_icon_obj_prepare(Evas_Object *obj, E_Smart_Data *sd)
|
|
|
|
{
|
|
|
|
if (!sd->obj) return;
|
|
|
|
|
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
|
|
|
{
|
|
|
|
evas_object_del(sd->obj);
|
|
|
|
sd->obj = evas_object_image_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED,
|
|
|
|
_e_icon_preloaded, obj);
|
|
|
|
evas_object_smart_member_add(sd->obj, obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_file_set(Evas_Object *obj, const char *file)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
/* smart code here */
|
2009-05-15 04:47:28 -07:00
|
|
|
_e_icon_obj_prepare(obj, sd);
|
2008-02-05 04:00:19 -08:00
|
|
|
/* FIXME: 64x64 - unhappy about this. use icon size */
|
2009-10-21 23:47:02 -07:00
|
|
|
sd->loading = 0;
|
2008-02-05 04:00:19 -08:00
|
|
|
if (sd->size != 0)
|
|
|
|
evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
|
2009-10-21 23:47:02 -07:00
|
|
|
if (sd->preload)
|
|
|
|
evas_object_hide(sd->obj);
|
2004-11-24 19:37:45 -08:00
|
|
|
evas_object_image_file_set(sd->obj, file, NULL);
|
2009-10-21 23:47:02 -07:00
|
|
|
if (sd->preload)
|
|
|
|
{
|
|
|
|
sd->loading = 1;
|
|
|
|
evas_object_image_preload(sd->obj, 0);
|
|
|
|
}
|
|
|
|
else if (evas_object_visible_get(obj))
|
|
|
|
evas_object_show(sd->obj);
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2005-10-20 08:07:45 -07:00
|
|
|
e_icon_file_key_set(Evas_Object *obj, const char *file, const char *key)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2005-10-20 08:07:45 -07:00
|
|
|
/* smart code here */
|
2009-10-21 23:47:02 -07:00
|
|
|
sd->loading = 0;
|
2009-05-15 04:47:28 -07:00
|
|
|
_e_icon_obj_prepare(obj, sd);
|
2008-02-05 04:00:19 -08:00
|
|
|
if (sd->size != 0)
|
|
|
|
evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
|
2009-10-21 23:47:02 -07:00
|
|
|
if (sd->preload)
|
|
|
|
evas_object_hide(sd->obj);
|
2005-10-20 08:07:45 -07:00
|
|
|
evas_object_image_file_set(sd->obj, file, key);
|
2009-10-21 23:47:02 -07:00
|
|
|
if (sd->preload)
|
|
|
|
{
|
|
|
|
sd->loading = 1;
|
|
|
|
evas_object_image_preload(sd->obj, 0);
|
|
|
|
}
|
|
|
|
else if (evas_object_visible_get(obj))
|
|
|
|
evas_object_show(sd->obj);
|
2005-10-20 08:07:45 -07:00
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2005-11-03 19:33:23 -08:00
|
|
|
e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2005-11-03 19:33:23 -08:00
|
|
|
/* smart code here */
|
2005-11-04 12:36:05 -08:00
|
|
|
if (sd->obj) evas_object_del(sd->obj);
|
2009-10-21 23:47:02 -07:00
|
|
|
sd->loading = 0;
|
2005-11-03 19:33:23 -08:00
|
|
|
sd->obj = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
edje_object_file_set(sd->obj, file, part);
|
2009-10-21 23:47:02 -07:00
|
|
|
if (evas_object_visible_get(obj))
|
|
|
|
evas_object_show(sd->obj);
|
2006-01-12 18:11:11 -08:00
|
|
|
evas_object_smart_member_add(sd->obj, obj);
|
2005-11-03 19:33:23 -08:00
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2005-11-22 01:27:25 -08:00
|
|
|
e_icon_object_set(Evas_Object *obj, Evas_Object *o)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2005-11-22 01:27:25 -08:00
|
|
|
/* smart code here */
|
|
|
|
if (sd->obj) evas_object_del(sd->obj);
|
2009-10-21 23:47:02 -07:00
|
|
|
sd->loading = 0;
|
2005-11-22 01:27:25 -08:00
|
|
|
sd->obj = o;
|
2006-01-12 18:11:11 -08:00
|
|
|
evas_object_smart_member_add(sd->obj, obj);
|
2009-10-21 23:47:02 -07:00
|
|
|
if (evas_object_visible_get(obj))
|
|
|
|
evas_object_show(sd->obj);
|
2005-11-22 01:27:25 -08:00
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI const char *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_file_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
2006-05-31 11:41:37 -07:00
|
|
|
const char *file;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2005-11-03 19:33:23 -08:00
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return NULL;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
2005-11-03 19:33:23 -08:00
|
|
|
{
|
2006-05-31 11:41:37 -07:00
|
|
|
edje_object_file_get(sd->obj, &file, NULL);
|
2005-11-03 19:33:23 -08:00
|
|
|
return file;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
evas_object_image_file_get(sd->obj, &file, NULL);
|
|
|
|
return file;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_smooth_scale_set(Evas_Object *obj, int smooth)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
2005-11-03 19:33:23 -08:00
|
|
|
return;
|
2004-11-24 19:37:45 -08:00
|
|
|
evas_object_image_smooth_scale_set(sd->obj, smooth);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_smooth_scale_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
2005-11-04 12:36:05 -08:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return 0;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
|
|
|
return 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
return evas_object_image_smooth_scale_get(sd->obj);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2005-06-02 23:43:23 -07:00
|
|
|
e_icon_alpha_set(Evas_Object *obj, int alpha)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
2005-11-03 19:33:23 -08:00
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
2005-11-03 19:33:23 -08:00
|
|
|
return;
|
2005-06-02 23:43:23 -07:00
|
|
|
evas_object_image_alpha_set(sd->obj, alpha);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2005-06-02 23:43:23 -07:00
|
|
|
e_icon_alpha_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
2005-11-03 19:33:23 -08:00
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return 0;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
|
|
|
return 0;
|
2005-06-02 23:43:23 -07:00
|
|
|
return evas_object_image_alpha_get(sd->obj);
|
|
|
|
}
|
|
|
|
|
2009-04-04 20:49:16 -07:00
|
|
|
EAPI void
|
|
|
|
e_icon_preload_set(Evas_Object *obj, int preload)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
sd->preload = preload;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
e_icon_preload_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return 0;
|
|
|
|
return sd->preload;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_size_get(Evas_Object *obj, int *w, int *h)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
return evas_object_image_size_get(sd->obj, w, h);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_fill_inside_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (sd->fill_inside) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_icon_fill_inside_set(Evas_Object *obj, int fill_inside)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (((sd->fill_inside) && (fill_inside)) ||
|
|
|
|
((!sd->fill_inside) && (!fill_inside))) return;
|
|
|
|
sd->fill_inside = fill_inside;
|
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
2008-07-19 07:09:46 -07:00
|
|
|
EAPI int
|
|
|
|
e_icon_scale_up_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (sd->scale_up) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
e_icon_scale_up_set(Evas_Object *obj, int scale_up)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
if (((sd->scale_up) && (scale_up)) ||
|
|
|
|
((!sd->scale_up) && (!scale_up))) return;
|
|
|
|
sd->scale_up = scale_up;
|
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2005-06-02 23:43:23 -07:00
|
|
|
e_icon_data_set(Evas_Object *obj, void *data, int w, int h)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
2005-11-03 19:33:23 -08:00
|
|
|
return;
|
2005-06-02 23:43:23 -07:00
|
|
|
evas_object_image_size_set(sd->obj, w, h);
|
|
|
|
evas_object_image_data_copy_set(sd->obj, data);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void *
|
2005-09-26 02:13:44 -07:00
|
|
|
e_icon_data_get(Evas_Object *obj, int *w, int *h)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2005-12-19 06:42:43 -08:00
|
|
|
if (!sd) return NULL;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
|
|
|
return NULL;
|
2005-09-26 02:13:44 -07:00
|
|
|
evas_object_image_size_get(sd->obj, w, h);
|
|
|
|
return evas_object_image_data_get(sd->obj, 0);
|
|
|
|
}
|
|
|
|
|
2008-02-05 04:00:19 -08:00
|
|
|
EAPI void
|
|
|
|
e_icon_scale_size_set(Evas_Object *obj, int size)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2008-02-08 15:03:28 -08:00
|
|
|
if (!sd) return;
|
2008-02-05 04:00:19 -08:00
|
|
|
sd->size = size;
|
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
|
|
|
return;
|
|
|
|
evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
e_icon_scale_size_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
2008-02-08 15:03:28 -08:00
|
|
|
if (!sd) return 0;
|
2008-02-05 04:00:19 -08:00
|
|
|
return sd->size;
|
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
/* local subsystem globals */
|
|
|
|
static void
|
|
|
|
_e_icon_smart_reconfigure(E_Smart_Data *sd)
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2007-07-15 17:50:50 -07:00
|
|
|
if (!sd->obj) return;
|
2005-11-04 12:36:05 -08:00
|
|
|
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
w = sd->w;
|
2006-01-12 18:11:11 -08:00
|
|
|
h = sd->h;
|
|
|
|
x = sd->x;
|
|
|
|
y = sd->y;
|
|
|
|
evas_object_move(sd->obj, x, y);
|
|
|
|
evas_object_resize(sd->obj, w, h);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-12 18:11:11 -08:00
|
|
|
ih = 0;
|
|
|
|
ih = 0;
|
|
|
|
evas_object_image_size_get(sd->obj, &iw, &ih);
|
|
|
|
if (iw < 1) iw = 1;
|
|
|
|
if (ih < 1) ih = 1;
|
|
|
|
|
|
|
|
if (sd->fill_inside)
|
|
|
|
{
|
|
|
|
w = sd->w;
|
|
|
|
h = ((double)ih * w) / (double)iw;
|
|
|
|
if (h > sd->h)
|
|
|
|
{
|
|
|
|
h = sd->h;
|
|
|
|
w = ((double)iw * h) / (double)ih;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2006-01-12 18:11:11 -08:00
|
|
|
w = sd->w;
|
|
|
|
h = ((double)ih * w) / (double)iw;
|
|
|
|
if (h < sd->h)
|
|
|
|
{
|
|
|
|
h = sd->h;
|
|
|
|
w = ((double)iw * h) / (double)ih;
|
|
|
|
}
|
|
|
|
}
|
2008-07-19 07:09:46 -07:00
|
|
|
if (!sd->scale_up)
|
|
|
|
{
|
|
|
|
if ((w > iw) || (h > ih))
|
|
|
|
{
|
|
|
|
w = iw;
|
|
|
|
h = ih;
|
|
|
|
}
|
|
|
|
}
|
2006-01-12 18:11:11 -08:00
|
|
|
x = sd->x + ((sd->w - w) / 2);
|
|
|
|
y = sd->y + ((sd->h - h) / 2);
|
|
|
|
evas_object_move(sd->obj, x, y);
|
|
|
|
evas_object_image_fill_set(sd->obj, 0, 0, w, h);
|
|
|
|
evas_object_resize(sd->obj, w, h);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_init(void)
|
|
|
|
{
|
|
|
|
if (_e_smart) return;
|
2007-08-04 06:12:43 -07:00
|
|
|
{
|
|
|
|
static const Evas_Smart_Class sc =
|
|
|
|
{
|
|
|
|
"e_icon",
|
|
|
|
EVAS_SMART_CLASS_VERSION,
|
|
|
|
_e_icon_smart_add,
|
|
|
|
_e_icon_smart_del,
|
|
|
|
_e_icon_smart_move,
|
|
|
|
_e_icon_smart_resize,
|
|
|
|
_e_icon_smart_show,
|
|
|
|
_e_icon_smart_hide,
|
|
|
|
_e_icon_smart_color_set,
|
|
|
|
_e_icon_smart_clip_set,
|
|
|
|
_e_icon_smart_clip_unset,
|
2008-09-06 18:25:49 -07:00
|
|
|
NULL,
|
2008-10-24 20:13:33 -07:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2007-08-04 06:12:43 -07:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
_e_smart = evas_smart_class_new(&sc);
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2009-04-04 20:49:16 -07:00
|
|
|
static void
|
|
|
|
_e_icon_preloaded(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
2009-10-21 23:47:02 -07:00
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(data);
|
2009-04-04 20:49:16 -07:00
|
|
|
evas_object_smart_callback_call(data, "preloaded", NULL);
|
2009-10-21 23:47:02 -07:00
|
|
|
evas_object_show(sd->obj);
|
|
|
|
sd->loading = 0;
|
2009-04-04 20:49:16 -07:00
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
|
|
|
_e_icon_smart_add(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = calloc(1, sizeof(E_Smart_Data));
|
|
|
|
if (!sd) return;
|
|
|
|
sd->obj = evas_object_image_add(evas_object_evas_get(obj));
|
2009-04-04 20:49:16 -07:00
|
|
|
evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED,
|
|
|
|
_e_icon_preloaded, obj);
|
2004-11-24 19:37:45 -08:00
|
|
|
sd->x = 0;
|
|
|
|
sd->y = 0;
|
|
|
|
sd->w = 0;
|
|
|
|
sd->h = 0;
|
|
|
|
sd->fill_inside = 1;
|
2008-07-19 07:09:46 -07:00
|
|
|
sd->scale_up = 1;
|
2008-02-05 04:00:19 -08:00
|
|
|
sd->size = 64;
|
2004-11-24 19:37:45 -08:00
|
|
|
evas_object_smart_member_add(sd->obj, obj);
|
|
|
|
evas_object_smart_data_set(obj, sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_del(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
evas_object_del(sd->obj);
|
|
|
|
free(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
2006-07-17 12:51:37 -07:00
|
|
|
if ((sd->x == x) && (sd->y == y)) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
sd->x = x;
|
|
|
|
sd->y = y;
|
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
2006-07-17 12:51:37 -07:00
|
|
|
if ((sd->w == w) && (sd->h == h)) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
sd->w = w;
|
|
|
|
sd->h = h;
|
|
|
|
_e_icon_smart_reconfigure(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_show(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
2009-10-21 23:47:02 -07:00
|
|
|
if (!((sd->preload) && (sd->loading)))
|
|
|
|
evas_object_show(sd->obj);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_hide(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
evas_object_hide(sd->obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
evas_object_color_set(sd->obj, r, g, b, a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
evas_object_clip_set(sd->obj, clip);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_icon_smart_clip_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Smart_Data *sd;
|
|
|
|
|
|
|
|
sd = evas_object_smart_data_get(obj);
|
|
|
|
if (!sd) return;
|
|
|
|
evas_object_clip_unset(sd->obj);
|
|
|
|
}
|