1 #include <Elementary.h>
5 #include "elw_button.h"
9 EAPI Eo_Op ELW_BUTTON_BASE_ID = 0;
11 EAPI const Eo_Event_Description _EV_CLICKED =
12 EO_EVENT_DESCRIPTION("clicked", "Called when there was a click.");
19 #define MY_CLASS ELW_BUTTON_CLASS
22 _position_set(Eo *obj, void *class_data EINA_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 eo_do_super(obj, evas_obj_position_set(x, y));
33 _text_set(Eo *obj EINA_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 eo_do(obj, eo_event_callback_call(EV_CLICKED, NULL, NULL));
51 _constructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
53 eo_do_super(obj, eo_constructor());
55 Widget_Data *wd = class_data;
57 /* FIXME: An hack, because our tree is not yet only Eo */
58 wd->bt = elm_button_add(eo_evas_object_get(eo_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 eo_evas_object_set(obj, wd->bt);
67 _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
69 eo_do_super(obj, eo_destructor());
71 //Widget_Data *wd = class_data;
72 /* FIXME: Commented out because it's automatically done because our tree
73 * is not made of only eo */
74 //evas_object_del(wd->bt);
78 _class_constructor(Eo_Class *klass)
80 const Eo_Op_Func_Description func_desc[] = {
81 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
82 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
83 EO_OP_FUNC(ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), _text_set),
84 EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set),
88 eo_class_funcs_set(klass, func_desc);
91 static const Eo_Op_Description op_desc[] = {
92 EO_OP_DESCRIPTION(ELW_BUTTON_SUB_ID_TEXT_SET, "Text of a text supporting evas object."), // FIXME: This ID sholudn't really be defined here...
93 EO_OP_DESCRIPTION_SENTINEL
96 static const Eo_Event_Description *event_desc[] = {
101 static const Eo_Class_Description class_desc = {
103 EO_CLASS_TYPE_REGULAR,
104 EO_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST),
111 EO_DEFINE_CLASS(elw_button_class_get, &class_desc, EVAS_OBJ_CLASS, NULL)