1 #include <Elementary.h>
4 typedef struct _Widget_Data Widget_Data;
11 static const char *widtype = NULL;
12 static void _del_hook(Evas_Object *obj);
13 static void _theme_hook(Evas_Object *obj);
14 static void _sizing_eval(Evas_Object *obj);
15 static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
17 static const char SIG_CLICKED[] = "clicked";
19 static const Evas_Smart_Cb_Description _signals[] = {
26 _del_hook(Evas_Object *obj)
28 Widget_Data *wd = elm_widget_data_get(obj);
35 _del_pre_hook(Evas_Object *obj)
37 Widget_Data *wd = elm_widget_data_get(obj);
40 evas_object_del(wd->img);
44 _theme_hook(Evas_Object *obj)
46 Widget_Data *wd = elm_widget_data_get(obj);
53 _sizing_eval(Evas_Object *obj)
55 Widget_Data *wd = elm_widget_data_get(obj);
56 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
59 //TODO: get socket object size
60 evas_object_size_hint_min_set(obj, minw, minh);
61 evas_object_size_hint_max_set(obj, maxw, maxh);
65 _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
67 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
72 elm_plug_image_object_get(const Evas_Object *obj)
74 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
75 Widget_Data *wd = elm_widget_data_get(obj);
77 if (!wd->img) return NULL;
82 elm_plug_add(Evas_Object *parent)
89 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
91 ELM_SET_WIDTYPE(widtype, "plug");
92 elm_widget_type_set(obj, "plug");
93 elm_widget_sub_object_add(parent, obj);
94 elm_widget_data_set(obj, wd);
95 elm_widget_del_hook_set(obj, _del_hook);
96 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
97 elm_widget_theme_hook_set(obj, _theme_hook);
98 elm_widget_can_focus_set(obj, EINA_FALSE);
100 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
101 if (!ee) return NULL;
102 wd->img = ecore_evas_extn_plug_new(ee);
103 if (!wd->img) return NULL;
105 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
107 elm_widget_resize_object_set(obj, wd->img);
109 evas_object_smart_callbacks_descriptions_set(obj, _signals);
116 elm_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
118 Evas_Object *plug_img = NULL;
120 plug_img = elm_plug_image_object_get(obj);
121 if (!plug_img) return EINA_FALSE;
123 if (ecore_evas_extn_plug_connect(plug_img, svcname, svcnum, svcsys))