diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-08-14 14:31:58 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-08-14 14:31:58 +0200 |
commit | 40884a0698577db6e85aa1fd5c7ff4cede3cb886 (patch) | |
tree | eee1ec60c7980dd16e87158c9fa7f2e8315d4552 | |
parent | 9134342b9ecfc3740c9af9f3604f3e24a5fc1d19 (diff) | |
download | efl-40884a0698577db6e85aa1fd5c7ff4cede3cb886.tar.gz |
eo2_simple: add eo2_set_evt and associated event EO2_EV_X_CHANGED
-rw-r--r-- | eo2test/eo2_simple.c | 20 | ||||
-rw-r--r-- | eo2test/eo2_simple.h | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/eo2test/eo2_simple.c b/eo2test/eo2_simple.c index b5d93bd1f1..bf63797690 100644 --- a/eo2test/eo2_simple.c +++ b/eo2test/eo2_simple.c @@ -1,6 +1,9 @@ #include "Eo.h" #include "eo2_simple.h" +EAPI const Eo_Event_Description _EO2_EV_X_CHANGED = + EO_EVENT_DESCRIPTION("x,changed", "Called when x has changed."); + typedef struct { int x; @@ -33,6 +36,15 @@ _set(Eo *obj EINA_UNUSED, void *obj_data, int x) EAPI EO2_VOID_FUNC_BODYV(eo2_set, EO2_FUNC_CALL(x), int x); static void +_set_evt(Eo *obj, void *obj_data, int x) +{ + Private_Data *data = (Private_Data *) obj_data; + data->x = x; + eo2_do(obj, eo2_event_callback_call(EO2_EV_X_CHANGED, &data->x); ); +} +EAPI EO2_VOID_FUNC_BODYV(eo2_set_evt, EO2_FUNC_CALL(x), int x); + +static void _class_hello(const Eo_Class *klass, int a) { printf("Hello %d - body %s - EAPI %s\n", a, eo_class_name_get(klass), eo_class_name_get(EO2_SIMPLE_CLASS)); @@ -64,17 +76,23 @@ static Eo2_Op_Description op_descs [] = { EO2_OP_FUNC(_inc, eo2_inc, "Inc X"), EO2_OP_FUNC(_get, eo2_get, "Get X"), EO2_OP_FUNC(_set, eo2_set, "Set X"), + EO2_OP_FUNC(_set_evt, eo2_set_evt, "Set X + event"), EO2_OP_CLASS_FUNC(_class_hello, eo2_class_hello, "Class says hello"), EO2_OP_FUNC(NULL, eo2_virtual, "Virtual Func"), EO2_OP_SENTINEL }; +static const Eo_Event_Description *event_desc[] = { + EO2_EV_X_CHANGED, + NULL +}; + static const Eo_Class_Description class_desc = { EO2_VERSION, "Eo2 Simple", EO_CLASS_TYPE_REGULAR, EO2_CLASS_DESCRIPTION_OPS(op_descs), - NULL, + event_desc, sizeof(Private_Data), NULL, NULL diff --git a/eo2test/eo2_simple.h b/eo2test/eo2_simple.h index 53a1706730..59b0891ec5 100644 --- a/eo2test/eo2_simple.h +++ b/eo2test/eo2_simple.h @@ -9,12 +9,17 @@ EAPI int eo2_get(); EAPI void eo2_set(int x); +EAPI void eo2_set_evt(int x); + EAPI int eo2_virtual(int in); EAPI void eo2_class_hello(int a); EAPI void eo2_simple_constructor(int x); +extern const Eo_Event_Description _EO2_EV_X_CHANGED; +#define EO2_EV_X_CHANGED (&(_EO2_EV_X_CHANGED)) + EAPI const Eo_Class *eo2_simple_class_get(void); #define EO2_SIMPLE_CLASS eo2_simple_class_get() |