summaryrefslogtreecommitdiff
path: root/src/bin/e_widget_check.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-10-10 12:16:18 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-10-10 12:16:18 +0000
commit1fbaab35ba0f75e395e1304849a6250aad162c17 (patch)
treee3b543f5aa671d09ed2ef3f2df5e4efef84060d1 /src/bin/e_widget_check.c
parent6532ab7362bdbd9688ea1afeaa35efcfac242e05 (diff)
downloadenlightenment-1fbaab35ba0f75e395e1304849a6250aad162c17.tar.gz
started work on a quick & dirty widget infrastructure - designed ONLY for
simple dialogs and ease of use. SVN revision: 17383
Diffstat (limited to 'src/bin/e_widget_check.c')
-rw-r--r--src/bin/e_widget_check.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/bin/e_widget_check.c b/src/bin/e_widget_check.c
new file mode 100644
index 0000000000..6a4fad2ac1
--- /dev/null
+++ b/src/bin/e_widget_check.c
@@ -0,0 +1,69 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+typedef struct _E_Widget_Data E_Widget_Data;
+struct _E_Widget_Data
+{
+ int *valptr;
+};
+
+static void _e_wid_del_hook(Evas_Object *obj);
+static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source);
+/* local subsystem functions */
+
+/* externally accessible functions */
+Evas_Object *
+e_widget_checkbox_add(Evas *evas, char *label, int *val)
+{
+ Evas_Object *obj, *o;
+ E_Widget_Data *wd;
+ Evas_Coord mw, mh;
+
+ obj = e_widget_add(evas);
+
+ e_widget_del_hook_set(obj, _e_wid_del_hook);
+ wd = calloc(1, sizeof(E_Widget_Data));
+ wd->valptr = val;
+ e_widget_data_set(obj, wd);
+
+ o = edje_object_add(evas);
+ e_theme_edje_object_set(o, "base/theme/widgets",
+ "widgets/check");
+ edje_object_signal_callback_add(o, "toggled", "*", _e_wid_signal_cb1, obj);
+ edje_object_part_text_set(o, "label", label);
+ edje_object_size_min_calc(o, &mw, &mh);
+ e_widget_min_size_set(obj, mw, mh);
+ if (wd->valptr)
+ {
+ if (*(wd->valptr)) edje_object_signal_emit(o, "toggle_on", "");
+ }
+
+ e_widget_sub_object_add(obj, o);
+ e_widget_resize_object_set(obj, o);
+
+ return obj;
+}
+
+static void
+_e_wid_del_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ free(wd);
+}
+
+static void
+_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(data);
+ if (wd->valptr)
+ {
+ if (!strcmp(source, "on")) *(wd->valptr) = 1;
+ else *(wd->valptr) = 0;
+ }
+}