3 #define SMART_NAME "e_livethumb"
4 #define API_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
5 #define INTERNAL_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
6 typedef struct _E_Smart_Data E_Smart_Data;
7 typedef struct _E_Smart_Item E_Smart_Item;
11 Evas_Coord x, y, w, h;
13 Evas_Object *smart_obj;
14 Evas_Object *evas_obj;
15 Evas_Object *thumb_obj;
20 /* local subsystem functions */
21 static void _e_smart_reconfigure(E_Smart_Data *sd);
22 static void _e_smart_add(Evas_Object *obj);
23 static void _e_smart_del(Evas_Object *obj);
24 static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
25 static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
26 static void _e_smart_show(Evas_Object *obj);
27 static void _e_smart_hide(Evas_Object *obj);
28 static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
29 static void _e_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
30 static void _e_smart_clip_unset(Evas_Object *obj);
31 static void _e_smart_init(void);
33 /* local subsystem globals */
34 static Evas_Smart *_e_smart = NULL;
36 /* externally accessible functions */
38 e_livethumb_add(Evas *e)
41 return evas_object_smart_add(e, _e_smart);
45 e_livethumb_evas_get(Evas_Object *obj)
47 API_ENTRY return NULL;
52 e_livethumb_vsize_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
55 if ((w == sd->vw) && (h == sd->vh)) return;
58 evas_object_image_size_set(sd->evas_obj, sd->vw, sd->vh);
59 if (sd->thumb_obj) evas_object_resize(sd->thumb_obj, sd->vw, sd->vh);
63 e_livethumb_vsize_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
71 e_livethumb_thumb_set(Evas_Object *obj, Evas_Object *thumb)
79 sd->thumb_obj = thumb;
80 evas_object_show(sd->thumb_obj);
81 evas_object_move(sd->thumb_obj, 0, 0);
82 evas_object_resize(sd->thumb_obj, sd->vw, sd->vh);
86 e_livethumb_thumb_get(Evas_Object *obj)
88 API_ENTRY return NULL;
92 /* local subsystem functions */
95 _e_smart_reconfigure(E_Smart_Data *sd)
97 evas_object_move(sd->evas_obj, sd->x, sd->y);
98 evas_object_resize(sd->evas_obj, sd->w, sd->h);
99 evas_object_image_fill_set(sd->evas_obj, 0, 0, sd->w, sd->h);
103 _e_smart_add(Evas_Object *obj)
107 sd = calloc(1, sizeof(E_Smart_Data));
109 evas_object_smart_data_set(obj, sd);
119 sd->evas_obj = ecore_evas_object_image_new(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)));
120 ecore_evas_alpha_set(evas_object_data_get(sd->evas_obj, "Ecore_Evas"), 1);
121 evas_object_smart_member_add(sd->evas_obj, obj);
122 evas_object_image_size_set(sd->evas_obj, sd->vw, sd->vh);
123 sd->evas = ecore_evas_get(evas_object_data_get(sd->evas_obj, "Ecore_Evas"));
124 e_canvas_add(evas_object_data_get(sd->evas_obj, "Ecore_Evas"));
128 _e_smart_del(Evas_Object *obj)
131 e_canvas_del(evas_object_data_get(sd->evas_obj, "Ecore_Evas"));
132 evas_object_del(sd->evas_obj);
137 _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
140 if ((sd->x == x) && (sd->y == y)) return;
143 _e_smart_reconfigure(sd);
147 _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
150 if ((sd->w == w) && (sd->h == h)) return;
153 _e_smart_reconfigure(sd);
157 _e_smart_show(Evas_Object *obj)
160 evas_object_show(sd->evas_obj);
164 _e_smart_hide(Evas_Object *obj)
167 evas_object_hide(sd->evas_obj);
171 _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
174 evas_object_color_set(sd->evas_obj, r, g, b, a);
178 _e_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
181 evas_object_clip_set(sd->evas_obj, clip);
185 _e_smart_clip_unset(Evas_Object *obj)
188 evas_object_clip_unset(sd->evas_obj);
191 /* never need to touch this */
196 if (_e_smart) return;
198 static const Evas_Smart_Class sc =
201 EVAS_SMART_CLASS_VERSION,
219 _e_smart = evas_smart_class_new(&sc);