1 #include <Elementary.h>
5 #include "elw_button.h"
9 EAPI Eobj_Op ELW_BUTTON_BASE_ID = 0;
11 EAPI const Eobj_Event_Description _SIG_CLICKED =
12 EOBJ_EVENT_DESCRIPTION("clicked", "", "Called when there was a click.");
19 static const Eobj_Class *_my_class = NULL;
22 _position_set(Eobj *obj, void *class_data __UNUSED__, va_list *list)
26 x = va_arg(*list, Evas_Coord);
27 y = va_arg(*list, Evas_Coord);
28 printf("But set position %d,%d\n", x, y);
29 eobj_do_super(obj, EVAS_OBJ_POSITION_SET(x, y));
33 _text_set(Eobj *obj __UNUSED__, void *class_data, va_list *list)
35 Widget_Data *wd = class_data;
37 text = va_arg(*list, const char *);
38 elm_object_text_set(wd->bt, text);
42 _btn_clicked(void *data, Evas_Object *evas_obj, void *event_info)
47 eobj_event_callback_call(obj, SIG_CLICKED, NULL);
51 _constructor(Eobj *obj, void *class_data)
53 eobj_constructor_super(obj);
55 Widget_Data *wd = class_data;
57 /* FIXME: An hack, because our tree is not yet only Eobj */
58 wd->bt = elm_button_add(eobj_evas_object_get(eobj_parent_get(obj)));
59 evas_object_size_hint_align_set(wd->bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
60 evas_object_size_hint_weight_set(wd->bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 evas_object_smart_callback_add(wd->bt, "clicked", _btn_clicked, obj);
63 eobj_evas_object_set(obj, wd->bt);
67 _destructor(Eobj *obj, void *class_data __UNUSED__)
69 eobj_destructor_super(obj);
71 //Widget_Data *wd = class_data;
72 /* FIXME: Commented out because it's automatically done because our tree
73 * is not made of only eobj */
74 //evas_object_del(wd->bt);
78 _class_constructor(Eobj_Class *klass)
80 const Eobj_Op_Func_Description func_desc[] = {
81 EOBJ_OP_FUNC(ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), _text_set),
82 EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set),
86 eobj_class_funcs_set(klass, func_desc);
90 elw_button_class_get(void)
92 if (_my_class) return _my_class;
94 static const Eobj_Op_Description op_desc[] = {
95 EOBJ_OP_DESCRIPTION(ELW_BUTTON_SUB_ID_TEXT_SET, "s", "Text of a text supporting evas object."), // FIXME: This ID sholudn't really be defined here...
96 EOBJ_OP_DESCRIPTION_SENTINEL
99 static const Eobj_Event_Description *event_desc[] = {
104 static const Eobj_Class_Description class_desc = {
106 EOBJ_CLASS_TYPE_REGULAR,
107 EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST),
116 return _my_class = eobj_class_new(&class_desc, EVAS_OBJ_CLASS, NULL);