merge: add eo

SVN revision: 77072
This commit is contained in:
Vincent Torri 2012-09-26 06:56:52 +00:00
parent af4359f59b
commit 30f1c531ec
29 changed files with 1378 additions and 1 deletions

View File

@ -1,15 +1,21 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = eina eet
SUBDIRS = eina eet eo
examples:
@$(MAKE) $(AM_MAKEFLAGS) -C eina examples
if EFL_BUILD_EET
@$(MAKE) $(AM_MAKEFLAGS) -C eet examples
endif
if EFL_BUILD_EO
@$(MAKE) $(AM_MAKEFLAGS) -C eo examples
endif
install-examples:
@$(MAKE) $(AM_MAKEFLAGS) -C eina install-examples
if EFL_BUILD_EET
@$(MAKE) $(AM_MAKEFLAGS) -C eet install-examples
endif
if EFL_BUILD_EO
@$(MAKE) $(AM_MAKEFLAGS) -C eo install-examples
endif

83
eo/Makefile.am Normal file
View File

@ -0,0 +1,83 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = \
-I. \
-I$(top_srcdir)/src/lib/eo \
-I$(top_builddir)/src/lib/eo \
@EFL_EO_BUILD@ \
@EO_CFLAGS@
EXTRA_PROGRAMS = eo_isa eo_simple
if EO_BUILD_EXAMPLE_EVAS
EXTRA_PROGRAMS += eo_evas
endif
eo_isa_SOURCES = \
isa/eo_isa_complex.c \
isa/eo_isa_complex.h \
isa/eo_isa_interface.c \
isa/eo_isa_interface.h \
isa/eo_isa_main.c \
isa/eo_isa_mixin.c \
isa/eo_isa_mixin.h \
isa/eo_isa_simple.c \
isa/eo_isa_simple.h
eo_isa_LDADD = $(top_builddir)/src/lib/eo/libeo.la @EO_LIBS@
if EO_BUILD_EXAMPLE_EVAS
eo_evas_SOURCES = \
evas/evas_elw_box.c \
evas/evas_elw_box.h \
evas/evas_elw_boxedbutton.c \
evas/evas_elw_boxedbutton.h \
evas/evas_elw_button.c \
evas/evas_elw_button.h \
evas/evas_elw_win.h \
evas/evas_elw_win.c \
evas/evas_evas_obj.c \
evas/evas_evas_obj.h \
evas/evas_test.c
eo_evas_LDADD = $(top_builddir)/src/lib/eo/libeo.la @ELM_LIBS@ @EO_LIBS@
endif
eo_simple_SOURCES = \
simple/simple_interface.c \
simple/simple_interface.h \
simple/simple_main.c \
simple/simple_mixin.c \
simple/simple_mixin.h \
simple/simple_simple.c \
simple/simple_simple.h
eo_simple_LDADD = $(top_builddir)/src/lib/eo/libeo.la @EO_LIBS@
examples: $(EXTRA_PROGRAMS)
clean-local:
rm -f $(EXTRA_PROGRAMS)
install-examples:
mkdir -p $(pkgdatadir)/examples/eo/isa
$(install_sh_DATA) -c $(eo_isa_SOURCES) $(pkgdatadir)/examples/eo/isa
mkdir -p $(pkgdatadir)/examples/eo/evas
$(install_sh_DATA) -c $(evas_SOURCES) $(pkgdatadir)/examples/eo/evas
mkdir -p $(pkgdatadir)/examples/eo/simple
$(install_sh_DATA) -c $(simple_SOURCES) $(pkgdatadir)/examples/eo/simple
uninstall-local:
for f in $(eo_isa_SOURCES) ; do \
rm -f $(pkgdatadir)/examples/eo/isa/$$f ; \
done
for f in $(evas_SOURCES) ; do \
rm -f $(pkgdatadir)/examples/eo/evas/$$f ; \
done
for f in $(simple_SOURCES) ; do \
rm -f $(pkgdatadir)/examples/eo/simple/$$f ; \
done

74
eo/evas/evas_elw_box.c Normal file
View File

@ -0,0 +1,74 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include "Eo.h"
#include "evas_obj.h"
#include "elw_box.h"
EAPI Eo_Op ELW_BOX_BASE_ID = 0;
typedef struct
{
Evas_Object *bx;
} Widget_Data;
#define MY_CLASS ELW_BOX_CLASS
static void
_pack_end(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
Widget_Data *wd = class_data;
Eo *child_obj;
child_obj = va_arg(*list, Eo *);
/* FIXME: Ref and the later uref child_obj here... */
elm_box_pack_end(wd->bx, eo_evas_object_get(child_obj));
}
static void
_constructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_constructor());
Widget_Data *wd = class_data;
/* FIXME: An hack, because our tree is not yet only Eo */
wd->bx = elm_box_add(eo_evas_object_get(eo_parent_get(obj)));
evas_object_size_hint_align_set(wd->bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(wd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
eo_evas_object_set(obj, wd->bx);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), _pack_end),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(ELW_BOX_SUB_ID_PACK_END, "Pack obj at the end of box."),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Elw Box",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&ELW_BOX_BASE_ID, op_desc, ELW_BOX_SUB_ID_LAST),
NULL,
sizeof(Widget_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(elw_box_class_get, &class_desc, EXEVAS_OBJ_CLASS, NULL)

25
eo/evas/evas_elw_box.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef ELW_BOX_H
#define ELW_BOX_H
#include "Eo.h"
extern EAPI Eo_Op ELW_BOX_BASE_ID;
enum {
ELW_BOX_SUB_ID_PACK_END,
ELW_BOX_SUB_ID_LAST
};
#define ELW_BOX_ID(sub_id) (ELW_BOX_BASE_ID + sub_id)
/**
* @def elw_box_pack_end(obj)
* @brief Pack object to the end of the box
* @param[in] obj object to pack into box
*/
#define elw_box_pack_end(obj) ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), EO_TYPECHECK(Eo *, obj)
#define ELW_BOX_CLASS elw_box_class_get()
const Eo_Class *elw_box_class_get(void);
#endif

View File

@ -0,0 +1,57 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include "Eo.h"
#include "evas_obj.h"
#include "elw_box.h"
#include "elw_button.h"
#include "elw_boxedbutton.h"
typedef struct
{
// Evas_Object *bx;
} Widget_Data;
#define MY_CLASS ELW_BOXEDBUTTON_CLASS
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_constructor());
Eo *bt = eo_add(ELW_BUTTON_CLASS, obj);
eo_composite_attach(bt, obj);
eo_do(bt, eo_event_callback_forwarder_add(EV_CLICKED, obj));
eo_do(bt, exevas_obj_visibility_set(EINA_TRUE));
eo_do(obj, elw_box_pack_end(bt));
eo_unref(bt);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Elw BoxedButton",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
NULL,
sizeof(Widget_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(elw_boxedbutton_class_get, &class_desc, ELW_BOX_CLASS, ELW_BUTTON_CLASS, NULL)

View File

@ -0,0 +1,9 @@
#ifndef ELW_BOXEDBUTTON_H
#define ELW_BOXEDBUTTON_H
#include "Eo.h"
#define ELW_BOXEDBUTTON_CLASS elw_boxedbutton_class_get()
const Eo_Class *elw_boxedbutton_class_get(void);
#endif

115
eo/evas/evas_elw_button.c Normal file
View File

@ -0,0 +1,115 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include "Eo.h"
#include "evas_obj.h"
#include "elw_button.h"
EAPI Eo_Op ELW_BUTTON_BASE_ID = 0;
EAPI const Eo_Event_Description _EV_CLICKED =
EO_EVENT_DESCRIPTION("clicked", "Called when there was a click.");
typedef struct
{
Evas_Object *bt;
} Widget_Data;
#define MY_CLASS ELW_BUTTON_CLASS
static void
_position_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
(void) obj;
Evas_Coord x, y;
x = va_arg(*list, Evas_Coord);
y = va_arg(*list, Evas_Coord);
printf("But set position %d,%d\n", x, y);
eo_do_super(obj, exevas_obj_position_set(x, y));
}
static void
_text_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
Widget_Data *wd = class_data;
const char *text;
text = va_arg(*list, const char *);
elm_object_text_set(wd->bt, text);
}
static void
_btn_clicked(void *data, Evas_Object *evas_obj, void *event_info)
{
(void) evas_obj;
(void) event_info;
Eo *obj = data;
eo_do(obj, eo_event_callback_call(EV_CLICKED, NULL, NULL));
}
static void
_constructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_constructor());
Widget_Data *wd = class_data;
/* FIXME: An hack, because our tree is not yet only Eo */
wd->bt = elm_button_add(eo_evas_object_get(eo_parent_get(obj)));
evas_object_size_hint_align_set(wd->bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(wd->bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_smart_callback_add(wd->bt, "clicked", _btn_clicked, obj);
eo_evas_object_set(obj, wd->bt);
}
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_destructor());
//Widget_Data *wd = class_data;
/* FIXME: Commented out because it's automatically done because our tree
* is not made of only eo */
//evas_object_del(wd->bt);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), _text_set),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_POSITION_SET), _position_set),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
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...
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Event_Description *event_desc[] = {
EV_CLICKED,
NULL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Elw Button",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST),
event_desc,
sizeof(Widget_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(elw_button_class_get, &class_desc, EXEVAS_OBJ_CLASS, NULL)

29
eo/evas/evas_elw_button.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef ELW_BUTTON_H
#define ELW_BUTTON_H
#include "Eo.h"
extern EAPI Eo_Op ELW_BUTTON_BASE_ID;
enum {
ELW_BUTTON_SUB_ID_TEXT_SET,
ELW_BUTTON_SUB_ID_LAST
};
#define ELW_BUTTON_ID(sub_id) (ELW_BUTTON_BASE_ID + sub_id)
/**
* @def elw_button_text_set(text)
* @brief Set button text
* @param[in] text text to assing to button
* FIXME Doesn't belong here, but just for the example...
*/
#define elw_button_text_set(text) ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), EO_TYPECHECK(const char *, text)
extern const Eo_Event_Description _EV_CLICKED;
#define EV_CLICKED (&(_EV_CLICKED))
#define ELW_BUTTON_CLASS elw_button_class_get()
const Eo_Class *elw_button_class_get(void);
#endif

74
eo/evas/evas_elw_win.c Normal file
View File

@ -0,0 +1,74 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include "Eo.h"
#include "evas_obj.h"
#include "elw_win.h"
typedef struct
{
Evas_Object *win;
Evas_Object *bg;
} Widget_Data;
#define MY_CLASS ELW_WIN_CLASS
static void
my_win_del(void *data, Evas_Object *obj, void *event_info)
{
/* called when my_win_main is requested to be deleted */
elm_exit(); /* exit the program's main loop that runs in elm_run() */
(void) data;
(void) obj;
(void) event_info;
}
static void
_constructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_constructor());
Widget_Data *wd = class_data;
/* FIXME: Will actually do something about those when I care... */
wd->win = elm_win_add(NULL, "eo-test", ELM_WIN_BASIC);
elm_win_title_set(wd->win, "Eo Test");
elm_win_autodel_set(wd->win, EINA_TRUE);
evas_object_smart_callback_add(wd->win, "delete,request", my_win_del, NULL);
wd->bg = elm_bg_add(wd->win);
elm_win_resize_object_add(wd->win, wd->bg);
evas_object_size_hint_weight_set(wd->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(wd->bg);
eo_evas_object_set(obj, wd->win);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Elw Win",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
NULL,
sizeof(Widget_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(elw_win_class_get, &class_desc, EXEVAS_OBJ_CLASS, NULL)

9
eo/evas/evas_elw_win.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef ELW_WIN_H
#define ELW_WIN_H
#include "Eo.h"
#define ELW_WIN_CLASS elw_win_class_get()
const Eo_Class *elw_win_class_get(void);
#endif

146
eo/evas/evas_evas_obj.c Normal file
View File

@ -0,0 +1,146 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include "Eo.h"
#include "evas_obj.h"
#define MY_CLASS EXEVAS_OBJ_CLASS
EAPI Eo_Op EXEVAS_OBJ_BASE_ID = 0;
typedef struct
{
Eina_List *children;
} Widget_Data;
static void
_position_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
Evas_Object *evas_obj = eo_evas_object_get(obj);
Evas_Coord x, y;
x = va_arg(*list, Evas_Coord);
y = va_arg(*list, Evas_Coord);
evas_object_move(evas_obj, x, y);
}
static void
_size_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
Evas_Object *evas_obj = eo_evas_object_get(obj);
Evas_Coord w, h;
w = va_arg(*list, Evas_Coord);
h = va_arg(*list, Evas_Coord);
evas_object_resize(evas_obj, w, h);
}
static void
_color_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
Evas_Object *evas_obj = eo_evas_object_get(obj);
int r, g, b, a;
r = va_arg(*list, int);
g = va_arg(*list, int);
b = va_arg(*list, int);
a = va_arg(*list, int);
evas_object_color_set(evas_obj, r, g, b, a);
}
static void
_color_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
Evas_Object *evas_obj = eo_evas_object_get(obj);
int *r, *g, *b, *a;
r = va_arg(*list, int *);
g = va_arg(*list, int *);
b = va_arg(*list, int *);
a = va_arg(*list, int *);
evas_object_color_get(evas_obj, r, g, b, a);
}
static void
_visibility_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
Evas_Object *evas_obj = eo_evas_object_get(obj);
Eina_Bool v;
v = va_arg(*list, int);
if (v) evas_object_show(evas_obj);
else evas_object_hide(evas_obj);
}
static void
_child_add(Eo *obj, void *class_data, va_list *list)
{
Widget_Data *wd = class_data;
Eo *child;
child = va_arg(*list, Eo *);
wd->children = eina_list_append(wd->children, eo_xref(child, obj));
}
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_constructor());
/* Add type check. */
Eo *parent = eo_parent_get(obj);
if (parent)
eo_do(parent, exevas_obj_child_add(obj));
}
static void
_destructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_destructor());
Widget_Data *wd = class_data;
Eo *child;
EINA_LIST_FREE(wd->children, child)
{
eo_xunref(child, obj);
}
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_POSITION_SET), _position_set),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_SIZE_SET), _size_set),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_COLOR_SET), _color_set),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_COLOR_GET), _color_get),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_VISIBILITY_SET), _visibility_set),
EO_OP_FUNC(EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_CHILD_ADD), _child_add),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(EXEVAS_OBJ_SUB_ID_POSITION_SET, "Position of an evas object."),
EO_OP_DESCRIPTION(EXEVAS_OBJ_SUB_ID_SIZE_SET, "Size of an evas object."),
EO_OP_DESCRIPTION(EXEVAS_OBJ_SUB_ID_COLOR_SET, "Color of an evas object."),
EO_OP_DESCRIPTION(EXEVAS_OBJ_SUB_ID_COLOR_GET, "Color of an evas object."),
EO_OP_DESCRIPTION(EXEVAS_OBJ_SUB_ID_VISIBILITY_SET, "Visibility of an evas object."),
EO_OP_DESCRIPTION(EXEVAS_OBJ_SUB_ID_CHILD_ADD, "Add a child eo."),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Evas Object",
EO_CLASS_TYPE_REGULAR_NO_INSTANT,
EO_CLASS_DESCRIPTION_OPS(&EXEVAS_OBJ_BASE_ID, op_desc, EXEVAS_OBJ_SUB_ID_LAST),
NULL,
sizeof(Widget_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(evas_object_class_get, &class_desc, EO_BASE_CLASS, NULL)

90
eo/evas/evas_evas_obj.h Normal file
View File

@ -0,0 +1,90 @@
#ifndef EXEVAS_OBJ_H
#define EXEVAS_OBJ_H
#include "Eo.h"
extern EAPI Eo_Op EXEVAS_OBJ_BASE_ID;
enum {
EXEVAS_OBJ_SUB_ID_POSITION_SET,
EXEVAS_OBJ_SUB_ID_SIZE_SET,
EXEVAS_OBJ_SUB_ID_COLOR_SET,
EXEVAS_OBJ_SUB_ID_COLOR_GET,
EXEVAS_OBJ_SUB_ID_VISIBILITY_SET,
EXEVAS_OBJ_SUB_ID_CHILD_ADD,
EXEVAS_OBJ_SUB_ID_LAST
};
#define EXEVAS_OBJ_ID(sub_id) (EXEVAS_OBJ_BASE_ID + sub_id)
/**
* @def exevas_obj_position_set(x, y)
* @brief Set object's position
* @param[in] x object's X position
* @param[in] y object's Y position
*/
#define exevas_obj_position_set(x, y) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_POSITION_SET), EO_TYPECHECK(Evas_Coord, x), EO_TYPECHECK(Evas_Coord, y)
/**
* @def exevas_obj_size_set(w, h)
* @brief Set object's size
* @param[in] w object's width
* @param[in] h object's height
*/
#define exevas_obj_size_set(w, h) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_SIZE_SET), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h)
/**
* @def exevas_obj_color_set(r, g, b, a)
* @brief Set object's color
* @param[in] r r-value of color
* @param[in] g g-value of color
* @param[in] b b-value of color
* @param[in] a a-value of color
*/
#define exevas_obj_color_set(r, g, b, a) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a)
/**
* @def exevas_obj_color_get(r, g, b, a)
* @brief Set object's position
* @param[out] r integer pointer for r-value of color
* @param[out] g integer pointer for g-value of color
* @param[out] b integer pointer for b-value of color
* @param[out] a integer pointer for a-value of color
*/
#define exevas_obj_color_get(r, g, b, a) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a)
/**
* @def exevas_obj_visibility_set(v)
* @brief Set object's visible property
* @param[in] v True/False value
*/
#define exevas_obj_visibility_set(v) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_VISIBILITY_SET), EO_TYPECHECK(Eina_Bool, v)
/**
* @def exevas_obj_child_add(child)
* @brief Add child to current object
* @param[in] pointer to child object
*/
#define exevas_obj_child_add(child) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_CHILD_ADD), EO_TYPECHECK(Eo *, child)
#define EXEVAS_OBJ_CLASS evas_object_class_get()
const Eo_Class *evas_object_class_get(void);
#define EXEVAS_OBJ_STR "Evas_Obj"
/* FIXME: Hack in the meanwhile. */
static inline Evas_Object *
eo_evas_object_get(const Eo *obj)
{
void *data;
eo_do((Eo *) obj, eo_base_data_get(EXEVAS_OBJ_STR, &data));
return data;
}
/* FIXME: Hack in the meanwhile. */
static inline void
eo_evas_object_set(Eo *obj, Evas_Object *evas_obj)
{
eo_do(obj, eo_base_data_set(EXEVAS_OBJ_STR, evas_obj, NULL));
}
#endif

68
eo/evas/evas_test.c Normal file
View File

@ -0,0 +1,68 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include "evas_obj.h"
#include "elw_button.h"
#include "elw_box.h"
#include "elw_boxedbutton.h"
#include "elw_win.h"
Eina_Bool
_btn_clicked_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
{
(void) obj;
(void) event_info;
const Eo_Class *klass = eo_class_get(obj);
printf("%s obj-type:'%s' data:'%s'\n", desc->name, eo_class_name_get(klass), (const char *) data);
return EO_CALLBACK_CONTINUE;
}
int
main(int argc, char *argv[])
{
Evas_Coord winw, winh;
{
winw = 400;
winh = 400;
}
elm_init(argc, argv);
eo_init();
Eo *win = eo_add(ELW_WIN_CLASS, NULL);
eo_do(win, exevas_obj_size_set(winw, winh), exevas_obj_visibility_set(EINA_TRUE));
Eo *bt = eo_add(ELW_BUTTON_CLASS, win);
eo_do(bt, exevas_obj_position_set(25, 25),
exevas_obj_size_set(50, 50),
exevas_obj_color_set(255, 0, 0, 255),
elw_button_text_set("Click"),
exevas_obj_visibility_set(EINA_TRUE));
eo_do(bt, eo_event_callback_add(EV_CLICKED, _btn_clicked_cb, "btn"));
int r, g, b, a;
eo_do(bt, exevas_obj_color_get(&r, &g, &b, &a));
printf("RGBa(%d, %d, %d, %d)\n", r, g, b, a);
Eo *bx = eo_add(ELW_BOXEDBUTTON_CLASS, win);
eo_do(bx, exevas_obj_position_set(100, 100),
exevas_obj_size_set(70, 70),
exevas_obj_color_set(0, 0, 255, 255),
elw_button_text_set("Click2"),
exevas_obj_visibility_set(EINA_TRUE));
eo_do(bx, eo_event_callback_add(EV_CLICKED, _btn_clicked_cb, "bxedbtn"));
elm_run();
eo_unref(bx);
eo_unref(bt);
eo_unref(win);
eo_shutdown();
elm_shutdown();
return 0;
}

21
eo/isa/eo_isa_complex.c Normal file
View File

@ -0,0 +1,21 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "eo_isa_complex.h"
#define MY_CLASS COMPLEX_CLASS
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Complex",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
NULL,
0,
NULL,
NULL
};
EO_DEFINE_CLASS(complex_class_get, &class_desc, SIMPLE_CLASS, NULL);

10
eo/isa/eo_isa_complex.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef COMPLEX_H
#define COMPLEX_H
#include "Eo.h"
#include "eo_isa_simple.h"
#define COMPLEX_CLASS complex_class_get()
const Eo_Class *complex_class_get(void);
#endif

29
eo/isa/eo_isa_interface.c Normal file
View File

@ -0,0 +1,29 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "eo_isa_interface.h"
EAPI Eo_Op INTERFACE_BASE_ID = 0;
#define MY_CLASS INTERFACE_CLASS
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(INTERFACE_SUB_ID_A_POWER_3_GET, "Get the a^3"),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Interface",
EO_CLASS_TYPE_INTERFACE,
EO_CLASS_DESCRIPTION_OPS(&INTERFACE_BASE_ID, op_desc, INTERFACE_SUB_ID_LAST),
NULL,
0,
NULL,
NULL
};
EO_DEFINE_CLASS(interface_class_get, &class_desc, NULL, NULL)

26
eo/isa/eo_isa_interface.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include "Eo.h"
extern EAPI Eo_Op INTERFACE_BASE_ID;
enum {
INTERFACE_SUB_ID_A_POWER_3_GET,
INTERFACE_SUB_ID_LAST
};
#define INTERFACE_ID(sub_id) (INTERFACE_BASE_ID + sub_id)
/**
* @def interface_a_power_3_get(ret)
* @brief Get a^3
* @param[out] ret integer pointer to ret - value
*/
#define interface_a_power_3_get(ret) INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), EO_TYPECHECK(int *, ret)
#define INTERFACE_CLASS interface_class_get()
const Eo_Class *interface_class_get(void);
#endif

36
eo/isa/eo_isa_main.c Normal file
View File

@ -0,0 +1,36 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "eo_isa_simple.h"
#include "eo_isa_complex.h"
int
main(int argc, char *argv[])
{
(void) argc;
(void) argv;
eo_init();
Eo *simpleobj = eo_add(SIMPLE_CLASS, NULL);
Eo *complexobj = eo_add(COMPLEX_CLASS, NULL);
printf("Simple: isa-simple:%d isa-complex:%d isa-mixin:%d isa-interface:%d\n",
eo_isa(simpleobj, SIMPLE_CLASS),
eo_isa(simpleobj, COMPLEX_CLASS),
eo_isa(simpleobj, MIXIN_CLASS),
eo_isa(simpleobj, INTERFACE_CLASS));
printf("Complex: isa-simple:%d isa-complex:%d isa-mixin:%d isa-interface:%d\n",
eo_isa(complexobj, SIMPLE_CLASS),
eo_isa(complexobj, COMPLEX_CLASS),
eo_isa(complexobj, MIXIN_CLASS),
eo_isa(complexobj, INTERFACE_CLASS));
eo_unref(simpleobj);
eo_unref(complexobj);
eo_shutdown();
return 0;
}

53
eo/isa/eo_isa_mixin.c Normal file
View File

@ -0,0 +1,53 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "eo_isa_mixin.h"
#include "eo_isa_simple.h"
EAPI Eo_Op MIXIN_BASE_ID = 0;
#define MY_CLASS MIXIN_CLASS
static void
_a_square_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
int a;
eo_do(obj, simple_a_get(&a));
int *ret = va_arg(*list, int *);
if (ret)
*ret = a * a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), _a_square_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(MIXIN_SUB_ID_A_SQUARE_GET, "Get the value of A^2"),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Mixin",
EO_CLASS_TYPE_MIXIN,
EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
NULL,
0,
_class_constructor,
NULL
};
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL)

26
eo/isa/eo_isa_mixin.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef MIXIN_H
#define MIXIN_H
#include "Eo.h"
extern EAPI Eo_Op MIXIN_BASE_ID;
enum {
MIXIN_SUB_ID_A_SQUARE_GET,
MIXIN_SUB_ID_LAST
};
#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id)
/**
* @def mixin_a_square_get(ret)
* @brief Get the square of a.
* @param[out] ret the square of a
*/
#define mixin_a_square_get(ret) MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), EO_TYPECHECK(int *, ret)
#define MIXIN_CLASS mixin_class_get()
const Eo_Class *mixin_class_get(void);
#endif

78
eo/isa/eo_isa_simple.c Normal file
View File

@ -0,0 +1,78 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "eo_isa_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
int a;
} Private_Data;
#define MY_CLASS SIMPLE_CLASS
static void
_a_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
const Private_Data *pd = class_data;
int *a;
a = va_arg(*list, int *);
*a = pd->a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
Private_Data *pd = class_data;
int a;
a = va_arg(*list, int);
pd->a = a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_a_power_3_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
const Private_Data *pd = class_data;
int *ret;
ret = va_arg(*list, int *);
if (ret)
*ret = pd->a * pd->a * pd->a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
EO_OP_FUNC(INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), _a_power_3_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"),
EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "Get property A"),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
NULL,
sizeof(Private_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);

35
eo/isa/eo_isa_simple.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef SIMPLE_H
#define SIMPLE_H
#include "Eo.h"
#include "eo_isa_interface.h"
#include "eo_isa_mixin.h"
extern EAPI Eo_Op SIMPLE_BASE_ID;
enum {
SIMPLE_SUB_ID_A_SET,
SIMPLE_SUB_ID_A_GET,
SIMPLE_SUB_ID_LAST
};
#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id)
/**
* @def simple_a_set(a)
* @brief Set value to a-property
* @param[in] a integer value to set
*/
#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
/**
* @def simple_a_get(a)
* @brief Get value of a-property
* @param[out] integer pointer to a-value
*/
#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a)
#define SIMPLE_CLASS simple_class_get()
const Eo_Class *simple_class_get(void);
#endif

View File

@ -0,0 +1,29 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "simple_interface.h"
EAPI Eo_Op INTERFACE_BASE_ID = 0;
#define MY_CLASS INTERFACE_CLASS
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(INTERFACE_SUB_ID_A_POWER_3_GET, "Get the a^3"),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Interface",
EO_CLASS_TYPE_INTERFACE,
EO_CLASS_DESCRIPTION_OPS(&INTERFACE_BASE_ID, op_desc, INTERFACE_SUB_ID_LAST),
NULL,
0,
NULL,
NULL
};
EO_DEFINE_CLASS(interface_class_get, &class_desc, NULL, NULL)

View File

@ -0,0 +1,26 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include "Eo.h"
extern EAPI Eo_Op INTERFACE_BASE_ID;
enum {
INTERFACE_SUB_ID_A_POWER_3_GET,
INTERFACE_SUB_ID_LAST
};
#define INTERFACE_ID(sub_id) (INTERFACE_BASE_ID + sub_id)
/**
* @def interface_a_power_3_get(ret)
* @brief Get a^3
* @param[out] ret integer pointer to ret - value
*/
#define interface_a_power_3_get(ret) INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), EO_TYPECHECK(int *, ret)
#define INTERFACE_CLASS interface_class_get()
const Eo_Class *interface_class_get(void);
#endif

31
eo/simple/simple_main.c Normal file
View File

@ -0,0 +1,31 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "simple_simple.h"
int
main(int argc, char *argv[])
{
(void) argc;
(void) argv;
eo_init();
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
eo_do(obj, simple_a_set(4));
int a = 0, a2 = 0, a3 = 0;
eo_do(obj, simple_a_get(&a),
interface_a_power_3_get(&a3),
mixin_a_square_get(&a2));
printf("Got %d %d %d\n", a, a2, a3);
eo_unref(obj);
eo_shutdown();
return 0;
}

53
eo/simple/simple_mixin.c Normal file
View File

@ -0,0 +1,53 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "simple_mixin.h"
#include "simple_simple.h"
EAPI Eo_Op MIXIN_BASE_ID = 0;
#define MY_CLASS MIXIN_CLASS
static void
_a_square_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
{
int a;
eo_do(obj, simple_a_get(&a));
int *ret = va_arg(*list, int *);
if (ret)
*ret = a * a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), _a_square_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(MIXIN_SUB_ID_A_SQUARE_GET, "Get the value of A^2"),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Mixin",
EO_CLASS_TYPE_MIXIN,
EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
NULL,
0,
_class_constructor,
NULL
};
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL)

26
eo/simple/simple_mixin.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef MIXIN_H
#define MIXIN_H
#include "Eo.h"
extern EAPI Eo_Op MIXIN_BASE_ID;
enum {
MIXIN_SUB_ID_A_SQUARE_GET,
MIXIN_SUB_ID_LAST
};
#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id)
/**
* @def mixin_a_square_get(ret)
* @brief Get the square of a.
* @param[out] ret the square of a
*/
#define mixin_a_square_get(ret) MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), EO_TYPECHECK(int *, ret)
#define MIXIN_CLASS mixin_class_get()
const Eo_Class *mixin_class_get(void);
#endif

78
eo/simple/simple_simple.c Normal file
View File

@ -0,0 +1,78 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "simple_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
int a;
} Private_Data;
#define MY_CLASS SIMPLE_CLASS
static void
_a_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
const Private_Data *pd = class_data;
int *a;
a = va_arg(*list, int *);
*a = pd->a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
Private_Data *pd = class_data;
int a;
a = va_arg(*list, int);
pd->a = a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_a_power_3_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
const Private_Data *pd = class_data;
int *ret;
ret = va_arg(*list, int *);
if (ret)
*ret = pd->a * pd->a * pd->a;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
EO_OP_FUNC(INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), _a_power_3_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"),
EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "Get property A"),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
NULL,
sizeof(Private_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);

35
eo/simple/simple_simple.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef SIMPLE_H
#define SIMPLE_H
#include "Eo.h"
#include "simple_interface.h"
#include "simple_mixin.h"
extern EAPI Eo_Op SIMPLE_BASE_ID;
enum {
SIMPLE_SUB_ID_A_SET,
SIMPLE_SUB_ID_A_GET,
SIMPLE_SUB_ID_LAST
};
#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id)
/**
* @def simple_a_set(a)
* @brief Set value to a-property
* @param[in] a integer value to set
*/
#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
/**
* @def simple_a_get(a)
* @brief Get value of a-property
* @param[out] integer pointer to a-value
*/
#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a)
#define SIMPLE_CLASS simple_class_get()
const Eo_Class *simple_class_get(void);
#endif