aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/eobj/examples/evas/elw_win.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-04-05 15:31:15 +0000
committerTom Hacohen <tom@stosb.com>2012-04-05 15:31:15 +0000
commit4f3f37059c7ec45c7154a4d7f89f9d133c49cc94 (patch)
treebe48af36650e4ce576b81e6e9df4d4d04cd6e30d /legacy/eobj/examples/evas/elw_win.c
parentEcore: doc fixes (diff)
downloadefl-4f3f37059c7ec45c7154a4d7f89f9d133c49cc94.tar.gz
Eobj: Initial commit.
SVN revision: 69932
Diffstat (limited to 'legacy/eobj/examples/evas/elw_win.c')
-rw-r--r--legacy/eobj/examples/evas/elw_win.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/legacy/eobj/examples/evas/elw_win.c b/legacy/eobj/examples/evas/elw_win.c
new file mode 100644
index 0000000000..9457170112
--- /dev/null
+++ b/legacy/eobj/examples/evas/elw_win.c
@@ -0,0 +1,76 @@
+#include <Elementary.h>
+
+#include "eobj.h"
+#include "evas_obj.h"
+#include "elw_win.h"
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *bg;
+} Widget_Data;
+
+static Eobj_Class *_my_class = NULL;
+
+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(Eobj *obj)
+{
+ eobj_constructor_super(obj);
+
+ Widget_Data *wd = eobj_data_get(obj, _my_class);
+
+ /* FIXME: Will actually do something about those when I care... */
+ wd->win = elm_win_add(NULL, "eobj-test", ELM_WIN_BASIC);
+ elm_win_title_set(wd->win, "Eobj 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);
+
+ eobj_evas_object_set(obj, wd->win);
+}
+
+static void
+_destructor(Eobj *obj)
+{
+ eobj_destructor_super(obj);
+
+ //Widget_Data *wd = eobj_data_get(obj, _my_class);
+ /* FIXME: Commented out because it's automatically done because our tree
+ * is not made of only eobj */
+// evas_object_del(wd->bx);
+}
+
+const Eobj_Class *
+elw_win_class_get(void)
+{
+ if (_my_class) return _my_class;
+
+ static const Eobj_Class_Description class_desc = {
+ "Elw Box",
+ EOBJ_CLASS_TYPE_REGULAR,
+ EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
+ NULL,
+ sizeof(Widget_Data),
+ _constructor,
+ _destructor,
+ NULL,
+ NULL
+ };
+
+ return _my_class = eobj_class_new(&class_desc, EVAS_OBJ_CLASS, NULL);
+}
+