[Pkg-e-commits] [SCM] Enlightenment DR17 toolkit based (based on the EFL) branch, upstream-vcs, updated. 447de88121d145a078f1754a0cfebb704d363821
dj2
dj2 at alioth.debian.org
Sat Jun 7 18:34:26 UTC 2008
The following commit has been merged in the upstream-vcs branch:
commit 6e16643a0795fa48922541301661d71894a78740
Author: dj2 <dj2>
Date: Tue May 6 20:09:01 2008 +0000
- change tabs to spaces (Ewl uses an 8 space indent now instead of a tab)
diff --git a/src/bin/Ewl_Test.h b/src/bin/Ewl_Test.h
index 1a34c1e..a57ad20 100644
--- a/src/bin/Ewl_Test.h
+++ b/src/bin/Ewl_Test.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TEST_H
#define EWL_TEST_H
@@ -10,11 +10,11 @@
*/
enum Ewl_Test_Type
{
- EWL_TEST_TYPE_SIMPLE,
- EWL_TEST_TYPE_ADVANCED,
- EWL_TEST_TYPE_CONTAINER,
- EWL_TEST_TYPE_MISC,
- EWL_TEST_TYPE_UNIT
+ EWL_TEST_TYPE_SIMPLE,
+ EWL_TEST_TYPE_ADVANCED,
+ EWL_TEST_TYPE_CONTAINER,
+ EWL_TEST_TYPE_MISC,
+ EWL_TEST_TYPE_UNIT
};
typedef enum Ewl_Test_Type Ewl_Test_Type;
@@ -28,12 +28,12 @@ typedef struct Ewl_Unit_Test Ewl_Unit_Test;
*/
struct Ewl_Unit_Test
{
- const char *name; /**< The test name */
- int (*func)(char *buf, int len); /**< The test function */
+ const char *name; /**< The test name */
+ int (*func)(char *buf, int len); /**< The test function */
- char *failure_reason; /**< Test failure reason */
- short status; /**< Test status */
- unsigned int quiet: 1; /**< Boolean to disable stderr */
+ char *failure_reason; /**< Test failure reason */
+ short status; /**< Test status */
+ unsigned int quiet: 1; /**< Boolean to disable stderr */
};
/**
@@ -46,14 +46,14 @@ typedef struct Ewl_Test Ewl_Test;
*/
struct Ewl_Test
{
- const char *name; /**< The test name */
- const char *filename; /**< Filename of the test */
- const char *tip; /**< Tooltip for the test */
-
- Ecore_Plugin *plugin; /**< Dynamic file handle for test */
- Ewl_Test_Type type; /**< The type of test */
- int (*func)(Ewl_Container *con); /**< The test function */
- Ewl_Unit_Test *unit_tests; /**< The test unit tests */
+ const char *name; /**< The test name */
+ const char *filename; /**< Filename of the test */
+ const char *tip; /**< Tooltip for the test */
+
+ Ecore_Plugin *plugin; /**< Dynamic file handle for test */
+ Ewl_Test_Type type; /**< The type of test */
+ int (*func)(Ewl_Container *con); /**< The test function */
+ Ewl_Unit_Test *unit_tests; /**< The test unit tests */
};
#endif
diff --git a/src/bin/ewl_embed_test.c b/src/bin/ewl_embed_test.c
index 447593c..aa9ac57 100644
--- a/src/bin/ewl_embed_test.c
+++ b/src/bin/ewl_embed_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <Evas.h>
#include <Ecore_Evas.h>
#include <Ewl.h>
@@ -23,224 +23,224 @@ Ewl_Widget *text, *entry;
static void
open(Ewl_Widget *w , void *e __UNUSED__, void *d)
{
- ewl_widget_disable(w);
- ewl_widget_enable(EWL_WIDGET(d));
- edje_object_signal_emit(edje, "open", "open");
+ ewl_widget_disable(w);
+ ewl_widget_enable(EWL_WIDGET(d));
+ edje_object_signal_emit(edje, "open", "open");
}
static void
close(Ewl_Widget *w, void *e __UNUSED__, void *d)
{
- ewl_widget_disable(w);
- ewl_widget_enable(EWL_WIDGET(d));
- edje_object_signal_emit(edje, "close", "close");
+ ewl_widget_disable(w);
+ ewl_widget_enable(EWL_WIDGET(d));
+ edje_object_signal_emit(edje, "close", "close");
}
static void
destroy_main_window(Ecore_Evas *ee __UNUSED__)
{
- ewl_main_quit();
- return;
+ ewl_main_quit();
+ return;
}
static void
resize_window(Ecore_Evas *ee)
{
- Evas_Coord w, h;
+ Evas_Coord w, h;
- ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
- evas_object_resize(edje, w, h);
+ ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+ evas_object_resize(edje, w, h);
}
static void
insert(Ewl_Widget *w __UNUSED__, void *e __UNUSED__, void *d __UNUSED__)
{
- const char * t;
+ const char * t;
- t = ewl_text_text_get(EWL_TEXT(entry));
+ t = ewl_text_text_get(EWL_TEXT(entry));
- if (t) {
- ewl_text_text_append(EWL_TEXT(text), "\n");
- ewl_text_text_append(EWL_TEXT(text), t);
- ewl_text_clear(EWL_TEXT(entry));
- }
+ if (t) {
+ ewl_text_text_append(EWL_TEXT(text), "\n");
+ ewl_text_text_append(EWL_TEXT(text), t);
+ ewl_text_clear(EWL_TEXT(entry));
+ }
}
int
main(int argc, char **argv)
{
- Ewl_Widget *wg, *c, *vbox;
- Ewl_Widget *button[2];
- Ewl_Widget *emb;
- Evas_Object *eo;
- Evas_Coord x, y, w, h;
-
- /*
- * initialize
- */
- evas_init();
- ecore_evas_init();
- ewl_init(&argc, argv);
-
- /*
- * setup ecore evas
- */
- ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 300, 300);
- ecore_evas_title_set(ee, "Ewl_Embed Test");
- ecore_evas_name_class_set(ee, "Ewl_Embed_Test", "Ewl");
- ecore_evas_callback_delete_request_set(ee, destroy_main_window);
- ecore_evas_callback_resize_set(ee, resize_window);
- ecore_evas_size_min_set(ee, 210, 230);
- ecore_evas_show(ee);
-
- /*
- * get evas and setup the edje
- */
- evas = ecore_evas_get(ee);
- edje = edje_object_add(evas);
-
- if (!edje_object_file_set(edje,
- PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj",
- "main"))
- {
- fprintf(stderr, "Error in: %s\n",
- PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj");
- return 1;
- }
-
- evas_object_move(edje, 0, 0);
- evas_object_resize(edje, 300, 300);
- evas_object_show(edje);
-
- /*
- * Setup the ewl embed
- */
- emb = ewl_embed_new();
- ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL);
- eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas,
- (void *) ecore_evas_software_x11_window_get(ee));
- ewl_embed_focus_set(EWL_EMBED(emb), TRUE);
- ewl_widget_show(emb);
-
- /*
- * swallow it into the edje
- */
- edje_object_part_geometry_get(edje, "swallow", &x, &y, &w, &h);
- evas_object_move(eo, x, y);
- evas_object_resize(eo, w, h);
- edje_object_part_swallow(edje, "swallow", eo);
- evas_object_show(eo);
-
- /*
- * fill it with content
- */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(emb), vbox);
- ewl_widget_show(vbox);
-
- wg = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), wg);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
- ewl_widget_show(wg);
-
- text = ewl_text_new();
- ewl_container_child_append(EWL_CONTAINER(wg), text);
- ewl_text_text_append(EWL_TEXT(text),
- "You can use EWL in side a evas/edje only app.\n"
- "It can actually behave like a normal evas object\n"
- "So forget to figure out how to write an entry object,\n"
- "simply use the ewl widget! :)\n\n");
- ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_HFILL |
- EWL_FLAG_FILL_VFILL);
- ewl_widget_show(text);
-
- c = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_NONE |
- EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(vbox), c);
- ewl_widget_show(c);
-
- entry = ewl_entry_new();
- ewl_container_child_append(EWL_CONTAINER(c), entry);
- ewl_entry_editable_set(EWL_ENTRY(entry), TRUE);
- ewl_entry_multiline_set(EWL_ENTRY(entry), FALSE);
- ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED, insert, NULL);
- ewl_widget_show(entry);
-
- wg = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(wg), "append");
- ewl_object_fill_policy_set(EWL_OBJECT(wg), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(c), wg);
- ewl_callback_append(wg, EWL_CALLBACK_CLICKED, insert, NULL);
- ewl_widget_show(wg);
-
- /*
- * Setup the second ewl embed
- */
- emb = ewl_embed_new();
- ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL);
- eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas,
- (void *) ecore_evas_software_x11_window_get(ee));
- ewl_widget_show(emb);
-
- /*
- * swallow it into the edje
- */
- edje_object_part_geometry_get(edje, "swallow2", &x, &y, &w, &h);
- evas_object_move(eo, x, y);
- evas_object_resize(eo, w, h);
- edje_object_part_swallow(edje, "swallow2", eo);
- evas_object_show(eo);
-
- c = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_NONE |
- EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(emb), c);
- ewl_widget_show(c);
-
- wg = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(wg), "open");
- ewl_container_child_append(EWL_CONTAINER(c), wg);
- ewl_widget_show(wg);
- button[0] = wg;
-
- wg = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(wg), "close");
- ewl_container_child_append(EWL_CONTAINER(c), wg);
- ewl_widget_show(wg);
- button[1] = wg;
-
- ewl_callback_append(button[0], EWL_CALLBACK_CLICKED, open, button[1]);
- ewl_callback_append(button[1], EWL_CALLBACK_CLICKED, close, button[0]);
-
- ewl_widget_disable(button[1]);
-
- /*
- * Setup the third ewl embed
- */
- emb = ewl_embed_new();
- ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL);
- eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas,
- (void *) ecore_evas_software_x11_window_get(ee));
- ewl_embed_focus_set(EWL_EMBED(emb), TRUE);
- ewl_widget_show(emb);
-
- /*
- * swallow it into the edje
- */
- edje_object_part_geometry_get(edje, "swallow3", &x, &y, &w, &h);
- evas_object_move(eo, x, y);
- evas_object_resize(eo, w, h);
- edje_object_part_swallow(edje, "swallow3", eo);
- evas_object_show(eo);
-
- wg = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(wg), "Open the glass");
- ewl_container_child_append(EWL_CONTAINER(emb), wg);
- ewl_widget_show(wg);
-
- ewl_main();
-
- return 0;
+ Ewl_Widget *wg, *c, *vbox;
+ Ewl_Widget *button[2];
+ Ewl_Widget *emb;
+ Evas_Object *eo;
+ Evas_Coord x, y, w, h;
+
+ /*
+ * initialize
+ */
+ evas_init();
+ ecore_evas_init();
+ ewl_init(&argc, argv);
+
+ /*
+ * setup ecore evas
+ */
+ ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 300, 300);
+ ecore_evas_title_set(ee, "Ewl_Embed Test");
+ ecore_evas_name_class_set(ee, "Ewl_Embed_Test", "Ewl");
+ ecore_evas_callback_delete_request_set(ee, destroy_main_window);
+ ecore_evas_callback_resize_set(ee, resize_window);
+ ecore_evas_size_min_set(ee, 210, 230);
+ ecore_evas_show(ee);
+
+ /*
+ * get evas and setup the edje
+ */
+ evas = ecore_evas_get(ee);
+ edje = edje_object_add(evas);
+
+ if (!edje_object_file_set(edje,
+ PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj",
+ "main"))
+ {
+ fprintf(stderr, "Error in: %s\n",
+ PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj");
+ return 1;
+ }
+
+ evas_object_move(edje, 0, 0);
+ evas_object_resize(edje, 300, 300);
+ evas_object_show(edje);
+
+ /*
+ * Setup the ewl embed
+ */
+ emb = ewl_embed_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL);
+ eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas,
+ (void *) ecore_evas_software_x11_window_get(ee));
+ ewl_embed_focus_set(EWL_EMBED(emb), TRUE);
+ ewl_widget_show(emb);
+
+ /*
+ * swallow it into the edje
+ */
+ edje_object_part_geometry_get(edje, "swallow", &x, &y, &w, &h);
+ evas_object_move(eo, x, y);
+ evas_object_resize(eo, w, h);
+ edje_object_part_swallow(edje, "swallow", eo);
+ evas_object_show(eo);
+
+ /*
+ * fill it with content
+ */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(emb), vbox);
+ ewl_widget_show(vbox);
+
+ wg = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), wg);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(wg);
+
+ text = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(wg), text);
+ ewl_text_text_append(EWL_TEXT(text),
+ "You can use EWL in side a evas/edje only app.\n"
+ "It can actually behave like a normal evas object\n"
+ "So forget to figure out how to write an entry object,\n"
+ "simply use the ewl widget! :)\n\n");
+ ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_HFILL |
+ EWL_FLAG_FILL_VFILL);
+ ewl_widget_show(text);
+
+ c = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_NONE |
+ EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(vbox), c);
+ ewl_widget_show(c);
+
+ entry = ewl_entry_new();
+ ewl_container_child_append(EWL_CONTAINER(c), entry);
+ ewl_entry_editable_set(EWL_ENTRY(entry), TRUE);
+ ewl_entry_multiline_set(EWL_ENTRY(entry), FALSE);
+ ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED, insert, NULL);
+ ewl_widget_show(entry);
+
+ wg = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(wg), "append");
+ ewl_object_fill_policy_set(EWL_OBJECT(wg), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(c), wg);
+ ewl_callback_append(wg, EWL_CALLBACK_CLICKED, insert, NULL);
+ ewl_widget_show(wg);
+
+ /*
+ * Setup the second ewl embed
+ */
+ emb = ewl_embed_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL);
+ eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas,
+ (void *) ecore_evas_software_x11_window_get(ee));
+ ewl_widget_show(emb);
+
+ /*
+ * swallow it into the edje
+ */
+ edje_object_part_geometry_get(edje, "swallow2", &x, &y, &w, &h);
+ evas_object_move(eo, x, y);
+ evas_object_resize(eo, w, h);
+ edje_object_part_swallow(edje, "swallow2", eo);
+ evas_object_show(eo);
+
+ c = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_NONE |
+ EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(emb), c);
+ ewl_widget_show(c);
+
+ wg = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(wg), "open");
+ ewl_container_child_append(EWL_CONTAINER(c), wg);
+ ewl_widget_show(wg);
+ button[0] = wg;
+
+ wg = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(wg), "close");
+ ewl_container_child_append(EWL_CONTAINER(c), wg);
+ ewl_widget_show(wg);
+ button[1] = wg;
+
+ ewl_callback_append(button[0], EWL_CALLBACK_CLICKED, open, button[1]);
+ ewl_callback_append(button[1], EWL_CALLBACK_CLICKED, close, button[0]);
+
+ ewl_widget_disable(button[1]);
+
+ /*
+ * Setup the third ewl embed
+ */
+ emb = ewl_embed_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL);
+ eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas,
+ (void *) ecore_evas_software_x11_window_get(ee));
+ ewl_embed_focus_set(EWL_EMBED(emb), TRUE);
+ ewl_widget_show(emb);
+
+ /*
+ * swallow it into the edje
+ */
+ edje_object_part_geometry_get(edje, "swallow3", &x, &y, &w, &h);
+ evas_object_move(eo, x, y);
+ evas_object_resize(eo, w, h);
+ edje_object_part_swallow(edje, "swallow3", eo);
+ evas_object_show(eo);
+
+ wg = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(wg), "Open the glass");
+ ewl_container_child_append(EWL_CONTAINER(emb), wg);
+ ewl_widget_show(wg);
+
+ ewl_main();
+
+ return 0;
}
diff --git a/src/bin/ewl_simple_test.c b/src/bin/ewl_simple_test.c
index 3a7c300..e5a636c 100644
--- a/src/bin/ewl_simple_test.c
+++ b/src/bin/ewl_simple_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <Ewl.h>
#include <ewl_macros.h>
#ifdef HAVE_CONFIG_H
@@ -19,178 +19,178 @@
static void
edje_text(void *data, Evas_Object *obj __UNUSED__,
- const char *emission, const char *source)
+ const char *emission, const char *source)
{
- char *buf;
- char *text;
- int len;
- Ewl_Widget *label = data;
+ char *buf;
+ char *text;
+ int len;
+ Ewl_Widget *label = data;
- if (strstr(emission, "Present") != emission)
- return;
+ if (strstr(emission, "Present") != emission)
+ return;
- text = (char *)emission + strlen("Present");
- len = strlen(text);
- buf = NEW(char, len);
- snprintf(buf, len, text);
+ text = (char *)emission + strlen("Present");
+ len = strlen(text);
+ buf = NEW(char, len);
+ snprintf(buf, len, text);
- ewl_text_clear(EWL_TEXT(label));
+ ewl_text_clear(EWL_TEXT(label));
- ewl_text_font_set(EWL_TEXT(label), "ewl/default");
- ewl_text_font_size_set(EWL_TEXT(label), 12);
- ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_SOFT_SHADOW);
- ewl_text_text_set(EWL_TEXT(label), (char *)source);
+ ewl_text_font_set(EWL_TEXT(label), "ewl/default");
+ ewl_text_font_size_set(EWL_TEXT(label), 12);
+ ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_SOFT_SHADOW);
+ ewl_text_text_set(EWL_TEXT(label), (char *)source);
- ewl_text_align_set(EWL_TEXT(label), EWL_FLAG_ALIGN_LEFT);
- ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_NONE);
- ewl_text_font_set(EWL_TEXT(label), "ewl/default");
- ewl_text_font_size_set(EWL_TEXT(label), 9);
- ewl_text_text_append(EWL_TEXT(label), text);
+ ewl_text_align_set(EWL_TEXT(label), EWL_FLAG_ALIGN_LEFT);
+ ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_NONE);
+ ewl_text_font_set(EWL_TEXT(label), "ewl/default");
+ ewl_text_font_size_set(EWL_TEXT(label), 9);
+ ewl_text_text_append(EWL_TEXT(label), text);
- FREE(buf);
+ FREE(buf);
}
static void
start_text(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Widget *label = user_data;
-
- ewl_object_alignment_set(EWL_OBJECT(label), EWL_FLAG_ALIGN_CENTER);
- ewl_text_font_set(EWL_TEXT(label), "ewl/default");
- ewl_text_font_size_set(EWL_TEXT(label), 12);
- ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_SOFT_SHADOW);
- ewl_text_text_append(EWL_TEXT(label), "Welcome to Enlightenment!\n");
- ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_NONE);
- ewl_text_font_set(EWL_TEXT(label), "ewl/default");
- ewl_text_font_size_set(EWL_TEXT(label), 7);
- ewl_text_text_append(EWL_TEXT(label), "We hope you enjoy your stay.\n"
- "Please visit us at:\n");
- ewl_text_color_set(EWL_TEXT(label), 0, 0, 255, 190);
- ewl_text_text_append(EWL_TEXT(label), "http://www.enlightenment.org/");
- ewl_text_color_set(EWL_TEXT(label), 0, 0, 0, 255);
+ Ewl_Widget *label = user_data;
+
+ ewl_object_alignment_set(EWL_OBJECT(label), EWL_FLAG_ALIGN_CENTER);
+ ewl_text_font_set(EWL_TEXT(label), "ewl/default");
+ ewl_text_font_size_set(EWL_TEXT(label), 12);
+ ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_SOFT_SHADOW);
+ ewl_text_text_append(EWL_TEXT(label), "Welcome to Enlightenment!\n");
+ ewl_text_styles_set(EWL_TEXT(label), EWL_TEXT_STYLE_NONE);
+ ewl_text_font_set(EWL_TEXT(label), "ewl/default");
+ ewl_text_font_size_set(EWL_TEXT(label), 7);
+ ewl_text_text_append(EWL_TEXT(label), "We hope you enjoy your stay.\n"
+ "Please visit us at:\n");
+ ewl_text_color_set(EWL_TEXT(label), 0, 0, 255, 190);
+ ewl_text_text_append(EWL_TEXT(label), "http://www.enlightenment.org/");
+ ewl_text_color_set(EWL_TEXT(label), 0, 0, 0, 255);
}
static void
reveal_logo_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data)
{
- edje_object_signal_callback_add(w->theme_object, "Present*", "*",
- edje_text, user_data);
+ edje_object_signal_callback_add(w->theme_object, "Present*", "*",
+ edje_text, user_data);
}
static void
obscure_logo_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- edje_object_signal_callback_del(w->theme_object, "Present*", "*",
- edje_text);
+ edje_object_signal_callback_del(w->theme_object, "Present*", "*",
+ edje_text);
}
static void
close_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- ewl_main_quit();
+ ewl_main_quit();
}
static void
button_down(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Widget *logo = user_data;
- ewl_widget_state_set(logo, "start_tour", EWL_STATE_PERSISTENT);
+ Ewl_Widget *logo = user_data;
+ ewl_widget_state_set(logo, "start_tour", EWL_STATE_PERSISTENT);
- ewl_widget_disable(w);
+ ewl_widget_disable(w);
}
static void
quit_demo(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- ewl_main_quit();
+ ewl_main_quit();
}
int
main(int argc, char **argv)
{
- Ewl_Widget *win;
- Ewl_Widget *vbox;
- Ewl_Widget *hbox;
- Ewl_Widget *button;
- Ewl_Widget *logo;
- Ewl_Widget *label;
- char tmp[PATH_MAX];
-
- ewl_init(&argc, argv);
-
- snprintf(tmp, PATH_MAX, "%s/ewl/images/bg.edj", PACKAGE_DATA_DIR);
-
- win = ewl_window_new();
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, close_cb, NULL);
- ewl_object_size_request(EWL_OBJECT(win), 240, 320);
- ewl_theme_data_str_set(win, "/window/file", tmp);
- ewl_theme_data_str_set(win, "/window/group", "bg");
- ewl_widget_show(win);
-
- vbox = ewl_vbox_new();
- ewl_theme_data_str_set(vbox, "/vbox/file", tmp);
- ewl_theme_data_str_set(vbox, "/vbox/group", "box");
- ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_TOP);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(win), vbox);
- ewl_widget_show(vbox);
-
- /*
- * Create the label first so we can pass it to the logo's callbacks
- */
- label = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(label), NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(label), EWL_FLAG_FILL_VFILL);
-
- /*
- * Setup the custom logo which becomes the tour display area.
- */
- logo = NEW(Ewl_Widget, 1);
- ewl_widget_init(logo);
- ewl_widget_appearance_set(logo, "demo_logo");
- ewl_callback_append(logo, EWL_CALLBACK_REVEAL, reveal_logo_cb, label);
- ewl_callback_append(logo, EWL_CALLBACK_OBSCURE, obscure_logo_cb, label);
- ewl_theme_data_str_set(logo, "/demo_logo/file", tmp);
- ewl_theme_data_str_set(logo, "/demo_logo/group", "tour");
- ewl_object_preferred_inner_size_set(EWL_OBJECT(logo), 150, 150);
- ewl_object_fill_policy_set(EWL_OBJECT(logo), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(logo), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(vbox), logo);
- ewl_widget_show(logo);
-
- start_text(label, NULL, label);
- ewl_container_child_append(EWL_CONTAINER(vbox), label);
- ewl_widget_show(label);
-
- hbox = ewl_hbox_new();
- ewl_box_spacing_set(EWL_BOX(hbox), 10);
- ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(hbox);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Take the tour!");
- ewl_container_child_append(EWL_CONTAINER(hbox), button);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_down, logo);
- ewl_widget_show(button);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Quit");
- ewl_container_child_append(EWL_CONTAINER(hbox), button);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED, quit_demo, NULL);
- ewl_widget_show(button);
-
- ewl_widget_configure(win);
-
- ewl_main();
- return 0;
+ Ewl_Widget *win;
+ Ewl_Widget *vbox;
+ Ewl_Widget *hbox;
+ Ewl_Widget *button;
+ Ewl_Widget *logo;
+ Ewl_Widget *label;
+ char tmp[PATH_MAX];
+
+ ewl_init(&argc, argv);
+
+ snprintf(tmp, PATH_MAX, "%s/ewl/images/bg.edj", PACKAGE_DATA_DIR);
+
+ win = ewl_window_new();
+ ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, close_cb, NULL);
+ ewl_object_size_request(EWL_OBJECT(win), 240, 320);
+ ewl_theme_data_str_set(win, "/window/file", tmp);
+ ewl_theme_data_str_set(win, "/window/group", "bg");
+ ewl_widget_show(win);
+
+ vbox = ewl_vbox_new();
+ ewl_theme_data_str_set(vbox, "/vbox/file", tmp);
+ ewl_theme_data_str_set(vbox, "/vbox/group", "box");
+ ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_TOP);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(win), vbox);
+ ewl_widget_show(vbox);
+
+ /*
+ * Create the label first so we can pass it to the logo's callbacks
+ */
+ label = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(label), NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(label), EWL_FLAG_FILL_VFILL);
+
+ /*
+ * Setup the custom logo which becomes the tour display area.
+ */
+ logo = NEW(Ewl_Widget, 1);
+ ewl_widget_init(logo);
+ ewl_widget_appearance_set(logo, "demo_logo");
+ ewl_callback_append(logo, EWL_CALLBACK_REVEAL, reveal_logo_cb, label);
+ ewl_callback_append(logo, EWL_CALLBACK_OBSCURE, obscure_logo_cb, label);
+ ewl_theme_data_str_set(logo, "/demo_logo/file", tmp);
+ ewl_theme_data_str_set(logo, "/demo_logo/group", "tour");
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(logo), 150, 150);
+ ewl_object_fill_policy_set(EWL_OBJECT(logo), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(logo), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(vbox), logo);
+ ewl_widget_show(logo);
+
+ start_text(label, NULL, label);
+ ewl_container_child_append(EWL_CONTAINER(vbox), label);
+ ewl_widget_show(label);
+
+ hbox = ewl_hbox_new();
+ ewl_box_spacing_set(EWL_BOX(hbox), 10);
+ ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(hbox);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Take the tour!");
+ ewl_container_child_append(EWL_CONTAINER(hbox), button);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_down, logo);
+ ewl_widget_show(button);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Quit");
+ ewl_container_child_append(EWL_CONTAINER(hbox), button);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED, quit_demo, NULL);
+ ewl_widget_show(button);
+
+ ewl_widget_configure(win);
+
+ ewl_main();
+ return 0;
}
diff --git a/src/bin/ewl_test_private.h b/src/bin/ewl_test_private.h
index 4855d0b..380a6fd 100644
--- a/src/bin/ewl_test_private.h
+++ b/src/bin/ewl_test_private.h
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef EWL_TEST_PRIVATE_H
#define EWL_TEST_PRIVATE_H
@@ -11,6 +11,6 @@
#endif
#define LOG_FAILURE(buffer, len, format, args...) \
- snprintf(buf, len, "%s:%d " format, __FILE__, __LINE__, ## args)
+ snprintf(buf, len, "%s:%d " format, __FILE__, __LINE__, ## args)
#endif /* EWL_TEST_PRIVATE_H */
diff --git a/src/bin/main.c b/src/bin/main.c
index 4dcd7e8..7e0f8a2 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_io_manager.h"
@@ -36,26 +36,26 @@
static Ewl_Model *expansion_model = NULL;
static char *ewl_test_about_body =
- "The EWL Test application serves two purposes. "
- "The first is to allow us to test the different "
- "components of EWL as we develop them.\n\n"
- "The second is to allow deveopers to view "
- "tutorials and source listings for the different "
- "widgets in the system.\n\n"
- "If you develop your own EWL widget you can add "
- "a test to the test widget without needing to "
- "recompile or edit the test application.";
+ "The EWL Test application serves two purposes. "
+ "The first is to allow us to test the different "
+ "components of EWL as we develop them.\n\n"
+ "The second is to allow deveopers to view "
+ "tutorials and source listings for the different "
+ "widgets in the system.\n\n"
+ "If you develop your own EWL widget you can add "
+ "a test to the test widget without needing to "
+ "recompile or edit the test application.";
static char *ewl_test_help_body =
- "Select the test you want from the test tree under the "
- "'Tests' tab. You can then use the 'UI Tests' tab "
- "to view the UI test for that widget. The 'Unit Tests' "
- "tab will let you execute the available unit tests.\n\n"
- "To view the source for the current test click on the "
- "'Source' tab. A short tutorial on the widget will be "
- "available under the 'Tutorial' tab.\n\n"
- "If you encounter any bugs in the test application "
- "please report them to http://bugs.enlightenment.org.";
+ "Select the test you want from the test tree under the "
+ "'Tests' tab. You can then use the 'UI Tests' tab "
+ "to view the UI test for that widget. The 'Unit Tests' "
+ "tab will let you execute the available unit tests.\n\n"
+ "To view the source for the current test click on the "
+ "'Source' tab. A short tutorial on the widget will be "
+ "available under the 'Tutorial' tab.\n\n"
+ "If you encounter any bugs in the test application "
+ "please report them to http://bugs.enlightenment.org.";
static int ewl_test_setup_tests(void);
static void ewl_test_free(Ewl_Test *test);
@@ -88,13 +88,13 @@ static void ewl_test_cb_help(Ewl_Widget *w, void *ev, void *data);
static void ewl_test_cb_about(Ewl_Widget *w, void *ev, void *data);
static void *ewl_test_cb_category_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
static int ewl_test_cb_category_expandable(void *data, unsigned int row);
static void *ewl_test_cb_category_expansion_fetch(void *data, unsigned int row);
static Ewl_Model *ewl_test_cb_category_expansion_model_fetch(void *data,
- unsigned int row);
+ unsigned int row);
static void *ewl_test_cb_expansion_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
static void ewl_test_cb_test_selected(Ewl_Widget *w, void *ev, void *data);
static Ewl_Widget *cb_unit_test_header_fetch(void *data, unsigned int column);
@@ -119,1245 +119,1245 @@ static Ewl_Test *current_test = NULL;
int
main(int argc, char **argv)
{
- int i, ret = 0;
- int unit_test = 0, ran_test = 0, all_tests = 0, profile_tests = 0;
- double start_time = 0, end_time = 0;
-
- /* init the randomizer */
- srand(1);
-
- /* check for any flags before ewl_init to avoid opening the display */
- for (i = 0; i < argc; i++)
- {
- if (!strncmp(argv[i], "-list", 5))
- {
- ewl_test_print_tests();
- exit(0);
- }
- else if (!strncmp(argv[i], "-h", 2) ||
- !strncmp(argv[i], "-help", 5) ||
- !strncmp(argv[i], "--help", 6))
- {
- printf("Usage: %s [options] [test name]\n"
- "\t-all\tRun tests for all widgets\n"
- "\t-help\tDisplay this help text\n"
- "\t-list\tPrint available tests\n"
- "\t-profile\tTime test results\n"
- "\t-p\tHide passed test information\n"
- "\t-d\tEnable all debugging output\n"
- "\t-unit\tRun unit tests\n",
- argv[0]);
- exit(0);
- }
- else if (!strncmp(argv[i], "-profile", 8))
- profile_tests = 1;
- else if (!strncmp(argv[i], "-p", 2))
- hide_passed = 1;
- else if (!strncmp(argv[i], "-d", 2))
- show_debug = 1;
- else if (!strncmp(argv[i], "-all", 4))
- all_tests = 1;
- else if (!strncmp(argv[i], "-unit", 5))
- {
- unit_test = 1;
- setenv("EWL_ENGINE_NAME", "evas_buffer", 1);
- }
- }
-
- /* initialize the ewl library */
- if (!ewl_init(&argc, argv))
- {
- printf("Unable to init Ewl.\n");
- return 1;
- }
-
- if (!ewl_test_setup_tests())
- {
- printf("Unable to setup tests.\n");
- return 1;
- }
-
- if (profile_tests) start_time = ecore_time_get();
-
- /* check for any flags */
- for (i = 0; i < argc || all_tests; i++)
- {
- Ewl_Test *t;
-
- /* see if this thing was a test to run */
- ecore_list_first_goto(tests);
- while ((t = ecore_list_next(tests)))
- {
- if (all_tests || !strcasecmp(argv[i], t->name))
- {
- if (unit_test)
- ret = run_unit_tests(t);
- else
- run_window_test(t, MAIN_WIDTH, MAIN_HEIGHT);
-
- ran_test ++;
- if (!all_tests) break;
- }
- }
- if (all_tests) break;
- }
-
- if (profile_tests)
- {
- end_time = ecore_time_get();
- printf("Tests completed in %.03fs\n", end_time - start_time);
- }
-
- /* no passed in tests, run the main test app */
- if (!ran_test)
- {
- Ewl_Test test;
-
- test.name = "The Enlightened Widget Library Test App";
- test.func = create_main_test_window;
- test.filename = NULL;
- test.tip = NULL;
-
- run_window_test(&test, MAIN_WIDTH, MAIN_HEIGHT);
- }
-
- if (!unit_test)
- ewl_main();
- else
- ewl_shutdown();
-
- if (unit_test && !ran_test)
- fprintf(stderr, "Must supply either -all parameter or test "
- "name when running unit tests.\n");
-
- if (tests) ecore_list_destroy(tests);
- if (tests_path_group) ecore_path_group_del(tests_path_group);
-
- return ret;
+ int i, ret = 0;
+ int unit_test = 0, ran_test = 0, all_tests = 0, profile_tests = 0;
+ double start_time = 0, end_time = 0;
+
+ /* init the randomizer */
+ srand(1);
+
+ /* check for any flags before ewl_init to avoid opening the display */
+ for (i = 0; i < argc; i++)
+ {
+ if (!strncmp(argv[i], "-list", 5))
+ {
+ ewl_test_print_tests();
+ exit(0);
+ }
+ else if (!strncmp(argv[i], "-h", 2) ||
+ !strncmp(argv[i], "-help", 5) ||
+ !strncmp(argv[i], "--help", 6))
+ {
+ printf("Usage: %s [options] [test name]\n"
+ "\t-all\tRun tests for all widgets\n"
+ "\t-help\tDisplay this help text\n"
+ "\t-list\tPrint available tests\n"
+ "\t-profile\tTime test results\n"
+ "\t-p\tHide passed test information\n"
+ "\t-d\tEnable all debugging output\n"
+ "\t-unit\tRun unit tests\n",
+ argv[0]);
+ exit(0);
+ }
+ else if (!strncmp(argv[i], "-profile", 8))
+ profile_tests = 1;
+ else if (!strncmp(argv[i], "-p", 2))
+ hide_passed = 1;
+ else if (!strncmp(argv[i], "-d", 2))
+ show_debug = 1;
+ else if (!strncmp(argv[i], "-all", 4))
+ all_tests = 1;
+ else if (!strncmp(argv[i], "-unit", 5))
+ {
+ unit_test = 1;
+ setenv("EWL_ENGINE_NAME", "evas_buffer", 1);
+ }
+ }
+
+ /* initialize the ewl library */
+ if (!ewl_init(&argc, argv))
+ {
+ printf("Unable to init Ewl.\n");
+ return 1;
+ }
+
+ if (!ewl_test_setup_tests())
+ {
+ printf("Unable to setup tests.\n");
+ return 1;
+ }
+
+ if (profile_tests) start_time = ecore_time_get();
+
+ /* check for any flags */
+ for (i = 0; i < argc || all_tests; i++)
+ {
+ Ewl_Test *t;
+
+ /* see if this thing was a test to run */
+ ecore_list_first_goto(tests);
+ while ((t = ecore_list_next(tests)))
+ {
+ if (all_tests || !strcasecmp(argv[i], t->name))
+ {
+ if (unit_test)
+ ret = run_unit_tests(t);
+ else
+ run_window_test(t, MAIN_WIDTH, MAIN_HEIGHT);
+
+ ran_test ++;
+ if (!all_tests) break;
+ }
+ }
+ if (all_tests) break;
+ }
+
+ if (profile_tests)
+ {
+ end_time = ecore_time_get();
+ printf("Tests completed in %.03fs\n", end_time - start_time);
+ }
+
+ /* no passed in tests, run the main test app */
+ if (!ran_test)
+ {
+ Ewl_Test test;
+
+ test.name = "The Enlightened Widget Library Test App";
+ test.func = create_main_test_window;
+ test.filename = NULL;
+ test.tip = NULL;
+
+ run_window_test(&test, MAIN_WIDTH, MAIN_HEIGHT);
+ }
+
+ if (!unit_test)
+ ewl_main();
+ else
+ ewl_shutdown();
+
+ if (unit_test && !ran_test)
+ fprintf(stderr, "Must supply either -all parameter or test "
+ "name when running unit tests.\n");
+
+ if (tests) ecore_list_destroy(tests);
+ if (tests_path_group) ecore_path_group_del(tests_path_group);
+
+ return ret;
}
static void
ewl_test_stderr_disable(void)
{
- static int null_fd = -1;
-
- /*
- * If stderr is already disabled, bail out early.
- */
- if (show_debug || saved_stderr >= 0)
- return;
-
- /*
- * Open /dev/null the first time it's necessary, and maintain a
- * reference to it for the lifetime of the test app.
- */
- if (null_fd < 0)
- null_fd = open(NULL_PATH, O_RDONLY);
-
- if (null_fd >= 0)
- {
- saved_stderr = dup(fileno(stderr));
-
- if (dup2(null_fd, fileno(stderr)) < 0)
- {
- close(saved_stderr);
- saved_stderr = -1;
- }
- }
+ static int null_fd = -1;
+
+ /*
+ * If stderr is already disabled, bail out early.
+ */
+ if (show_debug || saved_stderr >= 0)
+ return;
+
+ /*
+ * Open /dev/null the first time it's necessary, and maintain a
+ * reference to it for the lifetime of the test app.
+ */
+ if (null_fd < 0)
+ null_fd = open(NULL_PATH, O_RDONLY);
+
+ if (null_fd >= 0)
+ {
+ saved_stderr = dup(fileno(stderr));
+
+ if (dup2(null_fd, fileno(stderr)) < 0)
+ {
+ close(saved_stderr);
+ saved_stderr = -1;
+ }
+ }
}
static void
ewl_test_stderr_enable(void)
{
- /*
- * Return early if stderr is not disabled.
- */
- if (show_debug || saved_stderr < 0)
- return;
-
- dup2(saved_stderr, fileno(stderr));
- saved_stderr = -1;
+ /*
+ * Return early if stderr is not disabled.
+ */
+ if (show_debug || saved_stderr < 0)
+ return;
+
+ dup2(saved_stderr, fileno(stderr));
+ saved_stderr = -1;
}
static int
ewl_test_cb_unit_test_timer(void *data)
{
- char buf[1024];
- Ewl_Unit_Test *unit_tests;
- int ret = 1;
-
- unit_tests = data;
- if (unit_tests[current_unit_test].func)
- {
- int val;
- Ewl_Widget *tree, *progress, *stat;
-
- stat = ewl_widget_name_find("statusbar");
- ewl_statusbar_push(EWL_STATUSBAR(stat),
- (char *)unit_tests[current_unit_test].name);
- if (unit_tests[current_unit_test].quiet)
- ewl_test_stderr_disable();
- val = unit_tests[current_unit_test].func(buf, sizeof(buf));
- if (unit_tests[current_unit_test].quiet)
- ewl_test_stderr_enable();
- ewl_statusbar_pop(EWL_STATUSBAR(stat));
-
- tree = ewl_widget_name_find("unit_test_tree");
- progress = ewl_widget_name_find("unit_test_progress");
-
- unit_tests[current_unit_test].status = val;
- unit_tests[current_unit_test].failure_reason = (val ? NULL : strdup(buf));
-
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
-
- ewl_range_value_set(EWL_RANGE(progress),
- (double)(++current_unit_test));
- }
- else
- {
- unit_test_timer = NULL;
- current_unit_test = 0;
- ret = 0;
- }
-
- return ret;
+ char buf[1024];
+ Ewl_Unit_Test *unit_tests;
+ int ret = 1;
+
+ unit_tests = data;
+ if (unit_tests[current_unit_test].func)
+ {
+ int val;
+ Ewl_Widget *tree, *progress, *stat;
+
+ stat = ewl_widget_name_find("statusbar");
+ ewl_statusbar_push(EWL_STATUSBAR(stat),
+ (char *)unit_tests[current_unit_test].name);
+ if (unit_tests[current_unit_test].quiet)
+ ewl_test_stderr_disable();
+ val = unit_tests[current_unit_test].func(buf, sizeof(buf));
+ if (unit_tests[current_unit_test].quiet)
+ ewl_test_stderr_enable();
+ ewl_statusbar_pop(EWL_STATUSBAR(stat));
+
+ tree = ewl_widget_name_find("unit_test_tree");
+ progress = ewl_widget_name_find("unit_test_progress");
+
+ unit_tests[current_unit_test].status = val;
+ unit_tests[current_unit_test].failure_reason = (val ? NULL : strdup(buf));
+
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+
+ ewl_range_value_set(EWL_RANGE(progress),
+ (double)(++current_unit_test));
+ }
+ else
+ {
+ unit_test_timer = NULL;
+ current_unit_test = 0;
+ ret = 0;
+ }
+
+ return ret;
}
static void
ewl_test_cb_delete_window(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- if ((--window_count) < 1)
- ewl_main_quit();
+ if ((--window_count) < 1)
+ ewl_main_quit();
}
static void
ewl_test_cb_exit(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_main_quit();
+ ewl_main_quit();
}
static void
ewl_test_print_tests(void)
{
- Ewl_Test *t;
+ Ewl_Test *t;
- printf("Ewl_Test Test List:\n");
- ecore_list_first_goto(tests);
- while ((t = ecore_list_next(tests)))
- printf(" %s\n", t->name);
+ printf("Ewl_Test Test List:\n");
+ ecore_list_first_goto(tests);
+ while ((t = ecore_list_next(tests)))
+ printf(" %s\n", t->name);
}
static void
run_window_test(Ewl_Test *test, int width, int height)
{
- Ewl_Widget *win, *box;
+ Ewl_Widget *win, *box;
- /* nothing to do if there is no ui test */
- if (!test->func) return;
+ /* nothing to do if there is no ui test */
+ if (!test->func) return;
- win = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(win), test->name);
- ewl_window_name_set(EWL_WINDOW(win), test->name);
- ewl_window_class_set(EWL_WINDOW(win), "Ewl Test Window");
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
- ewl_test_cb_delete_window, NULL);
- if ((width > 0) && (height > 0))
- ewl_object_size_request(EWL_OBJECT(win), width, height);
+ win = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(win), test->name);
+ ewl_window_name_set(EWL_WINDOW(win), test->name);
+ ewl_window_class_set(EWL_WINDOW(win), "Ewl Test Window");
+ ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
+ ewl_test_cb_delete_window, NULL);
+ if ((width > 0) && (height > 0))
+ ewl_object_size_request(EWL_OBJECT(win), width, height);
- ewl_widget_show(win);
+ ewl_widget_show(win);
- box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(win), box);
- ewl_widget_show(box);
- window_count ++;
+ box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(win), box);
+ ewl_widget_show(box);
+ window_count ++;
- test->func(EWL_CONTAINER(box));
+ test->func(EWL_CONTAINER(box));
}
/* Return 0 if all tests pased, other wise return the number of failures */
static int
run_unit_tests(Ewl_Test *test)
{
- int i, failures = 0;
- char buf[1024];
- buf[0] = '\0';
+ int i, failures = 0;
+ char buf[1024];
+ buf[0] = '\0';
- /* no unit tests, nothign to do */
- if (!test->unit_tests) return 0;
+ /* no unit tests, nothign to do */
+ if (!test->unit_tests) return 0;
- for (i = 0; test->unit_tests[i].func; i++)
- {
- int ret;
+ for (i = 0; test->unit_tests[i].func; i++)
+ {
+ int ret;
- if (test->unit_tests[i].quiet)
- ewl_test_stderr_disable();
+ if (test->unit_tests[i].quiet)
+ ewl_test_stderr_disable();
- ret = test->unit_tests[i].func(buf, sizeof(buf));
- if (!ret || !hide_passed)
- {
- printf("Running %s: ", test->unit_tests[i].name);
- printf("%s %s\n", (ret ? "PASSED" : "FAILED"),
- (ret ? "" : buf));
- }
- buf[0] = '\0';
+ ret = test->unit_tests[i].func(buf, sizeof(buf));
+ if (!ret || !hide_passed)
+ {
+ printf("Running %s: ", test->unit_tests[i].name);
+ printf("%s %s\n", (ret ? "PASSED" : "FAILED"),
+ (ret ? "" : buf));
+ }
+ buf[0] = '\0';
- if (!ret) failures++;
+ if (!ret) failures++;
- if (test->unit_tests[i].quiet)
- ewl_test_stderr_enable();
- }
+ if (test->unit_tests[i].quiet)
+ ewl_test_stderr_enable();
+ }
- return failures;
+ return failures;
}
static void
statusbar_text_set(const char *text)
{
- Ewl_Widget *stat;
- char info[1024];
+ Ewl_Widget *stat;
+ char info[1024];
- stat = ewl_widget_name_find("statusbar");
- snprintf(info, sizeof(info), "%s Information/Tests", text);
- ewl_statusbar_push(EWL_STATUSBAR(stat), info);
+ stat = ewl_widget_name_find("statusbar");
+ snprintf(info, sizeof(info), "%s Information/Tests", text);
+ ewl_statusbar_push(EWL_STATUSBAR(stat), info);
}
static void
run_unit_test_boxed(Ewl_Test *t)
{
- Ewl_Widget *c, *n;
+ Ewl_Widget *c, *n;
- fill_source_text(t);
- fill_tutorial_text(t);
- setup_unit_tests(t);
+ fill_source_text(t);
+ fill_tutorial_text(t);
+ setup_unit_tests(t);
- statusbar_text_set(t->name);
+ statusbar_text_set(t->name);
- c = ewl_widget_name_find("execute_box");
- ewl_container_reset(EWL_CONTAINER(c));
+ c = ewl_widget_name_find("execute_box");
+ ewl_container_reset(EWL_CONTAINER(c));
- c = ewl_widget_name_find("unit_test_box");
+ c = ewl_widget_name_find("unit_test_box");
- n = ewl_widget_name_find("test_notebook");
- ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), c);
+ n = ewl_widget_name_find("test_notebook");
+ ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), c);
}
static void
run_test_boxed(Ewl_Test *t)
{
- Ewl_Widget *c, *n;
+ Ewl_Widget *c, *n;
- statusbar_text_set(t->name);
+ statusbar_text_set(t->name);
- fill_source_text(t);
- fill_tutorial_text(t);
- setup_unit_tests(t);
+ fill_source_text(t);
+ fill_tutorial_text(t);
+ setup_unit_tests(t);
- /* make sure we have a function if we aren't a straight unit test */
- if ((t->type != EWL_TEST_TYPE_UNIT) && (!t->func))
- {
- printf("WARNING: No UI test function defined for (%s).\n",
- t->name);
- return;
- }
+ /* make sure we have a function if we aren't a straight unit test */
+ if ((t->type != EWL_TEST_TYPE_UNIT) && (!t->func))
+ {
+ printf("WARNING: No UI test function defined for (%s).\n",
+ t->name);
+ return;
+ }
- c = ewl_widget_name_find("execute_box");
- ewl_container_reset(EWL_CONTAINER(c));
+ c = ewl_widget_name_find("execute_box");
+ ewl_container_reset(EWL_CONTAINER(c));
- t->func(EWL_CONTAINER(c));
+ t->func(EWL_CONTAINER(c));
- n = ewl_widget_name_find("test_notebook");
- ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), c);
+ n = ewl_widget_name_find("test_notebook");
+ ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), c);
}
static int
ewl_test_setup_tests(void)
{
- Ecore_List *list = NULL;
- char *name = NULL;
+ Ecore_List *list = NULL;
+ char *name = NULL;
- if (tests) return 1;
+ if (tests) return 1;
- tests = ecore_list_new();
- if (!tests) return 0;
+ tests = ecore_list_new();
+ if (!tests) return 0;
- ecore_list_free_cb_set(tests, ECORE_FREE_CB(ewl_test_free));
+ ecore_list_free_cb_set(tests, ECORE_FREE_CB(ewl_test_free));
- tests_path_group = ecore_path_group_new();
- ecore_path_group_add(tests_path_group, PACKAGE_LIB_DIR "/ewl/tests");
- list = ecore_plugin_available_get(tests_path_group);
- /* no tests found ... */
- if (!list) return 0;
+ tests_path_group = ecore_path_group_new();
+ ecore_path_group_add(tests_path_group, PACKAGE_LIB_DIR "/ewl/tests");
+ list = ecore_plugin_available_get(tests_path_group);
+ /* no tests found ... */
+ if (!list) return 0;
- while ((name = ecore_list_first_goto(list)))
- {
- Ecore_Plugin *plugin;
- void (*func_info)(Ewl_Test *test);
+ while ((name = ecore_list_first_goto(list)))
+ {
+ Ecore_Plugin *plugin;
+ void (*func_info)(Ewl_Test *test);
- plugin = ecore_plugin_load(tests_path_group, name, NULL);
- if (!plugin)
- continue;
+ plugin = ecore_plugin_load(tests_path_group, name, NULL);
+ if (!plugin)
+ continue;
- /* the UI test info */
- func_info = ecore_plugin_symbol_get(plugin, "test_info");
- if (func_info)
- {
- Ewl_Test *t;
+ /* the UI test info */
+ func_info = ecore_plugin_symbol_get(plugin, "test_info");
+ if (func_info)
+ {
+ Ewl_Test *t;
- t = calloc(1, sizeof(Ewl_Test));
- func_info(t);
- t->plugin = plugin;
- ecore_list_append(tests, t);
- }
+ t = calloc(1, sizeof(Ewl_Test));
+ func_info(t);
+ t->plugin = plugin;
+ ecore_list_append(tests, t);
+ }
- ecore_list_remove_destroy(list);
- }
- ecore_list_destroy(list);
+ ecore_list_remove_destroy(list);
+ }
+ ecore_list_destroy(list);
- /* no tests found ... */
- if (ecore_list_count(tests) == 0) return 0;
+ /* no tests found ... */
+ if (ecore_list_count(tests) == 0) return 0;
- /* sort the tests in alphabetical order */
- ecore_list_sort(tests, ECORE_COMPARE_CB(ewl_test_compare),
- ECORE_SORT_MIN);
+ /* sort the tests in alphabetical order */
+ ecore_list_sort(tests, ECORE_COMPARE_CB(ewl_test_compare),
+ ECORE_SORT_MIN);
- return 1;
+ return 1;
}
static void
ewl_test_free(Ewl_Test *test)
{
- if (test->plugin) ecore_plugin_unload(test->plugin);
- free(test);
+ if (test->plugin) ecore_plugin_unload(test->plugin);
+ free(test);
}
static int
ewl_test_compare(Ewl_Test *test1, Ewl_Test *test2)
{
- return strcasecmp(test1->name, test2->name);
+ return strcasecmp(test1->name, test2->name);
}
static int
create_main_test_window(Ewl_Container *box)
{
- Ewl_Test *t;
- Ewl_Widget *menubar, *note, *tree, *o, *o2;
- Ecore_List *categories;
- Ecore_List *simple, *adv, *container, *misc, *unit;
- Ewl_Model *model;
- Ewl_View *view;
-
- Ewl_Menu_Info file_menu[] = {
- {"Exit", NULL, ewl_test_cb_exit},
- {NULL, NULL, NULL}
- };
-
- Ewl_Menu_Info help_menu[] = {
- {"About Ewl_Test ...", NULL, ewl_test_cb_about},
- {"Ewl Test Help ...", NULL, ewl_test_cb_help},
- {NULL, NULL, NULL}
- };
-
- Ewl_Menubar_Info menubar_info[] = {
- {"File", file_menu},
- {"Help", help_menu},
- {NULL, NULL}
- };
-
- file_menu[0].img = ewl_icon_theme_icon_path_get(EWL_ICON_APPLICATION_EXIT,
- EWL_ICON_SIZE_SMALL);
- help_menu[0].img = ewl_icon_theme_icon_path_get(EWL_ICON_HELP_ABOUT,
- EWL_ICON_SIZE_SMALL);
- help_menu[1].img = ewl_icon_theme_icon_path_get(EWL_ICON_HELP_FAQ,
- EWL_ICON_SIZE_SMALL);
-
- menubar = ewl_hmenubar_new();
- ewl_container_child_append(EWL_CONTAINER(box), menubar);
- ewl_menubar_from_info(EWL_MENUBAR(menubar), menubar_info);
- ewl_widget_show(menubar);
-
- note = ewl_notebook_new();
- ewl_container_child_append(box, note);
- ewl_widget_name_set(note, "test_notebook");
- ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(note),
- EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(note);
-
- /* our data will be a list of lists. each of the child lists will
- * hold a set of tests to be run */
- categories = ecore_list_new();
- ecore_list_free_cb_set(categories, ECORE_FREE_CB(ecore_list_destroy));
-
- simple = ecore_list_new();
- ecore_list_append(categories, simple);
-
- adv = ecore_list_new();
- ecore_list_append(categories, adv);
-
- container = ecore_list_new();
- ecore_list_append(categories, container);
-
- misc = ecore_list_new();
- ecore_list_append(categories, misc);
-
- unit = ecore_list_new();
- ecore_list_append(categories, unit);
-
- model = ewl_model_new();
- ewl_model_data_fetch_set(model, ewl_test_cb_category_fetch);
- ewl_model_data_count_set(model, ewl_model_cb_ecore_list_count);
- ewl_model_data_expandable_set(model, ewl_test_cb_category_expandable);
- ewl_model_data_unref_set(model,
- EWL_MODEL_DATA_UNREF(ecore_list_destroy));
- ewl_model_expansion_data_fetch_set(model,
- ewl_test_cb_category_expansion_fetch);
- ewl_model_expansion_model_fetch_set(model,
- ewl_test_cb_category_expansion_model_fetch);
-
- tree = ewl_tree_new();
- ewl_container_child_append(EWL_CONTAINER(note), tree);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), tree, "Tests");
- ewl_tree_headers_visible_set(EWL_TREE(tree), FALSE);
- ewl_tree_column_count_set(EWL_TREE(tree), 1);
- ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
- ewl_mvc_model_set(EWL_MVC(tree), model);
- ewl_mvc_view_set(EWL_MVC(tree), ewl_label_view_get());
- ewl_mvc_data_set(EWL_MVC(tree), categories);
- ewl_callback_append(tree, EWL_CALLBACK_VALUE_CHANGED,
- ewl_test_cb_test_selected, NULL);
- ewl_callback_append(tree, EWL_CALLBACK_DESTROY, ewl_cb_mvc_free,
- NULL);
- ewl_widget_show(tree);
-
-
- /* add the tests to the category rows */
- ecore_list_first_goto(tests);
- while ((t = ecore_list_next(tests)))
- {
- Ecore_List *parent = NULL;
-
- if (t->type == EWL_TEST_TYPE_SIMPLE)
- parent = simple;
- else if (t->type == EWL_TEST_TYPE_ADVANCED)
- parent = adv;
- else if (t->type == EWL_TEST_TYPE_CONTAINER)
- parent = container;
- else if (t->type == EWL_TEST_TYPE_MISC)
- parent = misc;
- else if (t->type == EWL_TEST_TYPE_UNIT)
- parent = unit;
-
- ecore_list_append(parent, t);
-
- /* if we've got unit tests add to the unit category */
- if ((parent != unit) &&
- (t->unit_tests && t->unit_tests[0].func))
- ecore_list_append(unit, t);
- }
-
- o = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(note), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_ALL);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o, "UI Test");
- ewl_widget_name_set(o, "execute_box");
- ewl_widget_show(o);
-
- o = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(note), o);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o, "Unit Tests");
- ewl_widget_name_set(o, "unit_test_box");
- ewl_widget_show(o);
-
- model = ewl_model_new();
- ewl_model_data_fetch_set(model, cb_unit_test_fetch);
- ewl_model_data_header_fetch_set(model, cb_unit_test_header_data_fetch);
- ewl_model_data_count_set(model, cb_unit_test_count);
-
- view = ewl_label_view_get();
- ewl_view_header_fetch_set(view, cb_unit_test_header_fetch);
-
- o2 = ewl_tree_new();
- ewl_tree_column_count_set(EWL_TREE(o2), 3);
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_mvc_model_set(EWL_MVC(o2), model);
- ewl_mvc_view_set(EWL_MVC(o2), view);
- ewl_widget_name_set(o2, "unit_test_tree");
- ewl_callback_append(o2, EWL_CALLBACK_DESTROY, ewl_cb_mvc_free,
- NULL);
- ewl_widget_show(o2);
-
- o2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HFILL);
- ewl_widget_show(o2);
-
- o = o2;
-
- o2 = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_button_label_set(EWL_BUTTON(o2), "Run unit tests");
- ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_run_unit_tests, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_SHRINK);
- ewl_widget_name_set(o2, "unit_test_button");
- ewl_widget_show(o2);
-
- o2 = ewl_progressbar_new();
- ewl_widget_name_set(o2, "unit_test_progress");
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_widget_show(o2);
-
- o2 = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(note), o2);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o2, "Source");
- ewl_widget_name_set(o2, "source_pane");
- ewl_widget_show(o2);
-
- o2 = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(note), o2);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o2, "Tutorial");
- ewl_widget_show(o2);
-
- o = ewl_text_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_name_set(o, "tutorial_text");
- ewl_text_selectable_set(EWL_TEXT(o), TRUE);
- ewl_text_wrap_set(EWL_TEXT(o), EWL_TEXT_WRAP_WORD);
- ewl_widget_show(o);
-
- o = ewl_statusbar_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_statusbar_right_show(EWL_STATUSBAR(o));
- ewl_statusbar_push(EWL_STATUSBAR(o), "Select Test");
- ewl_widget_name_set(o, "statusbar");
- ewl_widget_show(o);
-
- /* create a label for the mouse coordinates */
- o2 = ewl_label_new();
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_MOUSE_MOVE,
- statusbar_label_update, o2);
- ewl_widget_show(o2);
-
- return 1;
+ Ewl_Test *t;
+ Ewl_Widget *menubar, *note, *tree, *o, *o2;
+ Ecore_List *categories;
+ Ecore_List *simple, *adv, *container, *misc, *unit;
+ Ewl_Model *model;
+ Ewl_View *view;
+
+ Ewl_Menu_Info file_menu[] = {
+ {"Exit", NULL, ewl_test_cb_exit},
+ {NULL, NULL, NULL}
+ };
+
+ Ewl_Menu_Info help_menu[] = {
+ {"About Ewl_Test ...", NULL, ewl_test_cb_about},
+ {"Ewl Test Help ...", NULL, ewl_test_cb_help},
+ {NULL, NULL, NULL}
+ };
+
+ Ewl_Menubar_Info menubar_info[] = {
+ {"File", file_menu},
+ {"Help", help_menu},
+ {NULL, NULL}
+ };
+
+ file_menu[0].img = ewl_icon_theme_icon_path_get(EWL_ICON_APPLICATION_EXIT,
+ EWL_ICON_SIZE_SMALL);
+ help_menu[0].img = ewl_icon_theme_icon_path_get(EWL_ICON_HELP_ABOUT,
+ EWL_ICON_SIZE_SMALL);
+ help_menu[1].img = ewl_icon_theme_icon_path_get(EWL_ICON_HELP_FAQ,
+ EWL_ICON_SIZE_SMALL);
+
+ menubar = ewl_hmenubar_new();
+ ewl_container_child_append(EWL_CONTAINER(box), menubar);
+ ewl_menubar_from_info(EWL_MENUBAR(menubar), menubar_info);
+ ewl_widget_show(menubar);
+
+ note = ewl_notebook_new();
+ ewl_container_child_append(box, note);
+ ewl_widget_name_set(note, "test_notebook");
+ ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(note),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(note);
+
+ /* our data will be a list of lists. each of the child lists will
+ * hold a set of tests to be run */
+ categories = ecore_list_new();
+ ecore_list_free_cb_set(categories, ECORE_FREE_CB(ecore_list_destroy));
+
+ simple = ecore_list_new();
+ ecore_list_append(categories, simple);
+
+ adv = ecore_list_new();
+ ecore_list_append(categories, adv);
+
+ container = ecore_list_new();
+ ecore_list_append(categories, container);
+
+ misc = ecore_list_new();
+ ecore_list_append(categories, misc);
+
+ unit = ecore_list_new();
+ ecore_list_append(categories, unit);
+
+ model = ewl_model_new();
+ ewl_model_data_fetch_set(model, ewl_test_cb_category_fetch);
+ ewl_model_data_count_set(model, ewl_model_cb_ecore_list_count);
+ ewl_model_data_expandable_set(model, ewl_test_cb_category_expandable);
+ ewl_model_data_unref_set(model,
+ EWL_MODEL_DATA_UNREF(ecore_list_destroy));
+ ewl_model_expansion_data_fetch_set(model,
+ ewl_test_cb_category_expansion_fetch);
+ ewl_model_expansion_model_fetch_set(model,
+ ewl_test_cb_category_expansion_model_fetch);
+
+ tree = ewl_tree_new();
+ ewl_container_child_append(EWL_CONTAINER(note), tree);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), tree, "Tests");
+ ewl_tree_headers_visible_set(EWL_TREE(tree), FALSE);
+ ewl_tree_column_count_set(EWL_TREE(tree), 1);
+ ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
+ ewl_mvc_model_set(EWL_MVC(tree), model);
+ ewl_mvc_view_set(EWL_MVC(tree), ewl_label_view_get());
+ ewl_mvc_data_set(EWL_MVC(tree), categories);
+ ewl_callback_append(tree, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_test_cb_test_selected, NULL);
+ ewl_callback_append(tree, EWL_CALLBACK_DESTROY, ewl_cb_mvc_free,
+ NULL);
+ ewl_widget_show(tree);
+
+
+ /* add the tests to the category rows */
+ ecore_list_first_goto(tests);
+ while ((t = ecore_list_next(tests)))
+ {
+ Ecore_List *parent = NULL;
+
+ if (t->type == EWL_TEST_TYPE_SIMPLE)
+ parent = simple;
+ else if (t->type == EWL_TEST_TYPE_ADVANCED)
+ parent = adv;
+ else if (t->type == EWL_TEST_TYPE_CONTAINER)
+ parent = container;
+ else if (t->type == EWL_TEST_TYPE_MISC)
+ parent = misc;
+ else if (t->type == EWL_TEST_TYPE_UNIT)
+ parent = unit;
+
+ ecore_list_append(parent, t);
+
+ /* if we've got unit tests add to the unit category */
+ if ((parent != unit) &&
+ (t->unit_tests && t->unit_tests[0].func))
+ ecore_list_append(unit, t);
+ }
+
+ o = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(note), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_ALL);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o, "UI Test");
+ ewl_widget_name_set(o, "execute_box");
+ ewl_widget_show(o);
+
+ o = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(note), o);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o, "Unit Tests");
+ ewl_widget_name_set(o, "unit_test_box");
+ ewl_widget_show(o);
+
+ model = ewl_model_new();
+ ewl_model_data_fetch_set(model, cb_unit_test_fetch);
+ ewl_model_data_header_fetch_set(model, cb_unit_test_header_data_fetch);
+ ewl_model_data_count_set(model, cb_unit_test_count);
+
+ view = ewl_label_view_get();
+ ewl_view_header_fetch_set(view, cb_unit_test_header_fetch);
+
+ o2 = ewl_tree_new();
+ ewl_tree_column_count_set(EWL_TREE(o2), 3);
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_mvc_model_set(EWL_MVC(o2), model);
+ ewl_mvc_view_set(EWL_MVC(o2), view);
+ ewl_widget_name_set(o2, "unit_test_tree");
+ ewl_callback_append(o2, EWL_CALLBACK_DESTROY, ewl_cb_mvc_free,
+ NULL);
+ ewl_widget_show(o2);
+
+ o2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(o2);
+
+ o = o2;
+
+ o2 = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_button_label_set(EWL_BUTTON(o2), "Run unit tests");
+ ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_run_unit_tests, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_name_set(o2, "unit_test_button");
+ ewl_widget_show(o2);
+
+ o2 = ewl_progressbar_new();
+ ewl_widget_name_set(o2, "unit_test_progress");
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_widget_show(o2);
+
+ o2 = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(note), o2);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o2, "Source");
+ ewl_widget_name_set(o2, "source_pane");
+ ewl_widget_show(o2);
+
+ o2 = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(note), o2);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), o2, "Tutorial");
+ ewl_widget_show(o2);
+
+ o = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_name_set(o, "tutorial_text");
+ ewl_text_selectable_set(EWL_TEXT(o), TRUE);
+ ewl_text_wrap_set(EWL_TEXT(o), EWL_TEXT_WRAP_WORD);
+ ewl_widget_show(o);
+
+ o = ewl_statusbar_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_statusbar_right_show(EWL_STATUSBAR(o));
+ ewl_statusbar_push(EWL_STATUSBAR(o), "Select Test");
+ ewl_widget_name_set(o, "statusbar");
+ ewl_widget_show(o);
+
+ /* create a label for the mouse coordinates */
+ o2 = ewl_label_new();
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_MOUSE_MOVE,
+ statusbar_label_update, o2);
+ ewl_widget_show(o2);
+
+ return 1;
}
static void
statusbar_label_update(Ewl_Widget *w __UNUSED__, void *ev, void *data)
{
- Ewl_Event_Mouse *event;
- char buf[265];
+ Ewl_Event_Mouse *event;
+ char buf[265];
- event = EWL_EVENT_MOUSE(ev);
+ event = EWL_EVENT_MOUSE(ev);
- snprintf(buf, sizeof(buf), "x: %d y: %d", event->x, event->y);
- ewl_label_text_set(EWL_LABEL(data), buf);
+ snprintf(buf, sizeof(buf), "x: %d y: %d", event->x, event->y);
+ ewl_label_text_set(EWL_LABEL(data), buf);
}
static void
fill_source_text(Ewl_Test *test)
{
- char *txt;
- char filename[PATH_MAX];
+ char *txt;
+ char filename[PATH_MAX];
- snprintf(filename, sizeof(filename),
- PACKAGE_DATA_DIR "/ewl/examples/%s", test->filename);
+ snprintf(filename, sizeof(filename),
+ PACKAGE_DATA_DIR "/ewl/examples/%s", test->filename);
- txt = read_file(filename);
- text_parse(txt);
- if (txt) free(txt);
+ txt = read_file(filename);
+ text_parse(txt);
+ if (txt) free(txt);
}
static void
fill_tutorial_text(Ewl_Test *test)
{
- char *txt, *file, *p;
- char filename[PATH_MAX];
-
- file = strdup(test->filename);
- p = strrchr(file, '_');
- if ((p != NULL) && (*p != '\0')) *p = '\0';
-
- snprintf(filename, sizeof(filename),
- PACKAGE_DATA_DIR "/ewl/tutorials/%s.dox", file);
-
- txt = read_file(filename);
- tutorial_parse(txt);
- if (txt) free(txt);
+ char *txt, *file, *p;
+ char filename[PATH_MAX];
+
+ file = strdup(test->filename);
+ p = strrchr(file, '_');
+ if ((p != NULL) && (*p != '\0')) *p = '\0';
+
+ snprintf(filename, sizeof(filename),
+ PACKAGE_DATA_DIR "/ewl/tutorials/%s.dox", file);
+
+ txt = read_file(filename);
+ tutorial_parse(txt);
+ if (txt) free(txt);
}
static char *
read_file(const char *filename)
{
- char *str = NULL;
- struct stat buf;
-
- if (ecore_file_exists(filename))
- {
- FILE *file;
-
- file = fopen(filename, "r");
- if (!file) return NULL;
-
- stat(filename, &buf);
-
- str = malloc(sizeof(char) * (buf.st_size + 1));
- fread(str, buf.st_size, 1, file);
- str[buf.st_size] = '\0';
- fclose(file);
- }
- else
- {
- gzFile file;
- unsigned int size, step, len = 0;
- char path[PATH_MAX];
- int ret;
-
- /* let see if a compressed version exists */
- snprintf(path, sizeof(path), "%s.gz", filename);
- if (!ecore_file_exists(path)) return NULL;
-
- file = gzopen(path, "rb");
- if (!file) return NULL;
-
- stat(filename, &buf);
-
- step = buf.st_size;
- size = step * 4;
- str = malloc(sizeof(char) * (size + 1));
- while ((ret = gzread(file, str + (size - 4 * step), step)))
- {
- if (ret < 0)
- {
- fprintf(stderr, "Could not open gzipped file\n");
- gzclose(file);
- free(str);
- return NULL;
- }
- size += step;
- str = realloc(str, sizeof(char) * (size + 1));
- len += ret;
- }
- str[len] = '\0';
- gzclose(file);
- }
- return str;
+ char *str = NULL;
+ struct stat buf;
+
+ if (ecore_file_exists(filename))
+ {
+ FILE *file;
+
+ file = fopen(filename, "r");
+ if (!file) return NULL;
+
+ stat(filename, &buf);
+
+ str = malloc(sizeof(char) * (buf.st_size + 1));
+ fread(str, buf.st_size, 1, file);
+ str[buf.st_size] = '\0';
+ fclose(file);
+ }
+ else
+ {
+ gzFile file;
+ unsigned int size, step, len = 0;
+ char path[PATH_MAX];
+ int ret;
+
+ /* let see if a compressed version exists */
+ snprintf(path, sizeof(path), "%s.gz", filename);
+ if (!ecore_file_exists(path)) return NULL;
+
+ file = gzopen(path, "rb");
+ if (!file) return NULL;
+
+ stat(filename, &buf);
+
+ step = buf.st_size;
+ size = step * 4;
+ str = malloc(sizeof(char) * (size + 1));
+ while ((ret = gzread(file, str + (size - 4 * step), step)))
+ {
+ if (ret < 0)
+ {
+ fprintf(stderr, "Could not open gzipped file\n");
+ gzclose(file);
+ free(str);
+ return NULL;
+ }
+ size += step;
+ str = realloc(str, sizeof(char) * (size + 1));
+ len += ret;
+ }
+ str[len] = '\0';
+ gzclose(file);
+ }
+ return str;
}
static void
setup_unit_tests(Ewl_Test *test)
{
- Ewl_Widget *button, *tree, *progress;
- int i;
+ Ewl_Widget *button, *tree, *progress;
+ int i;
- button = ewl_widget_name_find("unit_test_button");
- tree = ewl_widget_name_find("unit_test_tree");
+ button = ewl_widget_name_find("unit_test_button");
+ tree = ewl_widget_name_find("unit_test_tree");
- current_test = test;
+ current_test = test;
- /* just clean up if no tests */
- if (!test->unit_tests) return;
+ /* just clean up if no tests */
+ if (!test->unit_tests) return;
- /* set the mvc widget and reset the test information */
- ewl_mvc_data_set(EWL_MVC(tree), current_test);
- for (i = 0; test->unit_tests[i].func; i++)
- {
- if (test->unit_tests[i].failure_reason)
- free(test->unit_tests[i].failure_reason);
- test->unit_tests[i].failure_reason = NULL;
+ /* set the mvc widget and reset the test information */
+ ewl_mvc_data_set(EWL_MVC(tree), current_test);
+ for (i = 0; test->unit_tests[i].func; i++)
+ {
+ if (test->unit_tests[i].failure_reason)
+ free(test->unit_tests[i].failure_reason);
+ test->unit_tests[i].failure_reason = NULL;
- test->unit_tests[i].status = -1;
- }
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ test->unit_tests[i].status = -1;
+ }
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
- progress = ewl_widget_name_find("unit_test_progress");
- ewl_range_maximum_value_set(EWL_RANGE(progress), (double)(i));
- ewl_range_value_set(EWL_RANGE(progress), 0.0);
+ progress = ewl_widget_name_find("unit_test_progress");
+ ewl_range_maximum_value_set(EWL_RANGE(progress), (double)(i));
+ ewl_range_value_set(EWL_RANGE(progress), 0.0);
}
static void
cb_run_unit_tests(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- int i;
- Ewl_Test *test;
- Ewl_Widget *tree;
- Ewl_Widget *progress;
-
- tree = ewl_widget_name_find("unit_test_tree");
- test = current_test;
- if ((!test) || (!test->unit_tests)) return;
-
- for (i = 0; test->unit_tests[i].func; i++)
- ;
-
- progress = ewl_widget_name_find("unit_test_progress");
- ewl_range_maximum_value_set(EWL_RANGE(progress), (double)(i));
- ewl_range_value_set(EWL_RANGE(progress), 0.0);
-
- if (unit_test_timer)
- {
- ecore_timer_del(unit_test_timer);
- unit_test_timer = NULL;
- current_unit_test = 0;
- }
-
- unit_test_timer = ecore_timer_add(0.1, ewl_test_cb_unit_test_timer,
- test->unit_tests);
+ int i;
+ Ewl_Test *test;
+ Ewl_Widget *tree;
+ Ewl_Widget *progress;
+
+ tree = ewl_widget_name_find("unit_test_tree");
+ test = current_test;
+ if ((!test) || (!test->unit_tests)) return;
+
+ for (i = 0; test->unit_tests[i].func; i++)
+ ;
+
+ progress = ewl_widget_name_find("unit_test_progress");
+ ewl_range_maximum_value_set(EWL_RANGE(progress), (double)(i));
+ ewl_range_value_set(EWL_RANGE(progress), 0.0);
+
+ if (unit_test_timer)
+ {
+ ecore_timer_del(unit_test_timer);
+ unit_test_timer = NULL;
+ current_unit_test = 0;
+ }
+
+ unit_test_timer = ecore_timer_add(0.1, ewl_test_cb_unit_test_timer,
+ test->unit_tests);
}
static void
text_parse(char *str)
{
- Ewl_Widget *txt;
- Ewl_Widget *txtpane;
-
- txtpane = ewl_widget_name_find("source_pane");
-
- ewl_container_reset(EWL_CONTAINER(txtpane));
- if (!str) return;
-
- txt = ewl_io_manager_string_read(str, "text/c");
- if (txt)
- {
- ewl_text_wrap_set(EWL_TEXT(txt), EWL_TEXT_WRAP_WORD);
- ewl_text_selectable_set(EWL_TEXT(txt), TRUE);
- ewl_widget_show(txt);
- ewl_container_child_append(EWL_CONTAINER(txtpane), txt);
- }
+ Ewl_Widget *txt;
+ Ewl_Widget *txtpane;
+
+ txtpane = ewl_widget_name_find("source_pane");
+
+ ewl_container_reset(EWL_CONTAINER(txtpane));
+ if (!str) return;
+
+ txt = ewl_io_manager_string_read(str, "text/c");
+ if (txt)
+ {
+ ewl_text_wrap_set(EWL_TEXT(txt), EWL_TEXT_WRAP_WORD);
+ ewl_text_selectable_set(EWL_TEXT(txt), TRUE);
+ ewl_widget_show(txt);
+ ewl_container_child_append(EWL_CONTAINER(txtpane), txt);
+ }
}
static void
tutorial_parse(char *str)
{
- char *start, *end;
- int handled_newline = 0;
- int in_codeblock = 0;
- int not_double = 0;
- Ewl_Text *tutorial;
-
- tutorial = EWL_TEXT(ewl_widget_name_find("tutorial_text"));
- ewl_text_text_set(tutorial, NULL);
- if (!str) return;
-
- start = str;
-
- /* skip the comment block start and any blank space after */
- while ((*start == '/') || (*start == '*') || (isspace(*start))) start++;
- end = start;
-
- while (start && (*start != '\0'))
- {
- int did_newline = 0;
-
- /* we strip out newlines so the text will wrap nicely */
- if (*end == '\n')
- {
- /* we just handled a \n and got a second one so this is a new
- * paragraph so actually insert the two \n's */
- if (handled_newline)
- {
- if (in_codeblock || not_double)
- ewl_text_text_append(tutorial, "\n");
- else
- ewl_text_text_append(tutorial, "\n\n");
- }
-
- /* append the text before and skip the newline */
- else
- {
- char tmp;
-
- tmp = *(end + 1);
- *(end + 1) = '\0';
-
- if (!in_codeblock)
- *end = ' ';
-
- ewl_text_text_append(tutorial, start);
-
- *(end + 1) = tmp;
- }
- start = ++end;
- did_newline = 1;
- not_double = 0;
- }
-
- /* The * is only special after a newline character */
- else if ((*end == '*' || *end == ' ' || *end == '/') && handled_newline)
- {
- if (*end == ' ') end++;
- while (*end == '*') end++;
-
- /* we only want to skip "* " if in a code block */
- if (in_codeblock)
- {
- if (*end == ' ') end ++;
- }
- /* otherwise skip the * and all spaces */
- else
- {
- while ((*end == '*') || (*end == ' ') ||
- (*end == '/') || (*end == '\t'))
- end++;
- }
-
- if (*end == '\n')
- /* don't let the *'s at the begining of lines effect the \n
- * handling */
- did_newline = handled_newline;
-
- start = end;
- }
- else if (*end == '@')
- {
- /* stick on everything before the @ symbol. If we don't have a
- * keyword here we'll just end up sticking the next chunk onto
- * this node so shouldn't be a big deal */
- *end = '\0';
-
- ewl_text_text_append(tutorial, start);
- *end = '@';
- start = end;
-
- if ((!strncasecmp(end, "@addtogroup ", 12))
- || (!strncasecmp(end, "@section ", 9)))
- {
- char tmp, key;
- int size = 14;
-
- key = *(end + 1);
- end += 9;
-
- /* we increment end so that we can skip over the keyword and
- * the space after it */
- if (key == 'a')
- {
- size = 22;
- end += 3;
- }
-
- while (*end == ' ') end ++;
- start = end;
-
- /* skip to the end of the line */
- end = strchr(end, '\n');
-
- /* if this is the section header we need to skip
- * the section name */
- if (key == 's')
- {
- while (!isspace(*start)) start ++;
- while (*start == ' ') start ++;
- }
-
- not_double = 1;
-
- tmp = *(end + 1);
- *(end + 1) = '\0';
-
- ewl_text_font_size_set(tutorial, size);
- ewl_text_text_append(tutorial, start);
- ewl_text_font_size_set(tutorial, 12);
-
- *(end + 1) = tmp;
- start = ++end;
-
- did_newline = 1;
- }
- else if (!strncasecmp(end, "@code", 5))
- {
- in_codeblock = 1;
- end += 5;
- while (*end == ' ') end ++;
-
- /* if there is nothing after the @code we want to skip the
- * \n or we'll end up with too much space before the block */
- if (*end == '\n')
- {
- end ++;
- did_newline = 1;
- }
-
- ewl_text_color_set(tutorial, 32, 71, 109, 255);
- ewl_text_font_set(tutorial, "ewl/monospace");
- start = end;
- }
- else if (!strncasecmp(end, "@endcode", 8))
- {
- *end = '\0';
-
- ewl_text_text_append(tutorial, start);
- ewl_text_color_set(tutorial, 0, 0, 0, 255);
- in_codeblock = 0;
-
- end += 8;
- while (*end == ' ') end ++;
-
- /* if there is nothing after the @code we want to skip the
- * \n or we'll end up with too much space before the block */
- if (*end == '\n')
- {
- end ++;
- did_newline = 1;
- }
- not_double = 1;
- start = end;
- }
+ char *start, *end;
+ int handled_newline = 0;
+ int in_codeblock = 0;
+ int not_double = 0;
+ Ewl_Text *tutorial;
+
+ tutorial = EWL_TEXT(ewl_widget_name_find("tutorial_text"));
+ ewl_text_text_set(tutorial, NULL);
+ if (!str) return;
+
+ start = str;
+
+ /* skip the comment block start and any blank space after */
+ while ((*start == '/') || (*start == '*') || (isspace(*start))) start++;
+ end = start;
+
+ while (start && (*start != '\0'))
+ {
+ int did_newline = 0;
+
+ /* we strip out newlines so the text will wrap nicely */
+ if (*end == '\n')
+ {
+ /* we just handled a \n and got a second one so this is a new
+ * paragraph so actually insert the two \n's */
+ if (handled_newline)
+ {
+ if (in_codeblock || not_double)
+ ewl_text_text_append(tutorial, "\n");
+ else
+ ewl_text_text_append(tutorial, "\n\n");
+ }
+
+ /* append the text before and skip the newline */
+ else
+ {
+ char tmp;
+
+ tmp = *(end + 1);
+ *(end + 1) = '\0';
+
+ if (!in_codeblock)
+ *end = ' ';
+
+ ewl_text_text_append(tutorial, start);
+
+ *(end + 1) = tmp;
+ }
+ start = ++end;
+ did_newline = 1;
+ not_double = 0;
+ }
+
+ /* The * is only special after a newline character */
+ else if ((*end == '*' || *end == ' ' || *end == '/') && handled_newline)
+ {
+ if (*end == ' ') end++;
+ while (*end == '*') end++;
+
+ /* we only want to skip "* " if in a code block */
+ if (in_codeblock)
+ {
+ if (*end == ' ') end ++;
+ }
+ /* otherwise skip the * and all spaces */
+ else
+ {
+ while ((*end == '*') || (*end == ' ') ||
+ (*end == '/') || (*end == '\t'))
+ end++;
+ }
+
+ if (*end == '\n')
+ /* don't let the *'s at the begining of lines effect the \n
+ * handling */
+ did_newline = handled_newline;
+
+ start = end;
+ }
+ else if (*end == '@')
+ {
+ /* stick on everything before the @ symbol. If we don't have a
+ * keyword here we'll just end up sticking the next chunk onto
+ * this node so shouldn't be a big deal */
+ *end = '\0';
+
+ ewl_text_text_append(tutorial, start);
+ *end = '@';
+ start = end;
+
+ if ((!strncasecmp(end, "@addtogroup ", 12))
+ || (!strncasecmp(end, "@section ", 9)))
+ {
+ char tmp, key;
+ int size = 14;
+
+ key = *(end + 1);
+ end += 9;
+
+ /* we increment end so that we can skip over the keyword and
+ * the space after it */
+ if (key == 'a')
+ {
+ size = 22;
+ end += 3;
+ }
+
+ while (*end == ' ') end ++;
+ start = end;
+
+ /* skip to the end of the line */
+ end = strchr(end, '\n');
+
+ /* if this is the section header we need to skip
+ * the section name */
+ if (key == 's')
+ {
+ while (!isspace(*start)) start ++;
+ while (*start == ' ') start ++;
+ }
+
+ not_double = 1;
+
+ tmp = *(end + 1);
+ *(end + 1) = '\0';
+
+ ewl_text_font_size_set(tutorial, size);
+ ewl_text_text_append(tutorial, start);
+ ewl_text_font_size_set(tutorial, 12);
+
+ *(end + 1) = tmp;
+ start = ++end;
+
+ did_newline = 1;
+ }
+ else if (!strncasecmp(end, "@code", 5))
+ {
+ in_codeblock = 1;
+ end += 5;
+ while (*end == ' ') end ++;
+
+ /* if there is nothing after the @code we want to skip the
+ * \n or we'll end up with too much space before the block */
+ if (*end == '\n')
+ {
+ end ++;
+ did_newline = 1;
+ }
+
+ ewl_text_color_set(tutorial, 32, 71, 109, 255);
+ ewl_text_font_set(tutorial, "ewl/monospace");
+ start = end;
+ }
+ else if (!strncasecmp(end, "@endcode", 8))
+ {
+ *end = '\0';
+
+ ewl_text_text_append(tutorial, start);
+ ewl_text_color_set(tutorial, 0, 0, 0, 255);
+ in_codeblock = 0;
+
+ end += 8;
+ while (*end == ' ') end ++;
+
+ /* if there is nothing after the @code we want to skip the
+ * \n or we'll end up with too much space before the block */
+ if (*end == '\n')
+ {
+ end ++;
+ did_newline = 1;
+ }
+ not_double = 1;
+ start = end;
+ }
#if 0
- else if (!strncasecmp(end, "@note", 5))
- {
-
- }
- /* make next word bold */
- else if (!strncasecmp(end, "@b ", 3))
- {
- }
- /* supost to be typewriter font, make next word italic */
- else if (!strncasecmp(end, "@c ", 3))
- {
- }
+ else if (!strncasecmp(end, "@note", 5))
+ {
+
+ }
+ /* make next word bold */
+ else if (!strncasecmp(end, "@b ", 3))
+ {
+ }
+ /* supost to be typewriter font, make next word italic */
+ else if (!strncasecmp(end, "@c ", 3))
+ {
+ }
#endif
- /* if we don't know what it is just write it into the text */
- else
- end ++;
- }
- else if (*end == '<')
- {
- if (0)
- {
- }
- /* skip it if we don't know what it is */
- else
- end ++;
- }
- else
- end ++;
-
- handled_newline = did_newline;
- if (!end || (*end == '\0'))
- {
- ewl_text_text_append(tutorial, start);
- start = end;
- }
- }
+ /* if we don't know what it is just write it into the text */
+ else
+ end ++;
+ }
+ else if (*end == '<')
+ {
+ if (0)
+ {
+ }
+ /* skip it if we don't know what it is */
+ else
+ end ++;
+ }
+ else
+ end ++;
+
+ handled_newline = did_newline;
+ if (!end || (*end == '\0'))
+ {
+ ewl_text_text_append(tutorial, start);
+ start = end;
+ }
+ }
}
static void
ewl_test_create_info_window(const char *title, const char *text)
{
- Ewl_Widget *win, *vbox, *o;
-
- window_count++;
-
- win = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(win), title);
- ewl_window_class_set(EWL_WINDOW(win), "ewl_test");
- ewl_window_name_set(EWL_WINDOW(win), "ewl_test");
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
- ewl_test_cb_delete_window, NULL);
- ewl_object_size_request(EWL_OBJECT(win), 400, 400);
- ewl_widget_show(win);
-
- vbox = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(win), vbox);
- ewl_widget_show(vbox);
-
- o = ewl_text_new();
- ewl_text_font_source_set(EWL_TEXT(o), ewl_theme_path_get(), "ewl/default/bold");
- ewl_text_font_size_set(EWL_TEXT(o), 22);
- ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_SOFT_SHADOW);
- ewl_text_text_append(EWL_TEXT(o), title);
-
- ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_NONE);
- ewl_text_font_set(EWL_TEXT(o), NULL);
- ewl_text_font_size_set(EWL_TEXT(o), 12);
- ewl_text_text_append(EWL_TEXT(o), "\n\n");
- ewl_text_text_append(EWL_TEXT(o), text);
- ewl_container_child_append(EWL_CONTAINER(vbox), o);
- ewl_widget_show(o);
+ Ewl_Widget *win, *vbox, *o;
+
+ window_count++;
+
+ win = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(win), title);
+ ewl_window_class_set(EWL_WINDOW(win), "ewl_test");
+ ewl_window_name_set(EWL_WINDOW(win), "ewl_test");
+ ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
+ ewl_test_cb_delete_window, NULL);
+ ewl_object_size_request(EWL_OBJECT(win), 400, 400);
+ ewl_widget_show(win);
+
+ vbox = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(win), vbox);
+ ewl_widget_show(vbox);
+
+ o = ewl_text_new();
+ ewl_text_font_source_set(EWL_TEXT(o), ewl_theme_path_get(), "ewl/default/bold");
+ ewl_text_font_size_set(EWL_TEXT(o), 22);
+ ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_SOFT_SHADOW);
+ ewl_text_text_append(EWL_TEXT(o), title);
+
+ ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_NONE);
+ ewl_text_font_set(EWL_TEXT(o), NULL);
+ ewl_text_font_size_set(EWL_TEXT(o), 12);
+ ewl_text_text_append(EWL_TEXT(o), "\n\n");
+ ewl_text_text_append(EWL_TEXT(o), text);
+ ewl_container_child_append(EWL_CONTAINER(vbox), o);
+ ewl_widget_show(o);
}
static void
ewl_test_cb_help(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_test_create_info_window("Ewl Test Help", ewl_test_help_body);
+ ewl_test_create_info_window("Ewl Test Help", ewl_test_help_body);
}
static void
ewl_test_cb_about(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_test_create_info_window("Ewl Test About", ewl_test_about_body);
+ ewl_test_create_info_window("Ewl Test About", ewl_test_about_body);
}
static void *
ewl_test_cb_category_fetch(void *data __UNUSED__, unsigned int row,
- unsigned int column __UNUSED__)
+ unsigned int column __UNUSED__)
{
- switch(row)
- {
- case 0: return "Simple";
- case 1: return "Advanced";
- case 2: return "Container";
- case 3: return "Misc";
- case 4: return "Unit";
- }
- return "ERROR";
+ switch(row)
+ {
+ case 0: return "Simple";
+ case 1: return "Advanced";
+ case 2: return "Container";
+ case 3: return "Misc";
+ case 4: return "Unit";
+ }
+ return "ERROR";
}
static int
ewl_test_cb_category_expandable(void *data __UNUSED__,
- unsigned int row __UNUSED__)
+ unsigned int row __UNUSED__)
{
- return 1;
+ return 1;
}
static void *
ewl_test_cb_category_expansion_fetch(void *data, unsigned int row)
{
- ecore_list_index_goto(data, row);
- return ecore_list_current(data);
+ ecore_list_index_goto(data, row);
+ return ecore_list_current(data);
}
static Ewl_Model *
ewl_test_cb_category_expansion_model_fetch(void *data __UNUSED__,
- unsigned int row __UNUSED__)
+ unsigned int row __UNUSED__)
{
- if (expansion_model) return expansion_model;
+ if (expansion_model) return expansion_model;
- expansion_model = ewl_model_new();
- ewl_model_data_fetch_set(expansion_model, ewl_test_cb_expansion_fetch);
- ewl_model_data_count_set(expansion_model, ewl_model_cb_ecore_list_count);
+ expansion_model = ewl_model_new();
+ ewl_model_data_fetch_set(expansion_model, ewl_test_cb_expansion_fetch);
+ ewl_model_data_count_set(expansion_model, ewl_model_cb_ecore_list_count);
- return expansion_model;
+ return expansion_model;
}
static void *
ewl_test_cb_expansion_fetch(void *data, unsigned int row,
- unsigned int column __UNUSED__)
+ unsigned int column __UNUSED__)
{
- Ewl_Test *test;
+ Ewl_Test *test;
- ecore_list_index_goto(data, row);
- test = ecore_list_current(data);
+ ecore_list_index_goto(data, row);
+ test = ecore_list_current(data);
- return (char *)test->name;
+ return (char *)test->name;
}
static void
ewl_test_cb_test_selected(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ecore_List *tree_data, *unit;
- Ewl_Selection_Idx *sel;
- Ewl_Test *test;
-
- tree_data = ewl_mvc_data_get(EWL_MVC(w));
- sel = ewl_mvc_selected_get(EWL_MVC(w));
- if (!sel)
- goto EXIT_CALLBACK;
-
- /* don't care about the top level rows */
- if (tree_data == sel->sel.data)
- goto CLEAR_SELECTION;
-
- /* get the test */
- ecore_list_index_goto(sel->sel.data, sel->row);
- test = ecore_list_current(sel->sel.data);
- if (!test)
- goto FREE_SELECTION;
-
- /* we need to determine if this is the unit test case. if it is we
- * need to treat it specially */
- ecore_list_last_goto(tree_data);
- unit = ecore_list_current(tree_data);
- if (unit == sel->sel.data)
- run_unit_test_boxed(test);
- else
- run_test_boxed(test);
+ Ecore_List *tree_data, *unit;
+ Ewl_Selection_Idx *sel;
+ Ewl_Test *test;
+
+ tree_data = ewl_mvc_data_get(EWL_MVC(w));
+ sel = ewl_mvc_selected_get(EWL_MVC(w));
+ if (!sel)
+ goto EXIT_CALLBACK;
+
+ /* don't care about the top level rows */
+ if (tree_data == sel->sel.data)
+ goto CLEAR_SELECTION;
+
+ /* get the test */
+ ecore_list_index_goto(sel->sel.data, sel->row);
+ test = ecore_list_current(sel->sel.data);
+ if (!test)
+ goto FREE_SELECTION;
+
+ /* we need to determine if this is the unit test case. if it is we
+ * need to treat it specially */
+ ecore_list_last_goto(tree_data);
+ unit = ecore_list_current(tree_data);
+ if (unit == sel->sel.data)
+ run_unit_test_boxed(test);
+ else
+ run_test_boxed(test);
CLEAR_SELECTION:
- ewl_mvc_selected_clear(EWL_MVC(w));
+ ewl_mvc_selected_clear(EWL_MVC(w));
FREE_SELECTION:
- free(sel);
+ free(sel);
EXIT_CALLBACK:
- return;
+ return;
}
static void *
cb_unit_test_header_data_fetch(void *data __UNUSED__, unsigned int column)
{
- if (column == 0)
- return "Test";
+ if (column == 0)
+ return "Test";
- if (column == 1)
- return "Status";
+ if (column == 1)
+ return "Status";
- return "Failure Reason";
+ return "Failure Reason";
}
static Ewl_Widget *
cb_unit_test_header_fetch(void *data, unsigned int column __UNUSED__)
{
- Ewl_Widget *label;
+ Ewl_Widget *label;
- label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(label), data);
- ewl_widget_show(label);
+ label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(label), data);
+ ewl_widget_show(label);
- return label;
+ return label;
}
static void *
cb_unit_test_fetch(void *data, unsigned int row, unsigned int column)
{
- Ewl_Test *t;
+ Ewl_Test *t;
- t = data;
- if (column == 0)
- return (void *)t->unit_tests[row].name;
+ t = data;
+ if (column == 0)
+ return (void *)t->unit_tests[row].name;
- else if (column == 1)
- return ((t->unit_tests[row].status < 0) ? "" :
- (t->unit_tests[row].status == 0) ? "FAIL" : "PASS");
+ else if (column == 1)
+ return ((t->unit_tests[row].status < 0) ? "" :
+ (t->unit_tests[row].status == 0) ? "FAIL" : "PASS");
- else
- return t->unit_tests[row].failure_reason;
+ else
+ return t->unit_tests[row].failure_reason;
}
static unsigned int
cb_unit_test_count(void *data)
{
- Ewl_Test *t;
- unsigned int i;
+ Ewl_Test *t;
+ unsigned int i;
- t = data;
- if (!data) return 0;
+ t = data;
+ if (!data) return 0;
- for (i = 0; t->unit_tests[i].func; i++)
- ;
+ for (i = 0; t->unit_tests[i].func; i++)
+ ;
- return i;
+ return i;
}
static void
ewl_cb_mvc_free(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Model *model;
- Ewl_View *view;
+ Ewl_Model *model;
+ Ewl_View *view;
- model = (Ewl_Model *)ewl_mvc_model_get(EWL_MVC(w));
- free(model);
+ model = (Ewl_Model *)ewl_mvc_model_get(EWL_MVC(w));
+ free(model);
- view = (Ewl_View *)ewl_mvc_view_get(EWL_MVC(w));
- free(view);
+ view = (Ewl_View *)ewl_mvc_view_get(EWL_MVC(w));
+ free(view);
}
diff --git a/src/bin/tests/border/ewl_border_test.c b/src/bin/tests/border/ewl_border_test.c
index 5554d5a..96cd362 100644
--- a/src/bin/tests/border/ewl_border_test.c
+++ b/src/bin/tests/border/ewl_border_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_border.h"
@@ -24,376 +24,376 @@ static int label_position_set_get_test(char *buf, int len);
static int label_alignment_set_get_test(char *buf, int len);
static Ewl_Unit_Test border_unit_tests[] = {
- {"Border is", border_is_test, NULL, -1, 0},
- {"Border label set/get", label_set_get_test, NULL, -1, 0},
- {"Border label position set/get", label_position_set_get_test, NULL, -1, 0},
- {"Border label alignment set/get", label_alignment_set_get_test, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"Border is", border_is_test, NULL, -1, 0},
+ {"Border label set/get", label_set_get_test, NULL, -1, 0},
+ {"Border label position set/get", label_position_set_get_test, NULL, -1, 0},
+ {"Border label alignment set/get", label_alignment_set_get_test, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Border";
- test->tip = "Defines the Ewl_Border class for displaying\n"
- "a container with a label.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
- test->unit_tests = border_unit_tests;
+ test->name = "Border";
+ test->tip = "Defines the Ewl_Border class for displaying\n"
+ "a container with a label.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
+ test->unit_tests = border_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *border;
- Ewl_Widget *border_box;
- Ewl_Widget *separator;
- Ewl_Widget *alabel, *avbox, *pvbox, *plabel, *cvbox, *clabel;
- Ewl_Widget *button_check;
-
- border = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(border), "Box Title");
- ewl_container_child_append(EWL_CONTAINER(box), border);
- ewl_widget_show(border);
-
- border_box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(border), border_box);
- ewl_widget_show(border_box);
-
- avbox = ewl_vbox_new();
- ewl_object_alignment_set(EWL_OBJECT(avbox), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(border_box), avbox);
- ewl_widget_show(avbox);
-
- alabel = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(alabel), "Tabs Alignment");
- ewl_container_child_append(EWL_CONTAINER(avbox), alabel);
- ewl_widget_show(alabel);
-
- button_atop = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_atop), "Top");
- ewl_container_child_append(EWL_CONTAINER(avbox), button_atop);
- ewl_callback_append(button_atop, EWL_CALLBACK_VALUE_CHANGED,
- border_change_alignment, border);
- ewl_widget_show(button_atop);
-
- button_aleft = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_aleft), "Left");
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(button_aleft), TRUE);
- ewl_container_child_append(EWL_CONTAINER(avbox), button_aleft);
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_aleft),
- EWL_RADIOBUTTON(button_atop));
- ewl_callback_append(button_aleft, EWL_CALLBACK_VALUE_CHANGED,
- border_change_alignment, border);
- ewl_widget_show(button_aleft);
-
- button_acenter = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_acenter), "Center");
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_acenter),
- EWL_RADIOBUTTON(button_aleft));
- ewl_container_child_append(EWL_CONTAINER(avbox), button_acenter);
- ewl_callback_append(button_acenter, EWL_CALLBACK_VALUE_CHANGED,
- border_change_alignment, border);
- ewl_widget_show(button_acenter);
-
- button_aright = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_aright), "Right");
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_aright),
- EWL_RADIOBUTTON(button_acenter));
- ewl_container_child_append(EWL_CONTAINER(avbox), button_aright);
- ewl_callback_append(button_aright, EWL_CALLBACK_VALUE_CHANGED,
- border_change_alignment, border);
- ewl_widget_show(button_aright);
-
- button_abottom = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_abottom), "Bottom");
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_abottom),
- EWL_RADIOBUTTON(button_aright));
- ewl_container_child_append(EWL_CONTAINER(avbox), button_abottom);
- ewl_callback_append(button_abottom, EWL_CALLBACK_VALUE_CHANGED,
- border_change_alignment, border);
- ewl_widget_show(button_abottom);
-
- separator = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(border_box), separator);
- ewl_widget_show(separator);
-
- pvbox = ewl_vbox_new();
- ewl_object_alignment_set(EWL_OBJECT(pvbox), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(border_box), pvbox);
- ewl_widget_show(pvbox);
-
- plabel = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(plabel), "Tabs Position");
- ewl_container_child_append(EWL_CONTAINER(pvbox), plabel);
- ewl_widget_show(plabel);
-
- button_pleft = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_pleft), "Left");
- ewl_container_child_append(EWL_CONTAINER(pvbox), button_pleft);
- ewl_callback_append(button_pleft, EWL_CALLBACK_VALUE_CHANGED,
- border_change_position, border);
- ewl_widget_show(button_pleft);
-
- button_pright = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_pright), "Right");
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_pright),
- EWL_RADIOBUTTON(button_pleft));
- ewl_container_child_append(EWL_CONTAINER(pvbox), button_pright);
- ewl_callback_append(button_pright, EWL_CALLBACK_VALUE_CHANGED,
- border_change_position, border);
- ewl_widget_show(button_pright);
-
- button_ptop = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_ptop), "Top");
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(button_ptop), TRUE);
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_ptop),
- EWL_RADIOBUTTON(button_pright));
- ewl_container_child_append(EWL_CONTAINER(pvbox), button_ptop);
- ewl_callback_append(button_ptop, EWL_CALLBACK_VALUE_CHANGED,
- border_change_position, border);
- ewl_widget_show(button_ptop);
-
- button_pbottom = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(button_pbottom), "Bottom");
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_pbottom),
- EWL_RADIOBUTTON(button_ptop));
- ewl_container_child_append(EWL_CONTAINER(pvbox), button_pbottom);
- ewl_callback_append(button_pbottom, EWL_CALLBACK_VALUE_CHANGED,
- border_change_position, border);
- ewl_widget_show(button_pbottom);
-
- cvbox = ewl_vbox_new();
- ewl_object_alignment_set(EWL_OBJECT(cvbox), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(box), cvbox);
- ewl_widget_show(cvbox);
-
- clabel = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(clabel), "Enable/Disable");
- ewl_container_child_append(EWL_CONTAINER(cvbox), clabel);
- ewl_widget_show(clabel);
-
- button_check = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(button_check), "Disable");
- ewl_container_child_append(EWL_CONTAINER(cvbox), button_check);
- ewl_callback_append(button_check, EWL_CALLBACK_CLICKED,
- checkbutton_cb, border);
- ewl_widget_show(button_check);
-
- return 1;
+ Ewl_Widget *border;
+ Ewl_Widget *border_box;
+ Ewl_Widget *separator;
+ Ewl_Widget *alabel, *avbox, *pvbox, *plabel, *cvbox, *clabel;
+ Ewl_Widget *button_check;
+
+ border = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(border), "Box Title");
+ ewl_container_child_append(EWL_CONTAINER(box), border);
+ ewl_widget_show(border);
+
+ border_box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(border), border_box);
+ ewl_widget_show(border_box);
+
+ avbox = ewl_vbox_new();
+ ewl_object_alignment_set(EWL_OBJECT(avbox), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(border_box), avbox);
+ ewl_widget_show(avbox);
+
+ alabel = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(alabel), "Tabs Alignment");
+ ewl_container_child_append(EWL_CONTAINER(avbox), alabel);
+ ewl_widget_show(alabel);
+
+ button_atop = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_atop), "Top");
+ ewl_container_child_append(EWL_CONTAINER(avbox), button_atop);
+ ewl_callback_append(button_atop, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_alignment, border);
+ ewl_widget_show(button_atop);
+
+ button_aleft = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_aleft), "Left");
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(button_aleft), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(avbox), button_aleft);
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_aleft),
+ EWL_RADIOBUTTON(button_atop));
+ ewl_callback_append(button_aleft, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_alignment, border);
+ ewl_widget_show(button_aleft);
+
+ button_acenter = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_acenter), "Center");
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_acenter),
+ EWL_RADIOBUTTON(button_aleft));
+ ewl_container_child_append(EWL_CONTAINER(avbox), button_acenter);
+ ewl_callback_append(button_acenter, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_alignment, border);
+ ewl_widget_show(button_acenter);
+
+ button_aright = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_aright), "Right");
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_aright),
+ EWL_RADIOBUTTON(button_acenter));
+ ewl_container_child_append(EWL_CONTAINER(avbox), button_aright);
+ ewl_callback_append(button_aright, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_alignment, border);
+ ewl_widget_show(button_aright);
+
+ button_abottom = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_abottom), "Bottom");
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_abottom),
+ EWL_RADIOBUTTON(button_aright));
+ ewl_container_child_append(EWL_CONTAINER(avbox), button_abottom);
+ ewl_callback_append(button_abottom, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_alignment, border);
+ ewl_widget_show(button_abottom);
+
+ separator = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(border_box), separator);
+ ewl_widget_show(separator);
+
+ pvbox = ewl_vbox_new();
+ ewl_object_alignment_set(EWL_OBJECT(pvbox), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(border_box), pvbox);
+ ewl_widget_show(pvbox);
+
+ plabel = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(plabel), "Tabs Position");
+ ewl_container_child_append(EWL_CONTAINER(pvbox), plabel);
+ ewl_widget_show(plabel);
+
+ button_pleft = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_pleft), "Left");
+ ewl_container_child_append(EWL_CONTAINER(pvbox), button_pleft);
+ ewl_callback_append(button_pleft, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_position, border);
+ ewl_widget_show(button_pleft);
+
+ button_pright = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_pright), "Right");
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_pright),
+ EWL_RADIOBUTTON(button_pleft));
+ ewl_container_child_append(EWL_CONTAINER(pvbox), button_pright);
+ ewl_callback_append(button_pright, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_position, border);
+ ewl_widget_show(button_pright);
+
+ button_ptop = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_ptop), "Top");
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(button_ptop), TRUE);
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_ptop),
+ EWL_RADIOBUTTON(button_pright));
+ ewl_container_child_append(EWL_CONTAINER(pvbox), button_ptop);
+ ewl_callback_append(button_ptop, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_position, border);
+ ewl_widget_show(button_ptop);
+
+ button_pbottom = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_pbottom), "Bottom");
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_pbottom),
+ EWL_RADIOBUTTON(button_ptop));
+ ewl_container_child_append(EWL_CONTAINER(pvbox), button_pbottom);
+ ewl_callback_append(button_pbottom, EWL_CALLBACK_VALUE_CHANGED,
+ border_change_position, border);
+ ewl_widget_show(button_pbottom);
+
+ cvbox = ewl_vbox_new();
+ ewl_object_alignment_set(EWL_OBJECT(cvbox), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(box), cvbox);
+ ewl_widget_show(cvbox);
+
+ clabel = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(clabel), "Enable/Disable");
+ ewl_container_child_append(EWL_CONTAINER(cvbox), clabel);
+ ewl_widget_show(clabel);
+
+ button_check = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(button_check), "Disable");
+ ewl_container_child_append(EWL_CONTAINER(cvbox), button_check);
+ ewl_callback_append(button_check, EWL_CALLBACK_CLICKED,
+ checkbutton_cb, border);
+ ewl_widget_show(button_check);
+
+ return 1;
}
static void
border_change_alignment(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- if (!ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
- return;
+ if (!ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
+ return;
- if (w == button_aleft)
- ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_LEFT);
+ if (w == button_aleft)
+ ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_LEFT);
- else if (w == button_acenter)
- ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_CENTER);
+ else if (w == button_acenter)
+ ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_CENTER);
- else if (w == button_aright)
- ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_RIGHT);
+ else if (w == button_aright)
+ ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_RIGHT);
- else if (w == button_atop)
- ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_TOP);
+ else if (w == button_atop)
+ ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_TOP);
- else if (w == button_abottom)
- ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_BOTTOM);
+ else if (w == button_abottom)
+ ewl_border_label_alignment_set(data, EWL_FLAG_ALIGN_BOTTOM);
- return;
+ return;
}
static void
border_change_position(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- if (!ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
- return;
+ if (!ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
+ return;
- if (w == button_pleft)
- ewl_border_label_position_set(data, EWL_POSITION_LEFT);
+ if (w == button_pleft)
+ ewl_border_label_position_set(data, EWL_POSITION_LEFT);
- else if (w == button_pright)
- ewl_border_label_position_set(data, EWL_POSITION_RIGHT);
+ else if (w == button_pright)
+ ewl_border_label_position_set(data, EWL_POSITION_RIGHT);
- else if (w == button_ptop)
- ewl_border_label_position_set(data, EWL_POSITION_TOP);
+ else if (w == button_ptop)
+ ewl_border_label_position_set(data, EWL_POSITION_TOP);
- else if (w == button_pbottom)
- ewl_border_label_position_set(data, EWL_POSITION_BOTTOM);
+ else if (w == button_pbottom)
+ ewl_border_label_position_set(data, EWL_POSITION_BOTTOM);
}
static void
checkbutton_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
- {
- ewl_widget_disable(EWL_WIDGET(data));
- ewl_button_label_set(EWL_BUTTON(w), "Enable");
- }
- else if (!ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
- {
- ewl_widget_enable(EWL_WIDGET(data));
- ewl_button_label_set(EWL_BUTTON(w), "Disable");
- }
+ if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
+ {
+ ewl_widget_disable(EWL_WIDGET(data));
+ ewl_button_label_set(EWL_BUTTON(w), "Enable");
+ }
+ else if (!ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
+ {
+ ewl_widget_enable(EWL_WIDGET(data));
+ ewl_button_label_set(EWL_BUTTON(w), "Disable");
+ }
}
static int border_is_test(char *buf, int len)
{
- Ewl_Widget *border;
- int ret = 0;
+ Ewl_Widget *border;
+ int ret = 0;
- border = ewl_border_new();
- if (ewl_widget_type_is(border, EWL_BORDER_TYPE))
- ret = 1;
- else
- LOG_FAILURE(buf, len, "border type doesn't match");
+ border = ewl_border_new();
+ if (ewl_widget_type_is(border, EWL_BORDER_TYPE))
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "border type doesn't match");
- ewl_widget_destroy(border);
+ ewl_widget_destroy(border);
- return ret;
+ return ret;
}
static int label_set_get_test(char *buf, int len)
{
- Ewl_Widget *border;
- int ret = 0;
+ Ewl_Widget *border;
+ int ret = 0;
- border = ewl_border_new();
- if (ewl_border_label_get(EWL_BORDER(border)))
- LOG_FAILURE(buf, len, "default border label set");
- else {
- const char *label;
+ border = ewl_border_new();
+ if (ewl_border_label_get(EWL_BORDER(border)))
+ LOG_FAILURE(buf, len, "default border label set");
+ else {
+ const char *label;
- ewl_border_label_set(EWL_BORDER(border), "label value");
+ ewl_border_label_set(EWL_BORDER(border), "label value");
- label = ewl_border_label_get(EWL_BORDER(border));
- if (label && !strcmp(label, "label value"))
- ret = 1;
- else
- LOG_FAILURE(buf, len, "border label doesn't match");
- }
+ label = ewl_border_label_get(EWL_BORDER(border));
+ if (label && !strcmp(label, "label value"))
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "border label doesn't match");
+ }
- ewl_widget_destroy(border);
+ ewl_widget_destroy(border);
- return ret;
+ return ret;
}
static int label_position_set_get_test(char *buf, int len)
{
- Ewl_Widget *border;
- unsigned int pos;
- int ret = 0;
-
- border = ewl_border_new();
- pos = ewl_border_label_position_get(EWL_BORDER(border));
- if (pos != EWL_POSITION_TOP) {
- LOG_FAILURE(buf, len, "default border label position wrong");
- goto POSITION_ERROR;
- }
-
- ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_LEFT);
- pos = ewl_border_label_position_get(EWL_BORDER(border));
- if (pos != EWL_POSITION_LEFT) {
- LOG_FAILURE(buf, len, "border label position not left");
- goto POSITION_ERROR;
- }
-
- ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_RIGHT);
- pos = ewl_border_label_position_get(EWL_BORDER(border));
- if (pos != EWL_POSITION_RIGHT) {
- LOG_FAILURE(buf, len, "border label position not right");
- goto POSITION_ERROR;
- }
-
- ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_BOTTOM);
- pos = ewl_border_label_position_get(EWL_BORDER(border));
- if (pos != EWL_POSITION_BOTTOM) {
- LOG_FAILURE(buf, len, "border label position not bottom");
- goto POSITION_ERROR;
- }
-
- ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_TOP);
- pos = ewl_border_label_position_get(EWL_BORDER(border));
- if (pos != EWL_POSITION_TOP) {
- LOG_FAILURE(buf, len, "border label position not top");
- goto POSITION_ERROR;
- }
-
- ret = 1;
+ Ewl_Widget *border;
+ unsigned int pos;
+ int ret = 0;
+
+ border = ewl_border_new();
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_TOP) {
+ LOG_FAILURE(buf, len, "default border label position wrong");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_LEFT);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_LEFT) {
+ LOG_FAILURE(buf, len, "border label position not left");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_RIGHT);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_RIGHT) {
+ LOG_FAILURE(buf, len, "border label position not right");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_BOTTOM);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_BOTTOM) {
+ LOG_FAILURE(buf, len, "border label position not bottom");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_TOP);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_TOP) {
+ LOG_FAILURE(buf, len, "border label position not top");
+ goto POSITION_ERROR;
+ }
+
+ ret = 1;
POSITION_ERROR:
- ewl_widget_destroy(border);
+ ewl_widget_destroy(border);
- return ret;
+ return ret;
}
static int label_alignment_set_get_test(char *buf, int len)
{
- Ewl_Widget *border;
- int align;
- int req_align;
- int ret = 0;
-
- border = ewl_border_new();
- align = ewl_border_label_alignment_get(EWL_BORDER(border));
- if (align != EWL_FLAG_ALIGN_LEFT) {
- LOG_FAILURE(buf, len, "default border label alignment wrong");
- goto POSITION_ERROR;
- }
-
- req_align = (EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_RIGHT |
- EWL_FLAG_ALIGN_BOTTOM | EWL_FLAG_ALIGN_TOP |
- EWL_FLAG_ALIGN_CENTER);
-
- while (req_align >= 0) {
-
- ewl_border_label_alignment_set(EWL_BORDER(border), req_align);
- align = ewl_border_label_alignment_get(EWL_BORDER(border));
- if (align != req_align) {
- LOG_FAILURE(buf, len,
- "border label alignment %x does not "
- "match requested %x", align, req_align);
- goto POSITION_ERROR;
- }
-
- --req_align;
- }
-
- ewl_border_label_alignment_set(EWL_BORDER(border),
- EWL_FLAG_ALIGN_RIGHT);
- align = ewl_border_label_alignment_get(EWL_BORDER(border));
- if (align != EWL_FLAG_ALIGN_RIGHT) {
- LOG_FAILURE(buf, len, "border label alignment not right");
- goto POSITION_ERROR;
- }
-
- ewl_border_label_alignment_set(EWL_BORDER(border),
- EWL_FLAG_ALIGN_BOTTOM);
- align = ewl_border_label_alignment_get(EWL_BORDER(border));
- if (align != EWL_FLAG_ALIGN_BOTTOM) {
- LOG_FAILURE(buf, len, "border label alignment not bottom");
- goto POSITION_ERROR;
- }
-
- ewl_border_label_alignment_set(EWL_BORDER(border),
- EWL_FLAG_ALIGN_TOP);
- align = ewl_border_label_alignment_get(EWL_BORDER(border));
- if (align != EWL_FLAG_ALIGN_TOP) {
- LOG_FAILURE(buf, len, "border label alignment not top");
- goto POSITION_ERROR;
- }
-
- ret = 1;
+ Ewl_Widget *border;
+ int align;
+ int req_align;
+ int ret = 0;
+
+ border = ewl_border_new();
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_LEFT) {
+ LOG_FAILURE(buf, len, "default border label alignment wrong");
+ goto POSITION_ERROR;
+ }
+
+ req_align = (EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_RIGHT |
+ EWL_FLAG_ALIGN_BOTTOM | EWL_FLAG_ALIGN_TOP |
+ EWL_FLAG_ALIGN_CENTER);
+
+ while (req_align >= 0) {
+
+ ewl_border_label_alignment_set(EWL_BORDER(border), req_align);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != req_align) {
+ LOG_FAILURE(buf, len,
+ "border label alignment %x does not "
+ "match requested %x", align, req_align);
+ goto POSITION_ERROR;
+ }
+
+ --req_align;
+ }
+
+ ewl_border_label_alignment_set(EWL_BORDER(border),
+ EWL_FLAG_ALIGN_RIGHT);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_RIGHT) {
+ LOG_FAILURE(buf, len, "border label alignment not right");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_alignment_set(EWL_BORDER(border),
+ EWL_FLAG_ALIGN_BOTTOM);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_BOTTOM) {
+ LOG_FAILURE(buf, len, "border label alignment not bottom");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_alignment_set(EWL_BORDER(border),
+ EWL_FLAG_ALIGN_TOP);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_TOP) {
+ LOG_FAILURE(buf, len, "border label alignment not top");
+ goto POSITION_ERROR;
+ }
+
+ ret = 1;
POSITION_ERROR:
- ewl_widget_destroy(border);
+ ewl_widget_destroy(border);
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/box/ewl_box_test.c b/src/bin/tests/box/ewl_box_test.c
index 532f561..e34a4b3 100644
--- a/src/bin/tests/box/ewl_box_test.c
+++ b/src/bin/tests/box/ewl_box_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_box.h"
@@ -14,315 +14,315 @@ static void toggle_child_fill(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Box";
- test->tip = "Defines the Ewl_Box class used for\n"
- "laying out Ewl_Widget's in a horizontal\n"
- "or vertical line.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Box";
+ test->tip = "Defines the Ewl_Box class used for\n"
+ "laying out Ewl_Widget's in a horizontal\n"
+ "or vertical line.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *vbox[2], *hbox[3];
- Ewl_Widget *vbox_button[2][3];
- Ewl_Widget *hbox_button[2][3];
-
- /*
- * Create the first horizontal box, this is positioned in the upper
- * left corner.
- */
- hbox[0] = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox[0]);
- ewl_widget_show(hbox[0]);
-
- /******************************************************************/
- /* Create a box for holding the horizontal alignment test buttons */
- /******************************************************************/
- vbox[0] = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(hbox[0]), vbox[0]);
- ewl_widget_show(vbox[0]);
-
- /*
- * Create and setup the button that starts in the left position.
- */
- vbox_button[0][0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(vbox_button[0][0]), "Left");
- ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][0]);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][0]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][0]),
- EWL_FLAG_ALIGN_LEFT);
- ewl_callback_append(vbox_button[0][0], EWL_CALLBACK_CLICKED,
- toggle_child_horizontal_align, NULL);
- ewl_widget_show(vbox_button[0][0]);
-
- /*
- * Create and setup the button that starts in the center position.
- */
- vbox_button[0][1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(vbox_button[0][1]), "Center");
- ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][1]);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][1]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][1]),
- EWL_FLAG_ALIGN_CENTER);
- ewl_callback_append(vbox_button[0][1], EWL_CALLBACK_CLICKED,
- toggle_child_horizontal_align, NULL);
- ewl_widget_show(vbox_button[0][1]);
-
- /*
- * Create and setup the button that starts in the right position.
- */
- vbox_button[0][2] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(vbox_button[0][2]), "Right");
- ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][2]);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][2]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][2]),
- EWL_FLAG_ALIGN_RIGHT);
- ewl_callback_append(vbox_button[0][2], EWL_CALLBACK_CLICKED,
- toggle_child_horizontal_align, NULL);
- ewl_widget_show(vbox_button[0][2]);
-
- /****************************************************************/
- /* Create a box for holding the Fill test buttons */
- /****************************************************************/
- vbox[1] = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(hbox[0]), vbox[1]);
- ewl_widget_show(vbox[1]);
-
- /*
- * Create and setup a button with no filling by default.
- */
- vbox_button[1][0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(vbox_button[1][0]), "None");
- ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][0]);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][0]),
- EWL_FLAG_FILL_NONE);
- ewl_box_orientation_set(EWL_BOX(vbox_button[1][0]),
- EWL_ORIENTATION_VERTICAL);
- ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][0])->label_object),
- EWL_FLAG_ALIGN_CENTER);
- ewl_callback_append(vbox_button[1][0], EWL_CALLBACK_CLICKED,
- toggle_child_fill, NULL);
- ewl_widget_show(vbox_button[1][0]);
-
- /*
- * Create and setup a button with filling by default.
- */
- vbox_button[1][1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(vbox_button[1][1]), "Fill");
- ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][1]);
- ewl_box_orientation_set(EWL_BOX(vbox_button[1][1]),
- EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][1]),
- EWL_FLAG_FILL_FILL);
- ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][1])->label_object),
- EWL_FLAG_ALIGN_CENTER);
- ewl_callback_append(vbox_button[1][1], EWL_CALLBACK_CLICKED,
- toggle_child_fill, NULL);
- ewl_widget_show(vbox_button[1][1]);
-
- /*
- * Create and setup a button with no filling by default.
- */
- vbox_button[1][2] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(vbox_button[1][2]), "None");
- ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][2]);
- ewl_box_orientation_set(EWL_BOX(vbox_button[1][2]),
- EWL_ORIENTATION_VERTICAL);
- ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][2]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][2])->label_object),
- EWL_FLAG_ALIGN_CENTER);
- ewl_callback_append(vbox_button[1][2], EWL_CALLBACK_CLICKED,
- toggle_child_fill, NULL);
- ewl_widget_show(vbox_button[1][2]);
-
- /****************************************************************/
- /* Create a box for holding the vertical alignment test buttons */
- /****************************************************************/
- hbox[1] = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox[1]);
- ewl_widget_show(hbox[1]);
-
- /*
- * Create and setup a button with top alignment by default.
- */
- hbox_button[0][0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(hbox_button[0][0]), "Top");
- ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][0]);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][0]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][0]),
- EWL_FLAG_ALIGN_TOP);
- ewl_callback_append(hbox_button[0][0], EWL_CALLBACK_CLICKED,
- toggle_child_vertical_align, NULL);
- ewl_widget_show(hbox_button[0][0]);
-
- /*
- * Create and setup a button with center alignment by default.
- */
- hbox_button[0][1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(hbox_button[0][1]), "Center");
- ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][1]);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][1]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][1]),
- EWL_FLAG_ALIGN_CENTER);
- ewl_callback_append(hbox_button[0][1], EWL_CALLBACK_CLICKED,
- toggle_child_vertical_align, NULL);
- ewl_widget_show(hbox_button[0][1]);
-
- /*
- * Create and setup a button with bottom alignment by default.
- */
- hbox_button[0][2] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(hbox_button[0][2]), "Bottom");
- ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][2]);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][2]),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][2]),
- EWL_FLAG_ALIGN_BOTTOM);
- ewl_callback_append(hbox_button[0][2], EWL_CALLBACK_CLICKED,
- toggle_child_vertical_align, NULL);
- ewl_widget_show(hbox_button[0][2]);
-
- /****************************************************************/
- /* Create a box for holding the Shrink test buttons */
- /****************************************************************/
- hbox[2] = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox[2]);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox[2]), EWL_FLAG_FILL_HFILL);
- ewl_widget_show(hbox[2]);
-
- /*
- * Create and setup a button with no filling by default.
- */
- hbox_button[1][0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(hbox_button[1][0]),
- "Shrink This Box To Fit It's Parent");
- ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][0]),
- EWL_FLAG_FILL_HSHRINK);
- ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][0]);
- ewl_callback_append(hbox_button[1][0], EWL_CALLBACK_CLICKED,
- toggle_child_shrink, NULL);
- ewl_widget_show(hbox_button[1][0]);
-
- /*
- * Create and setup a button with shrinking by default.
- */
- hbox_button[1][1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(hbox_button[1][1]),
- "Shrink This Box To Fit It's Parent");
- ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][1]),
- EWL_FLAG_FILL_HSHRINK);
- ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][1]);
- ewl_callback_append(hbox_button[1][1], EWL_CALLBACK_CLICKED,
- toggle_child_shrink, NULL);
- ewl_widget_show(hbox_button[1][1]);
-
- /*
- * Create and setup a button with no filling by default.
- */
- hbox_button[1][2] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(hbox_button[1][2]),
- "Don't shrink this box at all");
- ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][2]),
- EWL_FLAG_FILL_NONE);
- ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][2]);
- ewl_callback_append(hbox_button[1][2], EWL_CALLBACK_CLICKED,
- toggle_child_shrink, NULL);
- ewl_widget_show(hbox_button[1][2]);
-
- return 1;
+ Ewl_Widget *vbox[2], *hbox[3];
+ Ewl_Widget *vbox_button[2][3];
+ Ewl_Widget *hbox_button[2][3];
+
+ /*
+ * Create the first horizontal box, this is positioned in the upper
+ * left corner.
+ */
+ hbox[0] = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox[0]);
+ ewl_widget_show(hbox[0]);
+
+ /******************************************************************/
+ /* Create a box for holding the horizontal alignment test buttons */
+ /******************************************************************/
+ vbox[0] = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox[0]), vbox[0]);
+ ewl_widget_show(vbox[0]);
+
+ /*
+ * Create and setup the button that starts in the left position.
+ */
+ vbox_button[0][0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(vbox_button[0][0]), "Left");
+ ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][0]);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][0]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][0]),
+ EWL_FLAG_ALIGN_LEFT);
+ ewl_callback_append(vbox_button[0][0], EWL_CALLBACK_CLICKED,
+ toggle_child_horizontal_align, NULL);
+ ewl_widget_show(vbox_button[0][0]);
+
+ /*
+ * Create and setup the button that starts in the center position.
+ */
+ vbox_button[0][1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(vbox_button[0][1]), "Center");
+ ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][1]);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][1]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][1]),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_callback_append(vbox_button[0][1], EWL_CALLBACK_CLICKED,
+ toggle_child_horizontal_align, NULL);
+ ewl_widget_show(vbox_button[0][1]);
+
+ /*
+ * Create and setup the button that starts in the right position.
+ */
+ vbox_button[0][2] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(vbox_button[0][2]), "Right");
+ ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][2]);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][2]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][2]),
+ EWL_FLAG_ALIGN_RIGHT);
+ ewl_callback_append(vbox_button[0][2], EWL_CALLBACK_CLICKED,
+ toggle_child_horizontal_align, NULL);
+ ewl_widget_show(vbox_button[0][2]);
+
+ /****************************************************************/
+ /* Create a box for holding the Fill test buttons */
+ /****************************************************************/
+ vbox[1] = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox[0]), vbox[1]);
+ ewl_widget_show(vbox[1]);
+
+ /*
+ * Create and setup a button with no filling by default.
+ */
+ vbox_button[1][0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(vbox_button[1][0]), "None");
+ ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][0]);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][0]),
+ EWL_FLAG_FILL_NONE);
+ ewl_box_orientation_set(EWL_BOX(vbox_button[1][0]),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][0])->label_object),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_callback_append(vbox_button[1][0], EWL_CALLBACK_CLICKED,
+ toggle_child_fill, NULL);
+ ewl_widget_show(vbox_button[1][0]);
+
+ /*
+ * Create and setup a button with filling by default.
+ */
+ vbox_button[1][1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(vbox_button[1][1]), "Fill");
+ ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][1]);
+ ewl_box_orientation_set(EWL_BOX(vbox_button[1][1]),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][1]),
+ EWL_FLAG_FILL_FILL);
+ ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][1])->label_object),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_callback_append(vbox_button[1][1], EWL_CALLBACK_CLICKED,
+ toggle_child_fill, NULL);
+ ewl_widget_show(vbox_button[1][1]);
+
+ /*
+ * Create and setup a button with no filling by default.
+ */
+ vbox_button[1][2] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(vbox_button[1][2]), "None");
+ ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][2]);
+ ewl_box_orientation_set(EWL_BOX(vbox_button[1][2]),
+ EWL_ORIENTATION_VERTICAL);
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][2]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][2])->label_object),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_callback_append(vbox_button[1][2], EWL_CALLBACK_CLICKED,
+ toggle_child_fill, NULL);
+ ewl_widget_show(vbox_button[1][2]);
+
+ /****************************************************************/
+ /* Create a box for holding the vertical alignment test buttons */
+ /****************************************************************/
+ hbox[1] = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox[1]);
+ ewl_widget_show(hbox[1]);
+
+ /*
+ * Create and setup a button with top alignment by default.
+ */
+ hbox_button[0][0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(hbox_button[0][0]), "Top");
+ ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][0]);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][0]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][0]),
+ EWL_FLAG_ALIGN_TOP);
+ ewl_callback_append(hbox_button[0][0], EWL_CALLBACK_CLICKED,
+ toggle_child_vertical_align, NULL);
+ ewl_widget_show(hbox_button[0][0]);
+
+ /*
+ * Create and setup a button with center alignment by default.
+ */
+ hbox_button[0][1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(hbox_button[0][1]), "Center");
+ ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][1]);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][1]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][1]),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_callback_append(hbox_button[0][1], EWL_CALLBACK_CLICKED,
+ toggle_child_vertical_align, NULL);
+ ewl_widget_show(hbox_button[0][1]);
+
+ /*
+ * Create and setup a button with bottom alignment by default.
+ */
+ hbox_button[0][2] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(hbox_button[0][2]), "Bottom");
+ ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][2]);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][2]),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][2]),
+ EWL_FLAG_ALIGN_BOTTOM);
+ ewl_callback_append(hbox_button[0][2], EWL_CALLBACK_CLICKED,
+ toggle_child_vertical_align, NULL);
+ ewl_widget_show(hbox_button[0][2]);
+
+ /****************************************************************/
+ /* Create a box for holding the Shrink test buttons */
+ /****************************************************************/
+ hbox[2] = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox[2]);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox[2]), EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(hbox[2]);
+
+ /*
+ * Create and setup a button with no filling by default.
+ */
+ hbox_button[1][0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(hbox_button[1][0]),
+ "Shrink This Box To Fit It's Parent");
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][0]),
+ EWL_FLAG_FILL_HSHRINK);
+ ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][0]);
+ ewl_callback_append(hbox_button[1][0], EWL_CALLBACK_CLICKED,
+ toggle_child_shrink, NULL);
+ ewl_widget_show(hbox_button[1][0]);
+
+ /*
+ * Create and setup a button with shrinking by default.
+ */
+ hbox_button[1][1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(hbox_button[1][1]),
+ "Shrink This Box To Fit It's Parent");
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][1]),
+ EWL_FLAG_FILL_HSHRINK);
+ ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][1]);
+ ewl_callback_append(hbox_button[1][1], EWL_CALLBACK_CLICKED,
+ toggle_child_shrink, NULL);
+ ewl_widget_show(hbox_button[1][1]);
+
+ /*
+ * Create and setup a button with no filling by default.
+ */
+ hbox_button[1][2] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(hbox_button[1][2]),
+ "Don't shrink this box at all");
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][2]),
+ EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][2]);
+ ewl_callback_append(hbox_button[1][2], EWL_CALLBACK_CLICKED,
+ toggle_child_shrink, NULL);
+ ewl_widget_show(hbox_button[1][2]);
+
+ return 1;
}
static void
toggle_child_fill(Ewl_Widget * w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- unsigned int f;
+ unsigned int f;
- f = ewl_object_fill_policy_get(EWL_OBJECT(w));
+ f = ewl_object_fill_policy_get(EWL_OBJECT(w));
- if (f == EWL_FLAG_FILL_NONE) {
- ewl_button_label_set(EWL_BUTTON(w), "Fill");
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
- } else {
- ewl_button_label_set(EWL_BUTTON(w), "None");
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- }
+ if (f == EWL_FLAG_FILL_NONE) {
+ ewl_button_label_set(EWL_BUTTON(w), "Fill");
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+ } else {
+ ewl_button_label_set(EWL_BUTTON(w), "None");
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ }
}
static void
toggle_child_shrink(Ewl_Widget * w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- unsigned int f;
-
- f = ewl_object_fill_policy_get(EWL_OBJECT(w));
-
- if (f == EWL_FLAG_FILL_NONE) {
- ewl_object_fill_policy_set(EWL_OBJECT(w),
- EWL_FLAG_FILL_HSHRINK);
- ewl_button_label_set(EWL_BUTTON(w),
- "Shrink This Box To Fit It's Parent");
- } else {
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_button_label_set(EWL_BUTTON(w),
- "Don't shrink this box at all");
- }
+ unsigned int f;
+
+ f = ewl_object_fill_policy_get(EWL_OBJECT(w));
+
+ if (f == EWL_FLAG_FILL_NONE) {
+ ewl_object_fill_policy_set(EWL_OBJECT(w),
+ EWL_FLAG_FILL_HSHRINK);
+ ewl_button_label_set(EWL_BUTTON(w),
+ "Shrink This Box To Fit It's Parent");
+ } else {
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_button_label_set(EWL_BUTTON(w),
+ "Don't shrink this box at all");
+ }
}
static void
toggle_child_horizontal_align(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- unsigned int a;
- char l[10];
-
- a = ewl_object_alignment_get(EWL_OBJECT(w));
-
- if (a == EWL_FLAG_ALIGN_LEFT) {
- a = EWL_FLAG_ALIGN_CENTER;
- snprintf(l, 10, "Center");
- } else if (a == EWL_FLAG_ALIGN_CENTER) {
- a = EWL_FLAG_ALIGN_RIGHT;
- snprintf(l, 10, "Right");
- } else if (a == EWL_FLAG_ALIGN_RIGHT) {
- a = EWL_FLAG_ALIGN_LEFT;
- snprintf(l, 10, "Left");
- }
-
- ewl_button_label_set(EWL_BUTTON(w), l);
- ewl_object_alignment_set(EWL_OBJECT(w), a);
+ unsigned int a;
+ char l[10];
+
+ a = ewl_object_alignment_get(EWL_OBJECT(w));
+
+ if (a == EWL_FLAG_ALIGN_LEFT) {
+ a = EWL_FLAG_ALIGN_CENTER;
+ snprintf(l, 10, "Center");
+ } else if (a == EWL_FLAG_ALIGN_CENTER) {
+ a = EWL_FLAG_ALIGN_RIGHT;
+ snprintf(l, 10, "Right");
+ } else if (a == EWL_FLAG_ALIGN_RIGHT) {
+ a = EWL_FLAG_ALIGN_LEFT;
+ snprintf(l, 10, "Left");
+ }
+
+ ewl_button_label_set(EWL_BUTTON(w), l);
+ ewl_object_alignment_set(EWL_OBJECT(w), a);
}
static void
toggle_child_vertical_align(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- unsigned int a;
- char l[10];
-
- a = ewl_object_alignment_get(EWL_OBJECT(w));
-
- if (a == EWL_FLAG_ALIGN_TOP) {
- a = EWL_FLAG_ALIGN_CENTER;
- snprintf(l, 10, "Center");
- } else if (a == EWL_FLAG_ALIGN_CENTER) {
- a = EWL_FLAG_ALIGN_BOTTOM;
- snprintf(l, 10, "Bottom");
- } else if (a == EWL_FLAG_ALIGN_BOTTOM) {
- a = EWL_FLAG_ALIGN_TOP;
- snprintf(l, 10, "Top");
- }
-
- ewl_button_label_set(EWL_BUTTON(w), l);
- ewl_object_alignment_set(EWL_OBJECT(w), a);
+ unsigned int a;
+ char l[10];
+
+ a = ewl_object_alignment_get(EWL_OBJECT(w));
+
+ if (a == EWL_FLAG_ALIGN_TOP) {
+ a = EWL_FLAG_ALIGN_CENTER;
+ snprintf(l, 10, "Center");
+ } else if (a == EWL_FLAG_ALIGN_CENTER) {
+ a = EWL_FLAG_ALIGN_BOTTOM;
+ snprintf(l, 10, "Bottom");
+ } else if (a == EWL_FLAG_ALIGN_BOTTOM) {
+ a = EWL_FLAG_ALIGN_TOP;
+ snprintf(l, 10, "Top");
+ }
+
+ ewl_button_label_set(EWL_BUTTON(w), l);
+ ewl_object_alignment_set(EWL_OBJECT(w), a);
}
diff --git a/src/bin/tests/button/ewl_button_test.c b/src/bin/tests/button/ewl_button_test.c
index 9f761dd..14235bf 100644
--- a/src/bin/tests/button/ewl_button_test.c
+++ b/src/bin/tests/button/ewl_button_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -25,408 +25,408 @@ static int image_alignment_test_set_get(char *buf, int len);
static int image_fill_policy_test_set_get(char *buf, int len);
static Ewl_Unit_Test button_unit_tests[] = {
- {"label set/get", label_test_set_get, NULL, -1, 0},
- {"image null get", image_null_test_get, NULL, -1, 0},
- {"image null set/get", image_null_test_set_get, NULL, -1, 0},
- {"image nonexistent set/get", image_nonexist_relative_test_set_get, NULL, -1, 0},
- {"image size null height set/get", image_size_null_height_test_set_get, NULL, -1 , 0},
- {"image size null width set/get", image_size_null_width_test_set_get, NULL, -1, 0},
- {"image size match set/get", image_size_match_test_set_get, NULL, -1, 0},
- {"image size differ set/get", image_size_differ_test_set_get, NULL, -1, 0},
- {"image size max int set/get", image_size_max_int_test_set_get, NULL, -1, 0},
- {"image alignment set/get", image_alignment_test_set_get, NULL, -1, 0},
- {"image fill policy set/get", image_fill_policy_test_set_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"label set/get", label_test_set_get, NULL, -1, 0},
+ {"image null get", image_null_test_get, NULL, -1, 0},
+ {"image null set/get", image_null_test_set_get, NULL, -1, 0},
+ {"image nonexistent set/get", image_nonexist_relative_test_set_get, NULL, -1, 0},
+ {"image size null height set/get", image_size_null_height_test_set_get, NULL, -1 , 0},
+ {"image size null width set/get", image_size_null_width_test_set_get, NULL, -1, 0},
+ {"image size match set/get", image_size_match_test_set_get, NULL, -1, 0},
+ {"image size differ set/get", image_size_differ_test_set_get, NULL, -1, 0},
+ {"image size max int set/get", image_size_max_int_test_set_get, NULL, -1, 0},
+ {"image alignment set/get", image_alignment_test_set_get, NULL, -1, 0},
+ {"image fill policy set/get", image_fill_policy_test_set_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Button";
- test->tip = "The button class is a basic button\n"
- "with a label. This class inherits from\n"
- "the Ewl_Box to allow for placing any\n"
- "other widgets inside the button.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
- test->unit_tests = button_unit_tests;
+ test->name = "Button";
+ test->tip = "The button class is a basic button\n"
+ "with a label. This class inherits from\n"
+ "the Ewl_Box to allow for placing any\n"
+ "other widgets inside the button.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
+ test->unit_tests = button_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *hbox;
- Ewl_Widget *vbox;
- Ewl_Widget *separator[2];
- Ewl_Widget *button[3];
- Ewl_Widget *check_button[4];
- Ewl_Widget *radio_button[3];
-
- /*
- * Pack the button tests horizontally.
- */
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_widget_show(hbox);
-
- /*
- * Use a vertical box for the buttons in a test area.
- */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), vbox);
- ewl_widget_show(vbox);
-
- /*
- * Create a button to be displayed witha label.
- */
- button[0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[0]), "With Label");
- ewl_container_child_append(EWL_CONTAINER(vbox), button[0]);
- ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(button[0]);
-
- /*
- * Create a button that does not contain a label
- */
- button[1] = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), button[1]);
- ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(button[1]);
-
- /*
- * Create a button that's disabled
- */
- button[2] = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), button[2]);
- ewl_object_alignment_set(EWL_OBJECT(button[2]), EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(button[2]), "Disabled");
- ewl_widget_disable(button[2]);
- ewl_widget_show(button[2]);
-
- /*
- * Add a separator between the classic buttons and the check buttons.
- */
- separator[0] = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), separator[0]);
- ewl_widget_show(separator[0]);
-
- /*
- * Use a vertical box for the buttons in a test area.
- */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), vbox);
- ewl_widget_show(vbox);
-
- /*
- * Create a check button with a label.
- */
- check_button[0] = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check_button[0] ), "With Label");
- ewl_container_child_append(EWL_CONTAINER(vbox), check_button[0]);
- ewl_widget_show(check_button[0]);
-
- /*
- * Create a check button with a label and checked.
- */
- check_button[1] = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check_button[1] ),
- "With Label and checked");
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(check_button[1]), TRUE);
- ewl_container_child_append(EWL_CONTAINER(vbox), check_button[1]);
- ewl_widget_show(check_button[1]);
-
- /*
- * Create a check button w/o a label.
- */
- check_button[2] = ewl_checkbutton_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), check_button[2]);
- ewl_widget_show(check_button[2]);
-
- /*
- * Create a check button thats disabled
- */
- check_button[3] = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check_button[3] ), "Disabled");
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(check_button[3]), TRUE);
- ewl_container_child_append(EWL_CONTAINER(vbox), check_button[3]);
- ewl_widget_disable(check_button[3]);
- ewl_widget_show(check_button[3]);
-
- /*
- * Add a separator between the check buttons and the radio buttons
- */
- separator[1] = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), separator[1]);
- ewl_widget_show(separator[1]);
-
- /*
- * Use a vertical box for the buttons in a test area.
- */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), vbox);
- ewl_widget_show(vbox);
-
- /*
- * Add a radio button with
- */
- radio_button[0] = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(radio_button[0] ), "With Label");
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(radio_button[0]), TRUE);
- ewl_container_child_append(EWL_CONTAINER(vbox), radio_button[0]);
- ewl_widget_show(radio_button[0]);
-
- radio_button[1] = ewl_radiobutton_new();
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_button[1]),
- EWL_RADIOBUTTON(radio_button[0]));
- ewl_container_child_append(EWL_CONTAINER(vbox), radio_button[1]);
- ewl_widget_show(radio_button[1]);
-
- radio_button[2] = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(radio_button[2] ), "Disabled");
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(radio_button[2]), TRUE);
- ewl_container_child_append(EWL_CONTAINER(vbox), radio_button[2]);
- ewl_widget_disable(radio_button[2]);
- ewl_widget_show(radio_button[2]);
-
- return 1;
+ Ewl_Widget *hbox;
+ Ewl_Widget *vbox;
+ Ewl_Widget *separator[2];
+ Ewl_Widget *button[3];
+ Ewl_Widget *check_button[4];
+ Ewl_Widget *radio_button[3];
+
+ /*
+ * Pack the button tests horizontally.
+ */
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox);
+ ewl_widget_show(hbox);
+
+ /*
+ * Use a vertical box for the buttons in a test area.
+ */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), vbox);
+ ewl_widget_show(vbox);
+
+ /*
+ * Create a button to be displayed witha label.
+ */
+ button[0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[0]), "With Label");
+ ewl_container_child_append(EWL_CONTAINER(vbox), button[0]);
+ ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(button[0]);
+
+ /*
+ * Create a button that does not contain a label
+ */
+ button[1] = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), button[1]);
+ ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(button[1]);
+
+ /*
+ * Create a button that's disabled
+ */
+ button[2] = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), button[2]);
+ ewl_object_alignment_set(EWL_OBJECT(button[2]), EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(button[2]), "Disabled");
+ ewl_widget_disable(button[2]);
+ ewl_widget_show(button[2]);
+
+ /*
+ * Add a separator between the classic buttons and the check buttons.
+ */
+ separator[0] = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), separator[0]);
+ ewl_widget_show(separator[0]);
+
+ /*
+ * Use a vertical box for the buttons in a test area.
+ */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), vbox);
+ ewl_widget_show(vbox);
+
+ /*
+ * Create a check button with a label.
+ */
+ check_button[0] = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check_button[0] ), "With Label");
+ ewl_container_child_append(EWL_CONTAINER(vbox), check_button[0]);
+ ewl_widget_show(check_button[0]);
+
+ /*
+ * Create a check button with a label and checked.
+ */
+ check_button[1] = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check_button[1] ),
+ "With Label and checked");
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(check_button[1]), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), check_button[1]);
+ ewl_widget_show(check_button[1]);
+
+ /*
+ * Create a check button w/o a label.
+ */
+ check_button[2] = ewl_checkbutton_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), check_button[2]);
+ ewl_widget_show(check_button[2]);
+
+ /*
+ * Create a check button thats disabled
+ */
+ check_button[3] = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check_button[3] ), "Disabled");
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(check_button[3]), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), check_button[3]);
+ ewl_widget_disable(check_button[3]);
+ ewl_widget_show(check_button[3]);
+
+ /*
+ * Add a separator between the check buttons and the radio buttons
+ */
+ separator[1] = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), separator[1]);
+ ewl_widget_show(separator[1]);
+
+ /*
+ * Use a vertical box for the buttons in a test area.
+ */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), vbox);
+ ewl_widget_show(vbox);
+
+ /*
+ * Add a radio button with
+ */
+ radio_button[0] = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(radio_button[0] ), "With Label");
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(radio_button[0]), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), radio_button[0]);
+ ewl_widget_show(radio_button[0]);
+
+ radio_button[1] = ewl_radiobutton_new();
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_button[1]),
+ EWL_RADIOBUTTON(radio_button[0]));
+ ewl_container_child_append(EWL_CONTAINER(vbox), radio_button[1]);
+ ewl_widget_show(radio_button[1]);
+
+ radio_button[2] = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(radio_button[2] ), "Disabled");
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(radio_button[2]), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), radio_button[2]);
+ ewl_widget_disable(radio_button[2]);
+ ewl_widget_show(radio_button[2]);
+
+ return 1;
}
static int
label_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int ret = 0;
+ Ewl_Widget *button;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "my_label");
- if (!strcmp("my_label", ewl_button_label_get(EWL_BUTTON(button)))) {
- ewl_button_label_set(EWL_BUTTON(button), NULL);
- if (ewl_button_label_get(EWL_BUTTON(button)))
- LOG_FAILURE(buf, len, "label_get not NULL");
- else
- ret = 1;
- }
- else
- LOG_FAILURE(buf, len, "label_get doesn't match label_set");
+ ewl_button_label_set(EWL_BUTTON(button), "my_label");
+ if (!strcmp("my_label", ewl_button_label_get(EWL_BUTTON(button)))) {
+ ewl_button_label_set(EWL_BUTTON(button), NULL);
+ if (ewl_button_label_get(EWL_BUTTON(button)))
+ LOG_FAILURE(buf, len, "label_get not NULL");
+ else
+ ret = 1;
+ }
+ else
+ LOG_FAILURE(buf, len, "label_get doesn't match label_set");
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_null_test_get(char *buf, int len)
{
- Ewl_Widget *button;
- int ret = 0;
+ Ewl_Widget *button;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- if (ewl_button_image_get(EWL_BUTTON(button)))
- LOG_FAILURE(buf, len, "image_get not NULL");
- else
- ret = 1;
+ if (ewl_button_image_get(EWL_BUTTON(button)))
+ LOG_FAILURE(buf, len, "image_get not NULL");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_null_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- const char *val;
- int ret = 0;
+ Ewl_Widget *button;
+ const char *val;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- ewl_button_image_set(EWL_BUTTON(button), NULL, NULL);
- val = ewl_button_image_get(EWL_BUTTON(button));
- if (val)
- LOG_FAILURE(buf, len, "image_get %s when set to NULL", val);
- else
- ret = 1;
+ ewl_button_image_set(EWL_BUTTON(button), NULL, NULL);
+ val = ewl_button_image_get(EWL_BUTTON(button));
+ if (val)
+ LOG_FAILURE(buf, len, "image_get %s when set to NULL", val);
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_nonexist_relative_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int ret = 0;
+ Ewl_Widget *button;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- ewl_button_image_set(EWL_BUTTON(button), "my_image", NULL);
- if (strcmp("my_image", ewl_button_image_get(EWL_BUTTON(button))))
- LOG_FAILURE(buf, len, "image_get dosen't match image_set");
- else
- ret = 1;
+ ewl_button_image_set(EWL_BUTTON(button), "my_image", NULL);
+ if (strcmp("my_image", ewl_button_image_get(EWL_BUTTON(button))))
+ LOG_FAILURE(buf, len, "image_get dosen't match image_set");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_size_null_height_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int w = 0;
- int ret = 0;
+ Ewl_Widget *button;
+ int w = 0;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- ewl_button_image_size_get(EWL_BUTTON(button), &w, NULL);
- if (w != 0)
- LOG_FAILURE(buf, len, "image_size_get width not 0");
- else
- ret = 1;
+ ewl_button_image_size_get(EWL_BUTTON(button), &w, NULL);
+ if (w != 0)
+ LOG_FAILURE(buf, len, "image_size_get width not 0");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_size_null_width_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int h = 0;
- int ret = 0;
+ Ewl_Widget *button;
+ int h = 0;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- ewl_button_image_size_get(EWL_BUTTON(button), NULL, &h);
- if (h != 0)
- LOG_FAILURE(buf, len, "image_size_get height not 0");
- else
- ret = 1;
+ ewl_button_image_size_get(EWL_BUTTON(button), NULL, &h);
+ if (h != 0)
+ LOG_FAILURE(buf, len, "image_size_get height not 0");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_size_match_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int w = 0, h = 0;
- int ret = 0;
+ Ewl_Widget *button;
+ int w = 0, h = 0;
+ int ret = 0;
- button = ewl_button_new();
+ button = ewl_button_new();
- ewl_button_image_size_set(EWL_BUTTON(button), 32, 32);
- ewl_button_image_size_get(EWL_BUTTON(button), &w, &h);
- if (w != 32 || h != 32)
- LOG_FAILURE(buf, len, "image_size_get width and height don't match");
- else
- ret = 1;
+ ewl_button_image_size_set(EWL_BUTTON(button), 32, 32);
+ ewl_button_image_size_get(EWL_BUTTON(button), &w, &h);
+ if (w != 32 || h != 32)
+ LOG_FAILURE(buf, len, "image_size_get width and height don't match");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_size_differ_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int w = 0, h = 0;
- int ret = 0;
+ Ewl_Widget *button;
+ int w = 0, h = 0;
+ int ret = 0;
- button = ewl_button_new();
- ewl_button_image_size_set(EWL_BUTTON(button), 30, 24);
- ewl_button_image_size_get(EWL_BUTTON(button), &w, &h);
- if (w != 30 || h != 24)
- LOG_FAILURE(buf, len, "image_size_get width and height don't differ");
- else
- ret = 1;
+ button = ewl_button_new();
+ ewl_button_image_size_set(EWL_BUTTON(button), 30, 24);
+ ewl_button_image_size_get(EWL_BUTTON(button), &w, &h);
+ if (w != 30 || h != 24)
+ LOG_FAILURE(buf, len, "image_size_get width and height don't differ");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_size_max_int_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int w = 0, h = 0;
- int ret = 0;
+ Ewl_Widget *button;
+ int w = 0, h = 0;
+ int ret = 0;
- button = ewl_button_new();
- ewl_button_image_size_set(EWL_BUTTON(button), INT_MAX, INT_MAX);
- ewl_button_image_size_get(EWL_BUTTON(button), &w, &h);
- if (w != INT_MAX|| h != INT_MAX)
- LOG_FAILURE(buf, len, "image_size_get width and height not INT_MAX");
- else
- ret = 1;
+ button = ewl_button_new();
+ ewl_button_image_size_set(EWL_BUTTON(button), INT_MAX, INT_MAX);
+ ewl_button_image_size_get(EWL_BUTTON(button), &w, &h);
+ if (w != INT_MAX|| h != INT_MAX)
+ LOG_FAILURE(buf, len, "image_size_get width and height not INT_MAX");
+ else
+ ret = 1;
- ewl_widget_destroy(button);
+ ewl_widget_destroy(button);
- return ret;
+ return ret;
}
static int
image_alignment_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int align;
- int ret = 0;
-
- button = ewl_button_new();
- ewl_button_alignment_set(EWL_BUTTON(button), EWL_FLAG_ALIGN_RIGHT);
- align = ewl_button_alignment_get(EWL_BUTTON(button));
-
- if (align == EWL_FLAG_ALIGN_RIGHT) {
- ewl_button_alignment_set(EWL_BUTTON(button),
- EWL_FLAG_ALIGN_TOP);
- align = ewl_button_alignment_get(EWL_BUTTON(button));
- if (align == EWL_FLAG_ALIGN_TOP)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "image alignment not top");
- }
- else
- LOG_FAILURE(buf, len, "image alignment not right");
-
- ewl_widget_destroy(button);
-
- return ret;
+ Ewl_Widget *button;
+ int align;
+ int ret = 0;
+
+ button = ewl_button_new();
+ ewl_button_alignment_set(EWL_BUTTON(button), EWL_FLAG_ALIGN_RIGHT);
+ align = ewl_button_alignment_get(EWL_BUTTON(button));
+
+ if (align == EWL_FLAG_ALIGN_RIGHT) {
+ ewl_button_alignment_set(EWL_BUTTON(button),
+ EWL_FLAG_ALIGN_TOP);
+ align = ewl_button_alignment_get(EWL_BUTTON(button));
+ if (align == EWL_FLAG_ALIGN_TOP)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "image alignment not top");
+ }
+ else
+ LOG_FAILURE(buf, len, "image alignment not right");
+
+ ewl_widget_destroy(button);
+
+ return ret;
}
static int
image_fill_policy_test_set_get(char *buf, int len)
{
- Ewl_Widget *button;
- int align;
- int ret = 0;
-
- button = ewl_button_new();
- ewl_button_fill_policy_set(EWL_BUTTON(button), EWL_FLAG_FILL_NONE);
- align = ewl_button_fill_policy_get(EWL_BUTTON(button));
-
- if (align == EWL_FLAG_FILL_NONE) {
- ewl_button_fill_policy_set(EWL_BUTTON(button),
- EWL_FLAG_FILL_FILL);
- align = ewl_button_fill_policy_get(EWL_BUTTON(button));
- if (align == EWL_FLAG_FILL_FILL)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "image fill policy not fill");
- }
- else
- LOG_FAILURE(buf, len, "image fill policy not none");
-
- ewl_widget_destroy(button);
-
- return ret;
+ Ewl_Widget *button;
+ int align;
+ int ret = 0;
+
+ button = ewl_button_new();
+ ewl_button_fill_policy_set(EWL_BUTTON(button), EWL_FLAG_FILL_NONE);
+ align = ewl_button_fill_policy_get(EWL_BUTTON(button));
+
+ if (align == EWL_FLAG_FILL_NONE) {
+ ewl_button_fill_policy_set(EWL_BUTTON(button),
+ EWL_FLAG_FILL_FILL);
+ align = ewl_button_fill_policy_get(EWL_BUTTON(button));
+ if (align == EWL_FLAG_FILL_FILL)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "image fill policy not fill");
+ }
+ else
+ LOG_FAILURE(buf, len, "image fill policy not none");
+
+ ewl_widget_destroy(button);
+
+ return ret;
}
diff --git a/src/bin/tests/calendar/ewl_calendar_test.c b/src/bin/tests/calendar/ewl_calendar_test.c
index b116823..c98e1a9 100644
--- a/src/bin/tests/calendar/ewl_calendar_test.c
+++ b/src/bin/tests/calendar/ewl_calendar_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_calendar.h"
@@ -11,35 +11,35 @@ static void ewl_calendar_test(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Calendar";
- test->tip = "Defines a calendar widget.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_MISC;
+ test->name = "Calendar";
+ test->tip = "Defines a calendar widget.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_MISC;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *cal;
+ Ewl_Widget *cal;
- cal = ewl_calendar_new();
- ewl_container_child_append(EWL_CONTAINER(box), cal);
- ewl_callback_append(EWL_WIDGET(cal),
- EWL_CALLBACK_VALUE_CHANGED, ewl_calendar_test,
- cal);
- ewl_widget_show(cal);
+ cal = ewl_calendar_new();
+ ewl_container_child_append(EWL_CONTAINER(box), cal);
+ ewl_callback_append(EWL_WIDGET(cal),
+ EWL_CALLBACK_VALUE_CHANGED, ewl_calendar_test,
+ cal);
+ ewl_widget_show(cal);
- return 1;
+ return 1;
}
static void
ewl_calendar_test(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data)
{
- char *date;
+ char *date;
- date = ewl_calendar_ascii_time_get(EWL_CALENDAR(data));
- printf ("Selected: %s\n", date);
- free(date);
+ date = ewl_calendar_ascii_time_get(EWL_CALENDAR(data));
+ printf ("Selected: %s\n", date);
+ free(date);
}
diff --git a/src/bin/tests/callback/ewl_callback_test.c b/src/bin/tests/callback/ewl_callback_test.c
index 3d6d0f8..f4a9aa5 100644
--- a/src/bin/tests/callback/ewl_callback_test.c
+++ b/src/bin/tests/callback/ewl_callback_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include <limits.h>
#include "Ewl_Test.h"
#include "ewl_test_private.h"
@@ -53,40 +53,40 @@ static void insert_before_callback(Ewl_Widget *w, void *event, void *data);
static void delete_callback(Ewl_Widget *w, void *event, void *data);
static Ewl_Unit_Test callback_unit_tests[] = {
- {"append/get id", append_test_id, NULL, -1, 0},
- {"prepend/get id", prepend_test_id, NULL, -1, 0},
- {"insert after/get id", insert_after_test_id, NULL, -1, 0},
- {"shared id", shared_test_id, NULL, -1, 0},
- {"unique id", unique_test_id, NULL, -1, 0},
- {"del/call", del_test_call, NULL, -1, 0},
- {"del_id/call", del_id_test_call, NULL, -1, 0},
- {"del_data/call", del_data_test_call, NULL, -1, 0},
- {"del_type/call", del_type_test_call, NULL, -1, 0},
- {"del from empty", del_empty_test_call, NULL, -1, 0},
- {"clear/call", clear_test_call, NULL, -1, 0},
- {"append/call", append_test_call, NULL, -1, 0},
- {"prepend/call", prepend_test_call, NULL, -1, 0},
- {"parent notify", notify_test_call, NULL, -1, 0},
- {"parent intercept", intercept_test_call, NULL, -1, 0},
- {"append during call", append_in_chain_test_call, NULL, -1, 0},
- {"prepend during call", prepend_in_chain_test_call, NULL, -1, 0},
- {"insert after during call", insert_after_in_chain_test_call, NULL, -1, 0},
- {"insert before during call", insert_before_in_chain_test_call, NULL, -1, 0},
- {"delete after during call", delete_after_in_chain_test_call, NULL, -1, 0},
- {"delete before during call", delete_before_in_chain_test_call, NULL, -1, 0},
- {"delete nothing during call", delete_nothing_in_chain_test_call, NULL, -1, 0},
- {"create custom callback", custom_callback_test_add, NULL, -1, 0},
- {"unique custom callback", custom_callback_test_unique, NULL, -1, 0},
- {"append custom callback", custom_callback_test_append, NULL, -1, 0},
- {"prepend custom callback", custom_callback_test_prepend, NULL, -1, 0},
- {"insert after custom callback", custom_callback_test_insert_after, NULL, -1, 0},
- {"delete single custom callback", custom_callback_test_del_single, NULL, -1, 0},
- {"delete custom callback of multiple", custom_callback_test_del_multiple, NULL, -1, 0},
- {"delete custom callback type", custom_callback_test_del_type_single, NULL, -1, 0},
- {"delete custom callback type of multiple", custom_callback_test_del_type_multiple, NULL, -1, 0},
- {"clear with custom callback", custom_callback_test_clear, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"append/get id", append_test_id, NULL, -1, 0},
+ {"prepend/get id", prepend_test_id, NULL, -1, 0},
+ {"insert after/get id", insert_after_test_id, NULL, -1, 0},
+ {"shared id", shared_test_id, NULL, -1, 0},
+ {"unique id", unique_test_id, NULL, -1, 0},
+ {"del/call", del_test_call, NULL, -1, 0},
+ {"del_id/call", del_id_test_call, NULL, -1, 0},
+ {"del_data/call", del_data_test_call, NULL, -1, 0},
+ {"del_type/call", del_type_test_call, NULL, -1, 0},
+ {"del from empty", del_empty_test_call, NULL, -1, 0},
+ {"clear/call", clear_test_call, NULL, -1, 0},
+ {"append/call", append_test_call, NULL, -1, 0},
+ {"prepend/call", prepend_test_call, NULL, -1, 0},
+ {"parent notify", notify_test_call, NULL, -1, 0},
+ {"parent intercept", intercept_test_call, NULL, -1, 0},
+ {"append during call", append_in_chain_test_call, NULL, -1, 0},
+ {"prepend during call", prepend_in_chain_test_call, NULL, -1, 0},
+ {"insert after during call", insert_after_in_chain_test_call, NULL, -1, 0},
+ {"insert before during call", insert_before_in_chain_test_call, NULL, -1, 0},
+ {"delete after during call", delete_after_in_chain_test_call, NULL, -1, 0},
+ {"delete before during call", delete_before_in_chain_test_call, NULL, -1, 0},
+ {"delete nothing during call", delete_nothing_in_chain_test_call, NULL, -1, 0},
+ {"create custom callback", custom_callback_test_add, NULL, -1, 0},
+ {"unique custom callback", custom_callback_test_unique, NULL, -1, 0},
+ {"append custom callback", custom_callback_test_append, NULL, -1, 0},
+ {"prepend custom callback", custom_callback_test_prepend, NULL, -1, 0},
+ {"insert after custom callback", custom_callback_test_insert_after, NULL, -1, 0},
+ {"delete single custom callback", custom_callback_test_del_single, NULL, -1, 0},
+ {"delete custom callback of multiple", custom_callback_test_del_multiple, NULL, -1, 0},
+ {"delete custom callback type", custom_callback_test_del_type_single, NULL, -1, 0},
+ {"delete custom callback type of multiple", custom_callback_test_del_type_multiple, NULL, -1, 0},
+ {"clear with custom callback", custom_callback_test_clear, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
static unsigned int CALLBACK_CUSTOM_TYPE = 0;
static unsigned int CALLBACK_CUSTOM_TYPE2 = 0;
@@ -94,11 +94,11 @@ static unsigned int CALLBACK_CUSTOM_TYPE2 = 0;
void
test_info(Ewl_Test *test)
{
- test->name = "Callback";
- test->tip = "The base callback manipulation.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->unit_tests = callback_unit_tests;
+ test->name = "Callback";
+ test->tip = "The base callback manipulation.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->unit_tests = callback_unit_tests;
}
/*
@@ -107,22 +107,22 @@ test_info(Ewl_Test *test)
static int
append_test_id(char *buf, int len)
{
- Ewl_Widget *w;
- int id;
- int ret = 0;
+ Ewl_Widget *w;
+ int id;
+ int ret = 0;
- w = ewl_widget_new();
- id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
+ w = ewl_widget_new();
+ id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
- if (id)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "invalid callback id returned");
+ if (id)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "invalid callback id returned");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -131,22 +131,22 @@ append_test_id(char *buf, int len)
static int
prepend_test_id(char *buf, int len)
{
- Ewl_Widget *w;
- int id;
- int ret = 0;
+ Ewl_Widget *w;
+ int id;
+ int ret = 0;
- w = ewl_widget_new();
- id = ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
+ w = ewl_widget_new();
+ id = ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
- if (id)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "invalid callback id returned");
+ if (id)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "invalid callback id returned");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -155,24 +155,24 @@ prepend_test_id(char *buf, int len)
static int
insert_after_test_id(char *buf, int len)
{
- Ewl_Widget *w;
- int id;
- int ret = 0;
+ Ewl_Widget *w;
+ int id;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
- id = ewl_callback_insert_after(w, EWL_CALLBACK_CONFIGURE, base_callback,
- w, base_callback, NULL);
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+ id = ewl_callback_insert_after(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ w, base_callback, NULL);
- if (id)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "invalid callback id returned");
+ if (id)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "invalid callback id returned");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -181,24 +181,24 @@ insert_after_test_id(char *buf, int len)
static int
shared_test_id(char *buf, int len)
{
- Ewl_Widget *w;
- int id, id2;
- int ret = 0;
+ Ewl_Widget *w;
+ int id, id2;
+ int ret = 0;
- w = ewl_widget_new();
- id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
- id2 = ewl_callback_append(w, EWL_CALLBACK_REALIZE, base_callback,
- NULL);
+ w = ewl_widget_new();
+ id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+ id2 = ewl_callback_append(w, EWL_CALLBACK_REALIZE, base_callback,
+ NULL);
- if (id == id2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback id's don't match");
+ if (id == id2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback id's don't match");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -208,31 +208,31 @@ shared_test_id(char *buf, int len)
static int
unique_test_id(char *buf, int len)
{
- Ewl_Widget *w;
- int id, id2;
- int ret = 0;
-
- w = ewl_widget_new();
- id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
- id2 = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
- w);
-
- if (id != id2) {
- id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
- differing_callback, w);
- if (id != id2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback with different functions"
- " id's match");
- }
- else
- LOG_FAILURE(buf, len, "callback with different data id's match");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int id, id2;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+ id2 = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ w);
+
+ if (id != id2) {
+ id = ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ differing_callback, w);
+ if (id != id2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback with different functions"
+ " id's match");
+ }
+ else
+ LOG_FAILURE(buf, len, "callback with different data id's match");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -241,22 +241,22 @@ unique_test_id(char *buf, int len)
static int
del_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, base_callback);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, base_callback);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) != 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "del failed to remove callback");
+ if ((long)ewl_widget_data_get(w, w) != 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "del failed to remove callback");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -265,24 +265,24 @@ del_test_call(char *buf, int len)
static int
del_id_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int id;
- int ret = 0;
+ Ewl_Widget *w;
+ int id;
+ int ret = 0;
- w = ewl_widget_new();
- id = ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
- ewl_callback_del_cb_id(w, EWL_CALLBACK_CONFIGURE, id);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ id = ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+ ewl_callback_del_cb_id(w, EWL_CALLBACK_CONFIGURE, id);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) != 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "del failed to remove callback");
+ if ((long)ewl_widget_data_get(w, w) != 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "del failed to remove callback");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -291,36 +291,36 @@ del_id_test_call(char *buf, int len)
static int
del_data_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, w);
- ewl_callback_del_with_data(w, EWL_CALLBACK_CONFIGURE, base_callback, w);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
-
- if ((long)ewl_widget_data_get(w, w) != 1) {
-
- /*
- * Check that the data actually matches.
- */
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
- w);
- ewl_callback_del_with_data(w, EWL_CALLBACK_CONFIGURE,
- base_callback, NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
-
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "del_data removed callback");
- }
- else
- LOG_FAILURE(buf, len, "del_data failed to remove callback");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, w);
+ ewl_callback_del_with_data(w, EWL_CALLBACK_CONFIGURE, base_callback, w);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+
+ if ((long)ewl_widget_data_get(w, w) != 1) {
+
+ /*
+ * Check that the data actually matches.
+ */
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ w);
+ ewl_callback_del_with_data(w, EWL_CALLBACK_CONFIGURE,
+ base_callback, NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "del_data removed callback");
+ }
+ else
+ LOG_FAILURE(buf, len, "del_data failed to remove callback");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -330,22 +330,22 @@ del_data_test_call(char *buf, int len)
static int
del_type_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) != 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "del_type failed to remove callback");
+ if ((long)ewl_widget_data_get(w, w) != 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "del_type failed to remove callback");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -354,22 +354,22 @@ del_type_test_call(char *buf, int len)
static int
del_empty_test_call(char *buf __UNUSED__, int len __UNUSED__)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, base_callback);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, base_callback);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- /*
- * If we reach here, no segv occurred and we passed.
- */
- ret = 1;
+ /*
+ * If we reach here, no segv occurred and we passed.
+ */
+ ret = 1;
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -379,22 +379,22 @@ del_empty_test_call(char *buf __UNUSED__, int len __UNUSED__)
static int
clear_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- ewl_callback_clear(w);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_clear(w);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) != 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "clear failed to remove callback");
+ if ((long)ewl_widget_data_get(w, w) != 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "clear failed to remove callback");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -403,22 +403,22 @@ clear_test_call(char *buf, int len)
static int
append_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -427,22 +427,22 @@ append_test_call(char *buf, int len)
static int
prepend_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -451,44 +451,44 @@ prepend_test_call(char *buf, int len)
static int
notify_test_call(char *buf, int len)
{
- Ewl_Widget *parent;
- Ewl_Widget *w;
- int ret = 0;
-
- parent = ewl_cell_new();
- ewl_callback_del_type(parent, EWL_CALLBACK_CONFIGURE);
- ewl_container_callback_notify(EWL_CONTAINER(parent),
- EWL_CALLBACK_CONFIGURE);
-
- w = ewl_widget_new();
- ewl_container_child_append(EWL_CONTAINER(parent), w);
-
- /*
- * Add parent callback
- */
- ewl_callback_prepend(parent, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
-
- /*
- * Add child callbacks.
- */
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
-
- if ((long)ewl_widget_data_get(parent, parent) == 1)
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
- else
- LOG_FAILURE(buf, len, "notify function not called");
-
- ewl_widget_destroy(w);
- ewl_widget_destroy(parent);
-
- return ret;
+ Ewl_Widget *parent;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ parent = ewl_cell_new();
+ ewl_callback_del_type(parent, EWL_CALLBACK_CONFIGURE);
+ ewl_container_callback_notify(EWL_CONTAINER(parent),
+ EWL_CALLBACK_CONFIGURE);
+
+ w = ewl_widget_new();
+ ewl_container_child_append(EWL_CONTAINER(parent), w);
+
+ /*
+ * Add parent callback
+ */
+ ewl_callback_prepend(parent, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+
+ /*
+ * Add child callbacks.
+ */
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+
+ if ((long)ewl_widget_data_get(parent, parent) == 1)
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
+ else
+ LOG_FAILURE(buf, len, "notify function not called");
+
+ ewl_widget_destroy(w);
+ ewl_widget_destroy(parent);
+
+ return ret;
}
/*
@@ -497,45 +497,45 @@ notify_test_call(char *buf, int len)
static int
intercept_test_call(char *buf, int len)
{
- Ewl_Widget *parent;
- Ewl_Widget *w;
- int ret = 0;
-
- parent = ewl_cell_new();
- ewl_callback_del_type(parent, EWL_CALLBACK_CONFIGURE);
- ewl_container_callback_intercept(EWL_CONTAINER(parent),
- EWL_CALLBACK_CONFIGURE);
-
- w = ewl_widget_new();
- ewl_container_child_append(EWL_CONTAINER(parent), w);
-
- /*
- * Add parent callback
- */
- ewl_callback_prepend(parent, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
-
- /*
- * Add child callbacks.
- */
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
-
- if ((long)ewl_widget_data_get(parent, parent) == 1) {
- if ((long)ewl_widget_data_get(w, w) == 2)
- LOG_FAILURE(buf, len, "callback function called");
- else
- ret = 1;
- }
- else
- LOG_FAILURE(buf, len, "intercept function not called");
-
- ewl_widget_destroy(w);
- ewl_widget_destroy(parent);
-
- return ret;
+ Ewl_Widget *parent;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ parent = ewl_cell_new();
+ ewl_callback_del_type(parent, EWL_CALLBACK_CONFIGURE);
+ ewl_container_callback_intercept(EWL_CONTAINER(parent),
+ EWL_CALLBACK_CONFIGURE);
+
+ w = ewl_widget_new();
+ ewl_container_child_append(EWL_CONTAINER(parent), w);
+
+ /*
+ * Add parent callback
+ */
+ ewl_callback_prepend(parent, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+
+ /*
+ * Add child callbacks.
+ */
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+
+ if ((long)ewl_widget_data_get(parent, parent) == 1) {
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ LOG_FAILURE(buf, len, "callback function called");
+ else
+ ret = 1;
+ }
+ else
+ LOG_FAILURE(buf, len, "intercept function not called");
+
+ ewl_widget_destroy(w);
+ ewl_widget_destroy(parent);
+
+ return ret;
}
/*
@@ -545,22 +545,22 @@ intercept_test_call(char *buf, int len)
static int
append_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, append_callback, NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, append_callback, NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -570,22 +570,22 @@ append_in_chain_test_call(char *buf, int len)
static int
prepend_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, prepend_callback, NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, prepend_callback, NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) != 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
+ if ((long)ewl_widget_data_get(w, w) != 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -595,25 +595,25 @@ prepend_in_chain_test_call(char *buf, int len)
static int
insert_after_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, insert_after_callback,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, insert_after_callback,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -623,25 +623,25 @@ insert_after_in_chain_test_call(char *buf, int len)
static int
insert_before_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, insert_before_callback,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, insert_before_callback,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -651,27 +651,27 @@ insert_before_in_chain_test_call(char *buf, int len)
static int
delete_before_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
-
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -681,27 +681,27 @@ delete_before_in_chain_test_call(char *buf, int len)
static int
delete_after_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback,
- NULL);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
-
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback,
+ NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -711,25 +711,25 @@ delete_after_in_chain_test_call(char *buf, int len)
static int
delete_nothing_in_chain_test_call(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, differing_callback,
- NULL);
- ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
+ w = ewl_widget_new();
+ ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback,
+ NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, differing_callback,
+ NULL);
+ ewl_callback_call(w, EWL_CALLBACK_CONFIGURE);
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -738,15 +738,15 @@ delete_nothing_in_chain_test_call(char *buf, int len)
static int
custom_callback_test_add(char *buf, int len)
{
- int ret = 0;
+ int ret = 0;
- CALLBACK_CUSTOM_TYPE = ewl_callback_type_add();
- if (CALLBACK_CUSTOM_TYPE > EWL_CALLBACK_MAX)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback type registration failed");
+ CALLBACK_CUSTOM_TYPE = ewl_callback_type_add();
+ if (CALLBACK_CUSTOM_TYPE > EWL_CALLBACK_MAX)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback type registration failed");
- return ret;
+ return ret;
}
/*
@@ -755,15 +755,15 @@ custom_callback_test_add(char *buf, int len)
static int
custom_callback_test_unique(char *buf, int len)
{
- int ret = 0;
+ int ret = 0;
- CALLBACK_CUSTOM_TYPE2 = ewl_callback_type_add();
- if (CALLBACK_CUSTOM_TYPE != CALLBACK_CUSTOM_TYPE2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback type not unique");
+ CALLBACK_CUSTOM_TYPE2 = ewl_callback_type_add();
+ if (CALLBACK_CUSTOM_TYPE != CALLBACK_CUSTOM_TYPE2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback type not unique");
- return ret;
+ return ret;
}
/*
@@ -772,21 +772,21 @@ custom_callback_test_unique(char *buf, int len)
static int
custom_callback_test_append(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ w = ewl_widget_new();
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -795,21 +795,21 @@ custom_callback_test_append(char *buf, int len)
static int
custom_callback_test_prepend(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_prepend(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -818,23 +818,23 @@ custom_callback_test_prepend(char *buf, int len)
static int
custom_callback_test_insert_after(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_prepend(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_insert_after(w, CALLBACK_CUSTOM_TYPE, differing_callback,
- NULL, base_callback, NULL);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ w = ewl_widget_new();
+ ewl_callback_prepend(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_insert_after(w, CALLBACK_CUSTOM_TYPE, differing_callback,
+ NULL, base_callback, NULL);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function not called");
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -843,22 +843,22 @@ custom_callback_test_insert_after(char *buf, int len)
static int
custom_callback_test_del_single(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_del(w, CALLBACK_CUSTOM_TYPE, base_callback);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ w = ewl_widget_new();
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_del(w, CALLBACK_CUSTOM_TYPE, base_callback);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 0)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
+ if ((long)ewl_widget_data_get(w, w) == 0)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -868,32 +868,32 @@ custom_callback_test_del_single(char *buf, int len)
static int
custom_callback_test_del_multiple(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, differing_callback, NULL);
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_del(w, CALLBACK_CUSTOM_TYPE, base_callback);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
-
- if ((long)ewl_widget_data_get(w, w) == 2) {
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback,
- NULL);
- ewl_callback_del(w, CALLBACK_CUSTOM_TYPE, differing_callback);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
-
- if ((long)ewl_widget_data_get(w, w) == 1)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "first callback function called");
- }
- else
- LOG_FAILURE(buf, len, "second callback function called");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, differing_callback, NULL);
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_del(w, CALLBACK_CUSTOM_TYPE, base_callback);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+
+ if ((long)ewl_widget_data_get(w, w) == 2) {
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback,
+ NULL);
+ ewl_callback_del(w, CALLBACK_CUSTOM_TYPE, differing_callback);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+
+ if ((long)ewl_widget_data_get(w, w) == 1)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "first callback function called");
+ }
+ else
+ LOG_FAILURE(buf, len, "second callback function called");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -902,22 +902,22 @@ custom_callback_test_del_multiple(char *buf, int len)
static int
custom_callback_test_del_type_single(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_del_type(w, CALLBACK_CUSTOM_TYPE);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ w = ewl_widget_new();
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_del_type(w, CALLBACK_CUSTOM_TYPE);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 0)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
+ if ((long)ewl_widget_data_get(w, w) == 0)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -927,28 +927,28 @@ custom_callback_test_del_type_single(char *buf, int len)
static int
custom_callback_test_del_type_multiple(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE2, differing_callback, NULL);
- ewl_callback_del_type(w, CALLBACK_CUSTOM_TYPE);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE2);
-
- if ((long)ewl_widget_data_get(w, w) == 2) {
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 2)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
- }
- else
- LOG_FAILURE(buf, len, "callback function not called");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE2, differing_callback, NULL);
+ ewl_callback_del_type(w, CALLBACK_CUSTOM_TYPE);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE2);
+
+ if ((long)ewl_widget_data_get(w, w) == 2) {
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ if ((long)ewl_widget_data_get(w, w) == 2)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
+ }
+ else
+ LOG_FAILURE(buf, len, "callback function not called");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -957,82 +957,82 @@ custom_callback_test_del_type_multiple(char *buf, int len)
static int
custom_callback_test_clear(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
- ewl_callback_clear(w);
- ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
+ w = ewl_widget_new();
+ ewl_callback_append(w, CALLBACK_CUSTOM_TYPE, base_callback, NULL);
+ ewl_callback_clear(w);
+ ewl_callback_call(w, CALLBACK_CUSTOM_TYPE);
- if ((long)ewl_widget_data_get(w, w) == 0)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "callback function called");
+ if ((long)ewl_widget_data_get(w, w) == 0)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "callback function called");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
static void
base_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_widget_data_set(w, w, (void *)(long)1);
- event = data = NULL;
- return;
+ ewl_widget_data_set(w, w, (void *)(long)1);
+ event = data = NULL;
+ return;
}
static void
differing_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_widget_data_set(w, w, (void *)(long)2);
- event = data = NULL;
- return;
+ ewl_widget_data_set(w, w, (void *)(long)2);
+ event = data = NULL;
+ return;
}
static void
append_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- event = data = NULL;
- return;
+ event = data = NULL;
+ return;
}
static void
prepend_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
+ ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, base_callback, NULL);
- event = data = NULL;
- return;
+ event = data = NULL;
+ return;
}
static void
insert_after_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_callback_insert_after(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL, insert_after_callback, NULL);
+ ewl_callback_insert_after(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL, insert_after_callback, NULL);
- event = data = NULL;
- return;
+ event = data = NULL;
+ return;
}
static void
insert_before_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_callback_insert_after(w, EWL_CALLBACK_CONFIGURE, base_callback,
- NULL, differing_callback, NULL);
+ ewl_callback_insert_after(w, EWL_CALLBACK_CONFIGURE, base_callback,
+ NULL, differing_callback, NULL);
- event = data = NULL;
- return;
+ event = data = NULL;
+ return;
}
static void
delete_callback(Ewl_Widget *w, void *event, void *data)
{
- ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, base_callback);
- event = data = NULL;
- return;
+ ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, base_callback);
+ event = data = NULL;
+ return;
}
diff --git a/src/bin/tests/check/ewl_check_test.c b/src/bin/tests/check/ewl_check_test.c
index ddc0ffe..b839ca3 100644
--- a/src/bin/tests/check/ewl_check_test.c
+++ b/src/bin/tests/check/ewl_check_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_check.h"
@@ -10,45 +10,45 @@
static int check_test_new(char *buf, int len);
static Ewl_Unit_Test check_unit_tests[] = {
- {"check new", check_test_new, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"check new", check_test_new, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Check";
- test->tip = "The check class is a basic check\n"
- "for an undecorated checkbutton.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_UNIT;
- test->unit_tests = check_unit_tests;
+ test->name = "Check";
+ test->tip = "The check class is a basic check\n"
+ "for an undecorated checkbutton.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_UNIT;
+ test->unit_tests = check_unit_tests;
}
static int
check_test_new(char *buf, int len)
{
- Ewl_Widget *check;
- int ret = 0;
-
- check = ewl_check_new();
-
- if (ewl_check_is_checked(EWL_CHECK(check)))
- LOG_FAILURE(buf, len, "default check state TRUE");
- else {
- ewl_check_checked_set(EWL_CHECK(check), TRUE);
- if (ewl_check_is_checked(EWL_CHECK(check))) {
- ewl_check_checked_set(EWL_CHECK(check), FALSE);
- if (!ewl_check_is_checked(EWL_CHECK(check)))
- ret = 1;
- else
- LOG_FAILURE(buf, len, "check state TRUE");
- }
- else
- LOG_FAILURE(buf, len, "check state FALSE");
- }
-
- ewl_widget_destroy(check);
-
- return ret;
+ Ewl_Widget *check;
+ int ret = 0;
+
+ check = ewl_check_new();
+
+ if (ewl_check_is_checked(EWL_CHECK(check)))
+ LOG_FAILURE(buf, len, "default check state TRUE");
+ else {
+ ewl_check_checked_set(EWL_CHECK(check), TRUE);
+ if (ewl_check_is_checked(EWL_CHECK(check))) {
+ ewl_check_checked_set(EWL_CHECK(check), FALSE);
+ if (!ewl_check_is_checked(EWL_CHECK(check)))
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "check state TRUE");
+ }
+ else
+ LOG_FAILURE(buf, len, "check state FALSE");
+ }
+
+ ewl_widget_destroy(check);
+
+ return ret;
}
diff --git a/src/bin/tests/colordialog/ewl_colordialog_test.c b/src/bin/tests/colordialog/ewl_colordialog_test.c
index 2a265de..cdcfbec 100644
--- a/src/bin/tests/colordialog/ewl_colordialog_test.c
+++ b/src/bin/tests/colordialog/ewl_colordialog_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -8,76 +8,76 @@
static int create_test(Ewl_Container *win);
static void colordialog_cb_launch(Ewl_Widget *w, void *ev, void *data);
static void colordialog_cb_value_changed(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Colordialog";
- test->tip = "Defines a dialog with a colour picker.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Colordialog";
+ test->tip = "Defines a dialog with a colour picker.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o;
-
- o = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(o);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_object_minimum_size_set(EWL_OBJECT(o), 150, 20);
- ewl_widget_name_set(o, "colour_preview");
- ewl_widget_color_set(o, 255, 255, 255, 255);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_button_label_set(EWL_BUTTON(o), "Launch Colour Dialog");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, colordialog_cb_launch, NULL);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *o;
+
+ o = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(o);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_object_minimum_size_set(EWL_OBJECT(o), 150, 20);
+ ewl_widget_name_set(o, "colour_preview");
+ ewl_widget_color_set(o, 255, 255, 255, 255);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_button_label_set(EWL_BUTTON(o), "Launch Colour Dialog");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, colordialog_cb_launch, NULL);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
colordialog_cb_value_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Action_Response *cd_ev;
+ Ewl_Event_Action_Response *cd_ev;
- cd_ev = ev;
- if (cd_ev->response == EWL_STOCK_OK)
- {
- Ewl_Widget *o;
- unsigned int r, g, b, a;
+ cd_ev = ev;
+ if (cd_ev->response == EWL_STOCK_OK)
+ {
+ Ewl_Widget *o;
+ unsigned int r, g, b, a;
- o = ewl_widget_name_find("colour_preview");
+ o = ewl_widget_name_find("colour_preview");
- ewl_colordialog_current_rgb_get(EWL_COLORDIALOG(w), &r, &g, &b);
- a = ewl_colordialog_alpha_get(EWL_COLORDIALOG(w));
+ ewl_colordialog_current_rgb_get(EWL_COLORDIALOG(w), &r, &g, &b);
+ a = ewl_colordialog_alpha_get(EWL_COLORDIALOG(w));
- ewl_widget_color_set(o, r, g, b, a);
- }
- ewl_widget_destroy(w);
+ ewl_widget_color_set(o, r, g, b, a);
+ }
+ ewl_widget_destroy(w);
}
static void
colordialog_cb_launch(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *o;
- unsigned int r, g, b, a;
+ Ewl_Widget *o;
+ unsigned int r, g, b, a;
- o = ewl_widget_name_find("colour_preview");
- ewl_widget_color_get(o, &r, &g, &b, &a);
+ o = ewl_widget_name_find("colour_preview");
+ ewl_widget_color_get(o, &r, &g, &b, &a);
- o = ewl_colordialog_new();
- ewl_colordialog_previous_rgba_set(EWL_COLORDIALOG(o), r, g, b, a);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- colordialog_cb_value_changed, NULL);
- ewl_widget_show(o);
+ o = ewl_colordialog_new();
+ ewl_colordialog_previous_rgba_set(EWL_COLORDIALOG(o), r, g, b, a);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ colordialog_cb_value_changed, NULL);
+ ewl_widget_show(o);
}
diff --git a/src/bin/tests/colorpicker/ewl_colorpicker_test.c b/src/bin/tests/colorpicker/ewl_colorpicker_test.c
index d555855..f38ec1d 100644
--- a/src/bin/tests/colorpicker/ewl_colorpicker_test.c
+++ b/src/bin/tests/colorpicker/ewl_colorpicker_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_colorpicker.h"
@@ -11,34 +11,34 @@ static void color_value_changed(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Colorpicker";
- test->tip = "Defines a colour picker.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_MISC;
+ test->name = "Colorpicker";
+ test->tip = "Defines a colour picker.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_MISC;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *colorpicker;
+ Ewl_Widget *colorpicker;
- colorpicker = ewl_colorpicker_new();
- ewl_container_child_append(EWL_CONTAINER(box), colorpicker);
- ewl_callback_append(colorpicker, EWL_CALLBACK_VALUE_CHANGED,
- color_value_changed, NULL);
- ewl_widget_show(colorpicker);
+ colorpicker = ewl_colorpicker_new();
+ ewl_container_child_append(EWL_CONTAINER(box), colorpicker);
+ ewl_callback_append(colorpicker, EWL_CALLBACK_VALUE_CHANGED,
+ color_value_changed, NULL);
+ ewl_widget_show(colorpicker);
- return 1;
+ return 1;
}
static void
color_value_changed(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- unsigned int r, g, b;
+ unsigned int r, g, b;
- ewl_colorpicker_current_rgb_get(EWL_COLORPICKER(w), &r, &g, &b);
- printf("value changed to (%u, %u, %u)\n", r, g, b);
+ ewl_colorpicker_current_rgb_get(EWL_COLORPICKER(w), &r, &g, &b);
+ printf("value changed to (%u, %u, %u)\n", r, g, b);
}
diff --git a/src/bin/tests/combo/ewl_combo_test.c b/src/bin/tests/combo/ewl_combo_test.c
index 63404f6..d97045e 100644
--- a/src/bin/tests/combo/ewl_combo_test.c
+++ b/src/bin/tests/combo/ewl_combo_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -14,8 +14,8 @@
typedef struct
{
- unsigned int count;
- char ** data;
+ unsigned int count;
+ char ** data;
} Ewl_Combo_Test_Data;
static void *combo_test_data_setup(void);
@@ -23,331 +23,331 @@ static int create_test(Ewl_Container *win);
static void combo_value_changed(Ewl_Widget *w, void *ev, void *data);
static Ewl_Widget *combo_test_data_header_fetch(void *data, unsigned int col);
static void *combo_test_data_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static unsigned int combo_test_data_count_get(void *data);
static void combo_cb_add(Ewl_Widget *w, void *ev, void *data);
static void combo_cb_clear(Ewl_Widget *w, void *ev, void *data);
static void combo_cb_entry_changed(Ewl_Widget *w, void *ev, void *data);
static Ewl_Widget *combo_test_editable_cb_header_fetch(void *data,
- unsigned int col);
+ unsigned int col);
static Ewl_Widget *combo_test_editable_cb_widget_fetch(void *data,
- unsigned int row,
- unsigned int col);
+ unsigned int row,
+ unsigned int col);
void
test_info(Ewl_Test *test)
{
- test->name = "Combo";
- test->tip = "Defines a combo box used internally.\n"
- "The contents of the box are not drawn\n"
- "outside of the evas.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_MISC;
+ test->name = "Combo";
+ test->tip = "Defines a combo box used internally.\n"
+ "The contents of the box are not drawn\n"
+ "outside of the evas.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_MISC;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *combo, *hbox, *o, *grid;
- Ewl_Model *model;
- Ewl_View *view;
- void *data;
-
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL);
- ewl_widget_show(hbox);
-
- data = combo_test_data_setup();
-
- /* create the model */
- model = ewl_model_new();
- ewl_model_data_fetch_set(model, combo_test_data_fetch);
- ewl_model_data_count_set(model, combo_test_data_count_get);
-
- /* create the view for ewl_label widgets */
- view = ewl_view_clone(ewl_label_view_get());
- ewl_view_header_fetch_set(view, combo_test_data_header_fetch);
-
- combo = ewl_combo_new();
- ewl_widget_name_set(combo, "combo_label");
- ewl_container_child_append(EWL_CONTAINER(hbox), combo);
- ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED,
- combo_value_changed, NULL);
- ewl_mvc_model_set(EWL_MVC(combo), model);
- ewl_mvc_view_set(EWL_MVC(combo), view);
- ewl_mvc_data_set(EWL_MVC(combo), data);
- ewl_widget_show(combo);
-
- /* create the view for ewl_image widgets */
- view = ewl_view_clone(ewl_image_view_get());
- ewl_view_header_fetch_set(view, combo_test_data_header_fetch);
-
- grid = ewl_grid_new();
- ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
- ewl_grid_dimensions_set(EWL_GRID(grid), 4, 1);
-
- combo = ewl_combo_new();
- ewl_widget_name_set(combo, "combo_image");
- ewl_object_fill_policy_set(EWL_OBJECT(combo), EWL_FLAG_FILL_NONE);
- ewl_combo_popup_container_set(EWL_COMBO(combo), EWL_CONTAINER(grid));
- ewl_container_child_append(EWL_CONTAINER(hbox), combo);
- ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED,
- combo_value_changed, NULL);
- ewl_mvc_model_set(EWL_MVC(combo), model);
- ewl_mvc_view_set(EWL_MVC(combo), view);
- ewl_mvc_data_set(EWL_MVC(combo), data);
- ewl_mvc_selected_set(EWL_MVC(combo), model, data, 0, 0);
- ewl_widget_show(combo);
-
- /* create the editable model/view */
- model = ewl_model_new();
- ewl_model_data_count_set(model, combo_test_data_count_get);
- ewl_model_data_fetch_set(model, combo_test_data_fetch);
-
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, combo_test_editable_cb_widget_fetch);
- ewl_view_header_fetch_set(view,
- combo_test_editable_cb_header_fetch);
-
- combo = ewl_combo_new();
- ewl_widget_name_set(combo, "combo_custom");
- ewl_container_child_append(EWL_CONTAINER(hbox), combo);
- ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED,
- combo_value_changed, NULL);
- ewl_mvc_model_set(EWL_MVC(combo), model);
- ewl_mvc_view_set(EWL_MVC(combo), view);
- ewl_mvc_data_set(EWL_MVC(combo), data);
- ewl_combo_editable_set(EWL_COMBO(combo), TRUE);
- ewl_widget_show(combo);
-
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_VFILL);
- ewl_widget_show(hbox);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Add items");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, combo_cb_add, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Clear items");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, combo_cb_clear, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *combo, *hbox, *o, *grid;
+ Ewl_Model *model;
+ Ewl_View *view;
+ void *data;
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(hbox);
+
+ data = combo_test_data_setup();
+
+ /* create the model */
+ model = ewl_model_new();
+ ewl_model_data_fetch_set(model, combo_test_data_fetch);
+ ewl_model_data_count_set(model, combo_test_data_count_get);
+
+ /* create the view for ewl_label widgets */
+ view = ewl_view_clone(ewl_label_view_get());
+ ewl_view_header_fetch_set(view, combo_test_data_header_fetch);
+
+ combo = ewl_combo_new();
+ ewl_widget_name_set(combo, "combo_label");
+ ewl_container_child_append(EWL_CONTAINER(hbox), combo);
+ ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED,
+ combo_value_changed, NULL);
+ ewl_mvc_model_set(EWL_MVC(combo), model);
+ ewl_mvc_view_set(EWL_MVC(combo), view);
+ ewl_mvc_data_set(EWL_MVC(combo), data);
+ ewl_widget_show(combo);
+
+ /* create the view for ewl_image widgets */
+ view = ewl_view_clone(ewl_image_view_get());
+ ewl_view_header_fetch_set(view, combo_test_data_header_fetch);
+
+ grid = ewl_grid_new();
+ ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
+ ewl_grid_dimensions_set(EWL_GRID(grid), 4, 1);
+
+ combo = ewl_combo_new();
+ ewl_widget_name_set(combo, "combo_image");
+ ewl_object_fill_policy_set(EWL_OBJECT(combo), EWL_FLAG_FILL_NONE);
+ ewl_combo_popup_container_set(EWL_COMBO(combo), EWL_CONTAINER(grid));
+ ewl_container_child_append(EWL_CONTAINER(hbox), combo);
+ ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED,
+ combo_value_changed, NULL);
+ ewl_mvc_model_set(EWL_MVC(combo), model);
+ ewl_mvc_view_set(EWL_MVC(combo), view);
+ ewl_mvc_data_set(EWL_MVC(combo), data);
+ ewl_mvc_selected_set(EWL_MVC(combo), model, data, 0, 0);
+ ewl_widget_show(combo);
+
+ /* create the editable model/view */
+ model = ewl_model_new();
+ ewl_model_data_count_set(model, combo_test_data_count_get);
+ ewl_model_data_fetch_set(model, combo_test_data_fetch);
+
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, combo_test_editable_cb_widget_fetch);
+ ewl_view_header_fetch_set(view,
+ combo_test_editable_cb_header_fetch);
+
+ combo = ewl_combo_new();
+ ewl_widget_name_set(combo, "combo_custom");
+ ewl_container_child_append(EWL_CONTAINER(hbox), combo);
+ ewl_callback_append(combo, EWL_CALLBACK_VALUE_CHANGED,
+ combo_value_changed, NULL);
+ ewl_mvc_model_set(EWL_MVC(combo), model);
+ ewl_mvc_view_set(EWL_MVC(combo), view);
+ ewl_mvc_data_set(EWL_MVC(combo), data);
+ ewl_combo_editable_set(EWL_COMBO(combo), TRUE);
+ ewl_widget_show(combo);
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_VFILL);
+ ewl_widget_show(hbox);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Add items");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, combo_cb_add, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Clear items");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, combo_cb_clear, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_widget_show(o);
+
+ return 1;
}
static void *
combo_test_data_setup(void)
{
- Ewl_Combo_Test_Data *data;
- unsigned int i;
-
- const char *icons[] = {
- EWL_ICON_EDIT_COPY,
- EWL_ICON_EDIT_CUT,
- EWL_ICON_EDIT_DELETE,
- EWL_ICON_EDIT_FIND,
- EWL_ICON_EDIT_FIND_REPLACE,
- EWL_ICON_EDIT_PASTE,
- EWL_ICON_EDIT_REDO,
- EWL_ICON_EDIT_SELECT_ALL,
- EWL_ICON_EDIT_UNDO,
- EWL_ICON_FORMAT_INDENT_LESS,
- EWL_ICON_FORMAT_INDENT_MORE,
- EWL_ICON_FORMAT_JUSTIFY_CENTER,
- EWL_ICON_FORMAT_JUSTIFY_FILL,
- EWL_ICON_FORMAT_JUSTIFY_LEFT,
- EWL_ICON_FORMAT_JUSTIFY_RIGHT,
- };
-
- data = calloc(1, sizeof(Ewl_Combo_Test_Data));
- data->count = sizeof(icons) / sizeof(const char *);
-
- data->data = calloc(data->count, sizeof(char *));
-
- for (i = 0; i < data->count; i++)
- {
- const char *icon;
-
- icon = ewl_icon_theme_icon_path_get(icons[i], EWL_ICON_SIZE_MEDIUM);
- data->data[i] = strdup((icon ? icon : icons[i]));
- }
-
- return data;
+ Ewl_Combo_Test_Data *data;
+ unsigned int i;
+
+ const char *icons[] = {
+ EWL_ICON_EDIT_COPY,
+ EWL_ICON_EDIT_CUT,
+ EWL_ICON_EDIT_DELETE,
+ EWL_ICON_EDIT_FIND,
+ EWL_ICON_EDIT_FIND_REPLACE,
+ EWL_ICON_EDIT_PASTE,
+ EWL_ICON_EDIT_REDO,
+ EWL_ICON_EDIT_SELECT_ALL,
+ EWL_ICON_EDIT_UNDO,
+ EWL_ICON_FORMAT_INDENT_LESS,
+ EWL_ICON_FORMAT_INDENT_MORE,
+ EWL_ICON_FORMAT_JUSTIFY_CENTER,
+ EWL_ICON_FORMAT_JUSTIFY_FILL,
+ EWL_ICON_FORMAT_JUSTIFY_LEFT,
+ EWL_ICON_FORMAT_JUSTIFY_RIGHT,
+ };
+
+ data = calloc(1, sizeof(Ewl_Combo_Test_Data));
+ data->count = sizeof(icons) / sizeof(const char *);
+
+ data->data = calloc(data->count, sizeof(char *));
+
+ for (i = 0; i < data->count; i++)
+ {
+ const char *icon;
+
+ icon = ewl_icon_theme_icon_path_get(icons[i], EWL_ICON_SIZE_MEDIUM);
+ data->data[i] = strdup((icon ? icon : icons[i]));
+ }
+
+ return data;
}
static Ewl_Widget *
combo_test_data_header_fetch(void *data __UNUSED__, unsigned int col __UNUSED__)
{
- Ewl_Widget *header;
+ Ewl_Widget *header;
- header = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(header), "Select Image");
- ewl_widget_show(header);
+ header = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(header), "Select Image");
+ ewl_widget_show(header);
- return header;
+ return header;
}
static void *
combo_test_data_fetch(void *data, unsigned int row,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Combo_Test_Data *d;
+ Ewl_Combo_Test_Data *d;
- d = data;
- if (row < d->count)
- return d->data[row];
- else
- return NULL;
+ d = data;
+ if (row < d->count)
+ return d->data[row];
+ else
+ return NULL;
}
static unsigned int
combo_test_data_count_get(void *data)
{
- Ewl_Combo_Test_Data *d;
+ Ewl_Combo_Test_Data *d;
- d = data;
- return d->count;
+ d = data;
+ return d->count;
}
static void
combo_value_changed(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Combo_Test_Data *d;
- Ewl_Selection_Idx *idx;
+ Ewl_Combo_Test_Data *d;
+ Ewl_Selection_Idx *idx;
- d = ewl_mvc_data_get(EWL_MVC(w));
- idx = ewl_mvc_selected_get(EWL_MVC(w));
+ d = ewl_mvc_data_get(EWL_MVC(w));
+ idx = ewl_mvc_selected_get(EWL_MVC(w));
- /*
- printf("value changed to %d %p)\n",
- idx->row, d->data[idx->row]);
- */
+ /*
+ printf("value changed to %d %p)\n",
+ idx->row, d->data[idx->row]);
+ */
}
static void
combo_cb_add(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *c;
- Ewl_Combo_Test_Data *d;
- unsigned int s;
+ Ewl_Widget *c;
+ Ewl_Combo_Test_Data *d;
+ unsigned int s;
- c = ewl_widget_name_find("combo_label");
- d = ewl_mvc_data_get(EWL_MVC(c));
+ c = ewl_widget_name_find("combo_label");
+ d = ewl_mvc_data_get(EWL_MVC(c));
- s = d->count;
- d->count += 2;
- d->data = realloc(d->data, sizeof(char *) * d->count);
+ s = d->count;
+ d->count += 2;
+ d->data = realloc(d->data, sizeof(char *) * d->count);
- d->data[s] = strdup(PACKAGE_DATA_DIR "/images/Package.png");
- d->data[s + 1] = strdup(PACKAGE_DATA_DIR "/images/Open.png");
+ d->data[s] = strdup(PACKAGE_DATA_DIR "/images/Package.png");
+ d->data[s + 1] = strdup(PACKAGE_DATA_DIR "/images/Open.png");
- ewl_mvc_dirty_set(EWL_MVC(c), 1);
+ ewl_mvc_dirty_set(EWL_MVC(c), 1);
- c = ewl_widget_name_find("combo_image");
- ewl_mvc_dirty_set(EWL_MVC(c), 1);
+ c = ewl_widget_name_find("combo_image");
+ ewl_mvc_dirty_set(EWL_MVC(c), 1);
}
static void
combo_cb_clear(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *c;
- Ewl_Combo_Test_Data *d;
+ Ewl_Widget *c;
+ Ewl_Combo_Test_Data *d;
- c = ewl_widget_name_find("combo_label");
- d = ewl_mvc_data_get(EWL_MVC(c));
+ c = ewl_widget_name_find("combo_label");
+ d = ewl_mvc_data_get(EWL_MVC(c));
- d->count = 0;
- free(d->data);
- d->data = NULL;
+ d->count = 0;
+ free(d->data);
+ d->data = NULL;
- ewl_mvc_dirty_set(EWL_MVC(c), 1);
+ ewl_mvc_dirty_set(EWL_MVC(c), 1);
- c = ewl_widget_name_find("combo_image");
- ewl_mvc_dirty_set(EWL_MVC(c), 1);
+ c = ewl_widget_name_find("combo_image");
+ ewl_mvc_dirty_set(EWL_MVC(c), 1);
}
static Ewl_Widget *
combo_test_editable_cb_header_fetch(void *data, unsigned int col __UNUSED__)
{
- Ewl_Combo_Test_Data *d;
- Ewl_Widget *w, *o, *o2;
- Ewl_Selection_Idx *idx;
- char *val;
-
- d = data;
- w = ewl_widget_name_find("combo_custom");
- idx = ewl_mvc_selected_get(EWL_MVC(w));
-
- w = ewl_hbox_new();
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
- val = "Please select an option.";
- o = ewl_entry_new();
-
- if (idx)
- {
- val = strrchr(d->data[idx->row], '/');
- ewl_text_text_set(EWL_TEXT(o),
- (val ? val + 1 : d->data[idx->row]));
-
- o2 = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(o2), d->data[idx->row]);
- ewl_container_child_append(EWL_CONTAINER(w), o2);
- ewl_widget_show(o2);
- }
-
- else
- ewl_text_text_set(EWL_TEXT(o), val);
-
- ewl_container_child_append(EWL_CONTAINER(w), o);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- combo_cb_entry_changed, NULL);
- ewl_widget_show(o);
-
- return w;
+ Ewl_Combo_Test_Data *d;
+ Ewl_Widget *w, *o, *o2;
+ Ewl_Selection_Idx *idx;
+ char *val;
+
+ d = data;
+ w = ewl_widget_name_find("combo_custom");
+ idx = ewl_mvc_selected_get(EWL_MVC(w));
+
+ w = ewl_hbox_new();
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
+ val = "Please select an option.";
+ o = ewl_entry_new();
+
+ if (idx)
+ {
+ val = strrchr(d->data[idx->row], '/');
+ ewl_text_text_set(EWL_TEXT(o),
+ (val ? val + 1 : d->data[idx->row]));
+
+ o2 = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(o2), d->data[idx->row]);
+ ewl_container_child_append(EWL_CONTAINER(w), o2);
+ ewl_widget_show(o2);
+ }
+
+ else
+ ewl_text_text_set(EWL_TEXT(o), val);
+
+ ewl_container_child_append(EWL_CONTAINER(w), o);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ combo_cb_entry_changed, NULL);
+ ewl_widget_show(o);
+
+ return w;
}
static Ewl_Widget *
combo_test_editable_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *w;
- Ewl_Widget *o;
- char *str;
+ Ewl_Widget *w;
+ Ewl_Widget *o;
+ char *str;
- w = ewl_hbox_new();
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
+ w = ewl_hbox_new();
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
- o = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(o), (const char *)data);
- ewl_container_child_append(EWL_CONTAINER(w), o);
- ewl_widget_show(o);
+ o = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(o), (const char *)data);
+ ewl_container_child_append(EWL_CONTAINER(w), o);
+ ewl_widget_show(o);
- o = ewl_label_new();
- str = strrchr((const char *)data, '/');
- ewl_label_text_set(EWL_LABEL(o), (str ? str + 1 : data));
- ewl_container_child_append(EWL_CONTAINER(w), o);
- ewl_widget_show(o);
+ o = ewl_label_new();
+ str = strrchr((const char *)data, '/');
+ ewl_label_text_set(EWL_LABEL(o), (str ? str + 1 : data));
+ ewl_container_child_append(EWL_CONTAINER(w), o);
+ ewl_widget_show(o);
- return w;
+ return w;
}
static void
combo_cb_entry_changed(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- printf("value changed to (%s)\n", ewl_text_text_get(EWL_TEXT(w)));
+ printf("value changed to (%s)\n", ewl_text_text_get(EWL_TEXT(w)));
}
diff --git a/src/bin/tests/config/ewl_config_test.c b/src/bin/tests/config/ewl_config_test.c
index e097c49..192c468 100644
--- a/src/bin/tests/config/ewl_config_test.c
+++ b/src/bin/tests/config/ewl_config_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_config.h"
@@ -27,26 +27,26 @@ static int remove_key(char *buf, int len);
*/
static Ewl_Unit_Test config_unit_tests[] = {
- {"string get/set", string_get_set, NULL, -1, 0},
- {"int get/set", int_get_set, NULL, -1, 0},
- {"float get/set", float_get_set, NULL, -1, 0},
- {"color get/set", color_get_set, NULL, -1, 0},
- {"string overwrite", string_overwrite, NULL, -1, 0},
- {"int overwrite", int_overwrite, NULL, -1, 0},
- {"float overwrite", float_overwrite, NULL, -1, 0},
- {"color overwrite", color_overwrite, NULL, -1, 0},
- {"remove key", remove_key, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"string get/set", string_get_set, NULL, -1, 0},
+ {"int get/set", int_get_set, NULL, -1, 0},
+ {"float get/set", float_get_set, NULL, -1, 0},
+ {"color get/set", color_get_set, NULL, -1, 0},
+ {"string overwrite", string_overwrite, NULL, -1, 0},
+ {"int overwrite", int_overwrite, NULL, -1, 0},
+ {"float overwrite", float_overwrite, NULL, -1, 0},
+ {"color overwrite", color_overwrite, NULL, -1, 0},
+ {"remove key", remove_key, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Config";
- test->tip = "The config system.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->unit_tests = config_unit_tests;
+ test->name = "Config";
+ test->tip = "The config system.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->unit_tests = config_unit_tests;
}
/*
@@ -55,49 +55,49 @@ test_info(Ewl_Test *test)
static int
string_get_set(char *buf, int len)
{
- Ewl_Config *conf;
- const char *string = "The sun is shinning.";
- const char *value;
- int ret = 0;
-
- conf = ewl_config_new("unit test");
-
- ewl_config_string_set(conf, "weather", string, EWL_STATE_TRANSIENT);
-
- /* first try to get a string that cannot exist */
- value = ewl_config_string_get(conf, "climate");
- if (value) {
- LOG_FAILURE(buf, len, "config finds an string for"
- "non-existing key");
- goto CLEANUP;
- }
-
- /* now try to get the weather report */
- value = ewl_config_string_get(conf, "weather");
- if (!value) {
- LOG_FAILURE(buf, len, "config does not find the string we set");
- goto CLEANUP;
- }
-
- if (strcmp(value, string)) {
- LOG_FAILURE(buf, len, "config returned a different string");
- goto CLEANUP;
- }
-
- /* the config must not save our address */
- if (value == string) {
- LOG_FAILURE(buf, len, "config returned the address of the set "
- "string");
- goto CLEANUP;
- }
-
- /* everything went fine */
- ret = 1;
+ Ewl_Config *conf;
+ const char *string = "The sun is shinning.";
+ const char *value;
+ int ret = 0;
+
+ conf = ewl_config_new("unit test");
+
+ ewl_config_string_set(conf, "weather", string, EWL_STATE_TRANSIENT);
+
+ /* first try to get a string that cannot exist */
+ value = ewl_config_string_get(conf, "climate");
+ if (value) {
+ LOG_FAILURE(buf, len, "config finds an string for"
+ "non-existing key");
+ goto CLEANUP;
+ }
+
+ /* now try to get the weather report */
+ value = ewl_config_string_get(conf, "weather");
+ if (!value) {
+ LOG_FAILURE(buf, len, "config does not find the string we set");
+ goto CLEANUP;
+ }
+
+ if (strcmp(value, string)) {
+ LOG_FAILURE(buf, len, "config returned a different string");
+ goto CLEANUP;
+ }
+
+ /* the config must not save our address */
+ if (value == string) {
+ LOG_FAILURE(buf, len, "config returned the address of the set "
+ "string");
+ goto CLEANUP;
+ }
+
+ /* everything went fine */
+ ret = 1;
CLEANUP:
- ewl_config_destroy(conf);
+ ewl_config_destroy(conf);
- return ret;
+ return ret;
}
/*
@@ -106,39 +106,39 @@ CLEANUP:
static int
int_get_set(char *buf, int len)
{
- Ewl_Config *conf;
- int number = 1423;
- int value;
- int ret = 0;
+ Ewl_Config *conf;
+ int number = 1423;
+ int value;
+ int ret = 0;
- conf = ewl_config_new("unit test");
+ conf = ewl_config_new("unit test");
- ewl_config_int_set(conf, "number", number, EWL_STATE_TRANSIENT);
+ ewl_config_int_set(conf, "number", number, EWL_STATE_TRANSIENT);
- /* first try to get a value that cannot exist */
- value = ewl_config_int_get(conf, "letter");
+ /* first try to get a value that cannot exist */
+ value = ewl_config_int_get(conf, "letter");
- /* on error it should return 0 */
- if (value != 0) {
- LOG_FAILURE(buf, len, "config returns a number unequal zero for"
- "non-existing key");
- goto CLEANUP;
- }
+ /* on error it should return 0 */
+ if (value != 0) {
+ LOG_FAILURE(buf, len, "config returns a number unequal zero for"
+ "non-existing key");
+ goto CLEANUP;
+ }
- /* now try to get the set number */
- value = ewl_config_int_get(conf, "number");
- if (value != number) {
- LOG_FAILURE(buf, len, "config returns wrong number");
- goto CLEANUP;
- }
+ /* now try to get the set number */
+ value = ewl_config_int_get(conf, "number");
+ if (value != number) {
+ LOG_FAILURE(buf, len, "config returns wrong number");
+ goto CLEANUP;
+ }
- /* everything went fine */
- ret = 1;
+ /* everything went fine */
+ ret = 1;
CLEANUP:
- ewl_config_destroy(conf);
+ ewl_config_destroy(conf);
- return ret;
+ return ret;
}
/*
@@ -147,39 +147,39 @@ CLEANUP:
static int
float_get_set(char *buf, int len)
{
- Ewl_Config *conf;
- int number = 2.99792E8;
- int value;
- int ret = 0;
+ Ewl_Config *conf;
+ int number = 2.99792E8;
+ int value;
+ int ret = 0;
- conf = ewl_config_new("unit test");
+ conf = ewl_config_new("unit test");
- ewl_config_float_set(conf, "velocity", number, EWL_STATE_TRANSIENT);
+ ewl_config_float_set(conf, "velocity", number, EWL_STATE_TRANSIENT);
- /* first try to get a value that cannot exist */
- value = ewl_config_float_get(conf, "speed");
+ /* first try to get a value that cannot exist */
+ value = ewl_config_float_get(conf, "speed");
- /* on error it should return 0.0, according to the docs */
- if (value != 0.0) {
- LOG_FAILURE(buf, len, "config returns a number unequal zero for"
- "non-existing key");
- goto CLEANUP;
- }
+ /* on error it should return 0.0, according to the docs */
+ if (value != 0.0) {
+ LOG_FAILURE(buf, len, "config returns a number unequal zero for"
+ "non-existing key");
+ goto CLEANUP;
+ }
- /* now try to get the set velocity */
- value = ewl_config_float_get(conf, "velocity");
- if (value != number) {
- LOG_FAILURE(buf, len, "config returns wrong number");
- goto CLEANUP;
- }
+ /* now try to get the set velocity */
+ value = ewl_config_float_get(conf, "velocity");
+ if (value != number) {
+ LOG_FAILURE(buf, len, "config returns wrong number");
+ goto CLEANUP;
+ }
- /* everything went fine */
- ret = 1;
+ /* everything went fine */
+ ret = 1;
CLEANUP:
- ewl_config_destroy(conf);
+ ewl_config_destroy(conf);
- return ret;
+ return ret;
}
/*
@@ -188,39 +188,39 @@ CLEANUP:
static int
color_get_set(char *buf, int len)
{
- Ewl_Config *conf;
- int r, b, g, a;
- int ret = 0;
+ Ewl_Config *conf;
+ int r, b, g, a;
+ int ret = 0;
- conf = ewl_config_new("unit test");
+ conf = ewl_config_new("unit test");
- ewl_config_color_set(conf, "bg_color", 0, 100, 200, 255,
- EWL_STATE_TRANSIENT);
+ ewl_config_color_set(conf, "bg_color", 0, 100, 200, 255,
+ EWL_STATE_TRANSIENT);
- /* first try to get a value that cannot exist */
- ewl_config_color_get(conf, "fg_color", &r, &g, &b, &a);
+ /* first try to get a value that cannot exist */
+ ewl_config_color_get(conf, "fg_color", &r, &g, &b, &a);
- /* on error it should return 0 */
- if (r != 0 || g != 0 || b != 0 || a != 0) {
- LOG_FAILURE(buf, len, "config returns not (0,0,0,0) for "
- "non-existing key");
- goto CLEANUP;
- }
+ /* on error it should return 0 */
+ if (r != 0 || g != 0 || b != 0 || a != 0) {
+ LOG_FAILURE(buf, len, "config returns not (0,0,0,0) for "
+ "non-existing key");
+ goto CLEANUP;
+ }
- /* now try to get the set number */
- ewl_config_color_get(conf, "bg_color", &r, &g, &b, &a);
- if (r != 0 || g != 100 || b != 200 || a != 255) {
- LOG_FAILURE(buf, len, "config returns wrong color");
- goto CLEANUP;
- }
+ /* now try to get the set number */
+ ewl_config_color_get(conf, "bg_color", &r, &g, &b, &a);
+ if (r != 0 || g != 100 || b != 200 || a != 255) {
+ LOG_FAILURE(buf, len, "config returns wrong color");
+ goto CLEANUP;
+ }
- /* everything went fine */
- ret = 1;
+ /* everything went fine */
+ ret = 1;
CLEANUP:
- ewl_config_destroy(conf);
+ ewl_config_destroy(conf);
- return ret;
+ return ret;
}
/*
@@ -229,38 +229,38 @@ CLEANUP:
static int
string_overwrite(char *buf, int len)
{
- int ret = 1;
- Ewl_Config *conf;
- const char *strings[] = {
- "First Value",
- "Second Value",
- "Yet another",
- "The last one",
- NULL
- };
- const char **string = strings;
-
- conf = ewl_config_new("unit test");
-
- while (*string == NULL) {
- const char *value;
-
- ewl_config_string_set(conf, "test key", *string,
- EWL_STATE_TRANSIENT);
- value = ewl_config_string_get(conf, "test key");
-
- if (strcmp(value, *string)) {
- LOG_FAILURE(buf, len, "The returned string is different"
- " from the set string");
- ret = 0;
- break;
- }
- string++;
- }
-
- ewl_config_destroy(conf);
-
- return ret;
+ int ret = 1;
+ Ewl_Config *conf;
+ const char *strings[] = {
+ "First Value",
+ "Second Value",
+ "Yet another",
+ "The last one",
+ NULL
+ };
+ const char **string = strings;
+
+ conf = ewl_config_new("unit test");
+
+ while (*string == NULL) {
+ const char *value;
+
+ ewl_config_string_set(conf, "test key", *string,
+ EWL_STATE_TRANSIENT);
+ value = ewl_config_string_get(conf, "test key");
+
+ if (strcmp(value, *string)) {
+ LOG_FAILURE(buf, len, "The returned string is different"
+ " from the set string");
+ ret = 0;
+ break;
+ }
+ string++;
+ }
+
+ ewl_config_destroy(conf);
+
+ return ret;
}
/*
@@ -269,30 +269,30 @@ string_overwrite(char *buf, int len)
static int
int_overwrite(char *buf, int len)
{
- int ret = 1;
- Ewl_Config *conf;
- int i;
+ int ret = 1;
+ Ewl_Config *conf;
+ int i;
- conf = ewl_config_new("unit test");
+ conf = ewl_config_new("unit test");
- for (i = 0; i < 12; i++) {
- int v = RAND_RANGE(-1000, 1000);
- int v_r;
+ for (i = 0; i < 12; i++) {
+ int v = RAND_RANGE(-1000, 1000);
+ int v_r;
- ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT);
- v_r = ewl_config_int_get(conf, "test key");
+ ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT);
+ v_r = ewl_config_int_get(conf, "test key");
- if (v_r != v) {
- LOG_FAILURE(buf, len, "The returned int is different"
- " from the set int");
- ret = 0;
- break;
- }
- }
+ if (v_r != v) {
+ LOG_FAILURE(buf, len, "The returned int is different"
+ " from the set int");
+ ret = 0;
+ break;
+ }
+ }
- ewl_config_destroy(conf);
+ ewl_config_destroy(conf);
- return ret;
+ return ret;
}
/*
@@ -301,30 +301,30 @@ int_overwrite(char *buf, int len)
static int
float_overwrite(char *buf, int len)
{
- int ret = 1;
- Ewl_Config *conf;
- int i;
+ int ret = 1;
+ Ewl_Config *conf;
+ int i;
- conf = ewl_config_new("unit test");
+ conf = ewl_config_new("unit test");
- for (i = 0; i < 12; i++) {
- float v = rand();
- float v_r;
+ for (i = 0; i < 12; i++) {
+ float v = rand();
+ float v_r;
- ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT);
- v_r = ewl_config_int_get(conf, "test key");
+ ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT);
+ v_r = ewl_config_int_get(conf, "test key");
- if (v_r != v) {
- LOG_FAILURE(buf, len, "The returned float is different"
- " from the set float");
- ret = 0;
- break;
- }
- }
+ if (v_r != v) {
+ LOG_FAILURE(buf, len, "The returned float is different"
+ " from the set float");
+ ret = 0;
+ break;
+ }
+ }
- ewl_config_destroy(conf);
+ ewl_config_destroy(conf);
- return ret;
+ return ret;
}
/*
@@ -333,34 +333,34 @@ float_overwrite(char *buf, int len)
static int
color_overwrite(char *buf, int len)
{
- int ret = 1;
- Ewl_Config *conf;
- int i;
-
- conf = ewl_config_new("unit test");
-
- for (i = 0; i < 12; i++) {
- int r = RAND_RANGE(0, 255);
- int g = RAND_RANGE(0, 255);
- int b = RAND_RANGE(0, 255);
- int a = RAND_RANGE(0, 255);
- int r_r, g_r, b_r, a_r;
-
- ewl_config_color_set(conf, "test key", r, g, b, a,
- EWL_STATE_TRANSIENT);
- ewl_config_color_get(conf, "test key", &r_r, &g_r, &b_r, &a_r);
-
- if (r_r != r || g_r != g || b_r != b || a_r != a) {
- LOG_FAILURE(buf, len, "The returned color is different"
- " from the set color");
- ret = 0;
- break;
- }
- }
-
- ewl_config_destroy(conf);
-
- return ret;
+ int ret = 1;
+ Ewl_Config *conf;
+ int i;
+
+ conf = ewl_config_new("unit test");
+
+ for (i = 0; i < 12; i++) {
+ int r = RAND_RANGE(0, 255);
+ int g = RAND_RANGE(0, 255);
+ int b = RAND_RANGE(0, 255);
+ int a = RAND_RANGE(0, 255);
+ int r_r, g_r, b_r, a_r;
+
+ ewl_config_color_set(conf, "test key", r, g, b, a,
+ EWL_STATE_TRANSIENT);
+ ewl_config_color_get(conf, "test key", &r_r, &g_r, &b_r, &a_r);
+
+ if (r_r != r || g_r != g || b_r != b || a_r != a) {
+ LOG_FAILURE(buf, len, "The returned color is different"
+ " from the set color");
+ ret = 0;
+ break;
+ }
+ }
+
+ ewl_config_destroy(conf);
+
+ return ret;
}
/*
@@ -373,118 +373,118 @@ color_overwrite(char *buf, int len)
static int
remove_key(char *buf, int len)
{
- int ret = 1;
- Ewl_Config *cfg;
-
- cfg = ewl_config_new("unit test");
-
- cfg->data.system = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(cfg->data.system, free);
- ecore_hash_free_value_cb_set(cfg->data.system, free);
- ecore_hash_set(cfg->data.system, strdup("/test/key"), strdup("value"));
- ecore_hash_set(cfg->data.system, strdup("/system/remove"), strdup("value"));
- ecore_hash_set(cfg->data.system, strdup("/user/remove"), strdup("value"));
- ecore_hash_set(cfg->data.system, strdup("/instance/remove"), strdup("value"));
-
- cfg->data.user = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(cfg->data.user, free);
- ecore_hash_free_value_cb_set(cfg->data.user, free);
- ecore_hash_set(cfg->data.user, strdup("/test/key"), strdup("value"));
- ecore_hash_set(cfg->data.user, strdup("/system/remove"), strdup("value"));
- ecore_hash_set(cfg->data.user, strdup("/user/remove"), strdup("value"));
- ecore_hash_set(cfg->data.user, strdup("/instance/remove"), strdup("value"));
-
- cfg->data.instance = ecore_hash_new(ecore_str_hash, ecore_str_compare);
- ecore_hash_free_key_cb_set(cfg->data.instance, free);
- ecore_hash_free_value_cb_set(cfg->data.instance, free);
- ecore_hash_set(cfg->data.instance, strdup("/test/key"), strdup("value"));
- ecore_hash_set(cfg->data.instance, strdup("/system/remove"), strdup("value"));
- ecore_hash_set(cfg->data.instance, strdup("/user/remove"), strdup("value"));
- ecore_hash_set(cfg->data.instance, strdup("/instance/remove"), strdup("value"));
-
- ewl_config_key_remove(cfg, "/test/key");
- if (ecore_hash_get(cfg->data.system, "/test/key") != NULL)
- {
- LOG_FAILURE(buf, len, "System hash contains key after key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.user, "/test/key") != NULL)
- {
- LOG_FAILURE(buf, len, "User hash contains key after key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.instance, "/test/key") != NULL)
- {
- LOG_FAILURE(buf, len, "Instance hash contains key after key remove");
- ret = 0;
- goto EXIT;
- }
-
- ewl_config_system_key_remove(cfg, "/system/remove");
- if (ecore_hash_get(cfg->data.system, "/system/remove") != NULL)
- {
- LOG_FAILURE(buf, len, "System hash contains key after system key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.user, "/system/remove") == NULL)
- {
- LOG_FAILURE(buf, len, "User hash missing key after system key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.instance, "/system/remove") == NULL)
- {
- LOG_FAILURE(buf, len, "Instance hash missing key after system key remove");
- ret = 0;
- goto EXIT;
- }
-
- ewl_config_user_key_remove(cfg, "/user/remove");
- if (ecore_hash_get(cfg->data.system, "/user/remove") == NULL)
- {
- LOG_FAILURE(buf, len, "System hash missing key after user key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.user, "/user/remove") != NULL)
- {
- LOG_FAILURE(buf, len, "User hash contains key after user key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.instance, "/user/remove") == NULL)
- {
- LOG_FAILURE(buf, len, "Instance hash missing key after user key remove");
- ret = 0;
- goto EXIT;
- }
-
- ewl_config_instance_key_remove(cfg, "/instance/remove");
- if (ecore_hash_get(cfg->data.system, "/instance/remove") == NULL)
- {
- LOG_FAILURE(buf, len, "System hash missing key after instance key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.user, "/instance/remove") == NULL)
- {
- LOG_FAILURE(buf, len, "User hash missing key after instance key remove");
- ret = 0;
- goto EXIT;
- }
- else if (ecore_hash_get(cfg->data.instance, "/instance/remove") != NULL)
- {
- LOG_FAILURE(buf, len, "Instance hash contains key after instance key remove");
- ret = 0;
- goto EXIT;
- }
+ int ret = 1;
+ Ewl_Config *cfg;
+
+ cfg = ewl_config_new("unit test");
+
+ cfg->data.system = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(cfg->data.system, free);
+ ecore_hash_free_value_cb_set(cfg->data.system, free);
+ ecore_hash_set(cfg->data.system, strdup("/test/key"), strdup("value"));
+ ecore_hash_set(cfg->data.system, strdup("/system/remove"), strdup("value"));
+ ecore_hash_set(cfg->data.system, strdup("/user/remove"), strdup("value"));
+ ecore_hash_set(cfg->data.system, strdup("/instance/remove"), strdup("value"));
+
+ cfg->data.user = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(cfg->data.user, free);
+ ecore_hash_free_value_cb_set(cfg->data.user, free);
+ ecore_hash_set(cfg->data.user, strdup("/test/key"), strdup("value"));
+ ecore_hash_set(cfg->data.user, strdup("/system/remove"), strdup("value"));
+ ecore_hash_set(cfg->data.user, strdup("/user/remove"), strdup("value"));
+ ecore_hash_set(cfg->data.user, strdup("/instance/remove"), strdup("value"));
+
+ cfg->data.instance = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ ecore_hash_free_key_cb_set(cfg->data.instance, free);
+ ecore_hash_free_value_cb_set(cfg->data.instance, free);
+ ecore_hash_set(cfg->data.instance, strdup("/test/key"), strdup("value"));
+ ecore_hash_set(cfg->data.instance, strdup("/system/remove"), strdup("value"));
+ ecore_hash_set(cfg->data.instance, strdup("/user/remove"), strdup("value"));
+ ecore_hash_set(cfg->data.instance, strdup("/instance/remove"), strdup("value"));
+
+ ewl_config_key_remove(cfg, "/test/key");
+ if (ecore_hash_get(cfg->data.system, "/test/key") != NULL)
+ {
+ LOG_FAILURE(buf, len, "System hash contains key after key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.user, "/test/key") != NULL)
+ {
+ LOG_FAILURE(buf, len, "User hash contains key after key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.instance, "/test/key") != NULL)
+ {
+ LOG_FAILURE(buf, len, "Instance hash contains key after key remove");
+ ret = 0;
+ goto EXIT;
+ }
+
+ ewl_config_system_key_remove(cfg, "/system/remove");
+ if (ecore_hash_get(cfg->data.system, "/system/remove") != NULL)
+ {
+ LOG_FAILURE(buf, len, "System hash contains key after system key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.user, "/system/remove") == NULL)
+ {
+ LOG_FAILURE(buf, len, "User hash missing key after system key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.instance, "/system/remove") == NULL)
+ {
+ LOG_FAILURE(buf, len, "Instance hash missing key after system key remove");
+ ret = 0;
+ goto EXIT;
+ }
+
+ ewl_config_user_key_remove(cfg, "/user/remove");
+ if (ecore_hash_get(cfg->data.system, "/user/remove") == NULL)
+ {
+ LOG_FAILURE(buf, len, "System hash missing key after user key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.user, "/user/remove") != NULL)
+ {
+ LOG_FAILURE(buf, len, "User hash contains key after user key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.instance, "/user/remove") == NULL)
+ {
+ LOG_FAILURE(buf, len, "Instance hash missing key after user key remove");
+ ret = 0;
+ goto EXIT;
+ }
+
+ ewl_config_instance_key_remove(cfg, "/instance/remove");
+ if (ecore_hash_get(cfg->data.system, "/instance/remove") == NULL)
+ {
+ LOG_FAILURE(buf, len, "System hash missing key after instance key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.user, "/instance/remove") == NULL)
+ {
+ LOG_FAILURE(buf, len, "User hash missing key after instance key remove");
+ ret = 0;
+ goto EXIT;
+ }
+ else if (ecore_hash_get(cfg->data.instance, "/instance/remove") != NULL)
+ {
+ LOG_FAILURE(buf, len, "Instance hash contains key after instance key remove");
+ ret = 0;
+ goto EXIT;
+ }
EXIT:
- ewl_config_destroy(cfg);
- return ret;
+ ewl_config_destroy(cfg);
+ return ret;
}
diff --git a/src/bin/tests/container/ewl_container_test.c b/src/bin/tests/container/ewl_container_test.c
index fa1fd19..d1d6805 100644
--- a/src/bin/tests/container/ewl_container_test.c
+++ b/src/bin/tests/container/ewl_container_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -9,49 +9,49 @@
static int switch_parents(char *buf, int len);
static Ewl_Unit_Test container_unit_tests[] = {
- {"switch parents", switch_parents, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"switch parents", switch_parents, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Container";
- test->tip = "The base container type.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_UNIT;
- test->unit_tests = container_unit_tests;
+ test->name = "Container";
+ test->tip = "The base container type.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_UNIT;
+ test->unit_tests = container_unit_tests;
}
static int
switch_parents(char *buf, int len)
{
- Ewl_Widget *p1, *p2, *w;
+ Ewl_Widget *p1, *p2, *w;
- p1 = ewl_vbox_new();
- ewl_widget_show(p1);
+ p1 = ewl_vbox_new();
+ ewl_widget_show(p1);
- w = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(p1), w);
- ewl_widget_show(w);
+ w = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(p1), w);
+ ewl_widget_show(w);
- if (!(w->parent == p1))
- {
- snprintf(buf, len, "initial parent incorrect (%p vs %p)", w->parent, p1);
- return FALSE;
- }
+ if (!(w->parent == p1))
+ {
+ snprintf(buf, len, "initial parent incorrect (%p vs %p)", w->parent, p1);
+ return FALSE;
+ }
- p2 = ewl_vbox_new();
- ewl_widget_show(p2);
+ p2 = ewl_vbox_new();
+ ewl_widget_show(p2);
- ewl_container_child_append(EWL_CONTAINER(p2), w);
- if (!(w->parent == p2))
- {
- snprintf(buf, len, "reparent incorrect (%p vs %p)", w->parent, p2);
- return FALSE;
- }
+ ewl_container_child_append(EWL_CONTAINER(p2), w);
+ if (!(w->parent == p2))
+ {
+ snprintf(buf, len, "reparent incorrect (%p vs %p)", w->parent, p2);
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
diff --git a/src/bin/tests/datepicker/ewl_datepicker_test.c b/src/bin/tests/datepicker/ewl_datepicker_test.c
index 8d8af5c..9aea5d0 100644
--- a/src/bin/tests/datepicker/ewl_datepicker_test.c
+++ b/src/bin/tests/datepicker/ewl_datepicker_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_datepicker.h"
@@ -9,22 +9,22 @@ static int create_test(Ewl_Container *win);
void
test_info(Ewl_Test *test)
{
- test->name = "Datepicker";
- test->tip = "Defines a datepicker widget.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_MISC;
+ test->name = "Datepicker";
+ test->tip = "Defines a datepicker widget.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_MISC;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *datepicker;
+ Ewl_Widget *datepicker;
- datepicker = ewl_datepicker_new();
- ewl_container_child_append(EWL_CONTAINER(box), datepicker);
- ewl_widget_show(datepicker);
+ datepicker = ewl_datepicker_new();
+ ewl_container_child_append(EWL_CONTAINER(box), datepicker);
+ ewl_widget_show(datepicker);
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/dialog/ewl_dialog_test.c b/src/bin/tests/dialog/ewl_dialog_test.c
index f5bfd02..19f6371 100644
--- a/src/bin/tests/dialog/ewl_dialog_test.c
+++ b/src/bin/tests/dialog/ewl_dialog_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -19,169 +19,169 @@ static void dialog_delete_cb(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Dialog";
- test->tip = "Defines a dialog window.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Dialog";
+ test->tip = "Defines a dialog window.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o;
- Ewl_Widget *border;
- Ewl_Widget *chain;
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "");
- ewl_container_child_append(box, o);
- ewl_widget_name_set(o, "dialog_label");
- ewl_widget_show(o);
-
- border = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(border), "Button Position");
- ewl_container_child_append(EWL_CONTAINER(box), border);
- ewl_widget_show(border);
-
- chain = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(chain), "Top");
- ewl_radiobutton_value_set(EWL_RADIOBUTTON(chain),
- (void *)EWL_POSITION_TOP);
- ewl_container_child_append(EWL_CONTAINER(border), chain);
- ewl_widget_show(chain);
-
- o = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(o), "Right");
- ewl_radiobutton_value_set(EWL_RADIOBUTTON(o),
- (void *)EWL_POSITION_RIGHT);
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(chain));
- ewl_container_child_append(EWL_CONTAINER(border), o);
- ewl_widget_show(o);
-
- o = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(o), "Left");
- ewl_radiobutton_value_set(EWL_RADIOBUTTON(o),
- (void *)EWL_POSITION_LEFT);
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(chain));
- ewl_container_child_append(EWL_CONTAINER(border), o);
- ewl_widget_show(o);
-
- o = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(o), "Bottom");
- ewl_radiobutton_value_set(EWL_RADIOBUTTON(o),
- (void *)EWL_POSITION_BOTTOM);
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(chain));
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
- ewl_container_child_append(EWL_CONTAINER(border), o);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Launch Dialog");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, run_dialog, chain);
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *o;
+ Ewl_Widget *border;
+ Ewl_Widget *chain;
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "");
+ ewl_container_child_append(box, o);
+ ewl_widget_name_set(o, "dialog_label");
+ ewl_widget_show(o);
+
+ border = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(border), "Button Position");
+ ewl_container_child_append(EWL_CONTAINER(box), border);
+ ewl_widget_show(border);
+
+ chain = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(chain), "Top");
+ ewl_radiobutton_value_set(EWL_RADIOBUTTON(chain),
+ (void *)EWL_POSITION_TOP);
+ ewl_container_child_append(EWL_CONTAINER(border), chain);
+ ewl_widget_show(chain);
+
+ o = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Right");
+ ewl_radiobutton_value_set(EWL_RADIOBUTTON(o),
+ (void *)EWL_POSITION_RIGHT);
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(chain));
+ ewl_container_child_append(EWL_CONTAINER(border), o);
+ ewl_widget_show(o);
+
+ o = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Left");
+ ewl_radiobutton_value_set(EWL_RADIOBUTTON(o),
+ (void *)EWL_POSITION_LEFT);
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(chain));
+ ewl_container_child_append(EWL_CONTAINER(border), o);
+ ewl_widget_show(o);
+
+ o = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Bottom");
+ ewl_radiobutton_value_set(EWL_RADIOBUTTON(o),
+ (void *)EWL_POSITION_BOTTOM);
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o), EWL_RADIOBUTTON(chain));
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(border), o);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Launch Dialog");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, run_dialog, chain);
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
run_dialog(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Widget *o, *dialog, *hbox;
- Ewl_Radiobutton *radio;
- Ewl_Window *win;
- Ewl_Position pos;
-
- radio = EWL_RADIOBUTTON(data);
- pos = (Ewl_Position)ewl_radiobutton_value_get(
- ewl_radiobutton_chain_selected_get(radio));
- /* this is a bad cast, but the ewl_test will ever be a standalone app */
- win = EWL_WINDOW(ewl_embed_widget_find(w));
-
- dialog = ewl_dialog_new();
- ewl_window_title_set(EWL_WINDOW(dialog), "Dialog Test");
- ewl_window_name_set(EWL_WINDOW(dialog), "EWL Test Application");
- ewl_window_class_set(EWL_WINDOW(dialog), "EFL Test Application");
- ewl_window_transient_for(EWL_WINDOW(dialog), win);
- ewl_callback_append(dialog, EWL_CALLBACK_DELETE_WINDOW,
- dialog_delete_cb, NULL);
- ewl_dialog_action_position_set(EWL_DIALOG(dialog), pos);
- ewl_widget_show(dialog);
- if (pos == EWL_POSITION_TOP)
- ewl_dialog_active_area_set(EWL_DIALOG(dialog),
- EWL_POSITION_BOTTOM);
- else if (pos == EWL_POSITION_BOTTOM)
- ewl_dialog_active_area_set(EWL_DIALOG(dialog),
- EWL_POSITION_TOP);
- else if (pos == EWL_POSITION_LEFT)
- ewl_dialog_active_area_set(EWL_DIALOG(dialog),
- EWL_POSITION_RIGHT);
- else if (pos == EWL_POSITION_RIGHT)
- ewl_dialog_active_area_set(EWL_DIALOG(dialog),
- EWL_POSITION_LEFT);
-
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(dialog), hbox);
- ewl_object_padding_set(EWL_OBJECT(hbox), 20, 20, 20, 20);
- ewl_widget_show(hbox);
-
- o = ewl_image_new();
- ewl_image_file_set(EWL_IMAGE(o),
- ewl_icon_theme_icon_path_get(EWL_ICON_DIALOG_INFORMATION, 46),
- EWL_ICON_DIALOG_INFORMATION);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_object_padding_set(EWL_OBJECT(o), 0, 20, 0, 0);
- ewl_widget_show(o);
-
- o = ewl_text_new();
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_text_text_set(EWL_TEXT(o), "This is a dialog window");
- ewl_widget_show(o);
-
- ewl_dialog_active_area_set(EWL_DIALOG(dialog), pos);
-
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
- ewl_container_child_append(EWL_CONTAINER(dialog), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- dialog_response_cb, dialog);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
- ewl_container_child_append(EWL_CONTAINER(dialog), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- dialog_response_cb, dialog);
- ewl_widget_show(o);
-
- ewl_dialog_active_area_set(EWL_DIALOG(dialog), EWL_POSITION_TOP);
- ewl_widget_show(dialog);
+ Ewl_Widget *o, *dialog, *hbox;
+ Ewl_Radiobutton *radio;
+ Ewl_Window *win;
+ Ewl_Position pos;
+
+ radio = EWL_RADIOBUTTON(data);
+ pos = (Ewl_Position)ewl_radiobutton_value_get(
+ ewl_radiobutton_chain_selected_get(radio));
+ /* this is a bad cast, but the ewl_test will ever be a standalone app */
+ win = EWL_WINDOW(ewl_embed_widget_find(w));
+
+ dialog = ewl_dialog_new();
+ ewl_window_title_set(EWL_WINDOW(dialog), "Dialog Test");
+ ewl_window_name_set(EWL_WINDOW(dialog), "EWL Test Application");
+ ewl_window_class_set(EWL_WINDOW(dialog), "EFL Test Application");
+ ewl_window_transient_for(EWL_WINDOW(dialog), win);
+ ewl_callback_append(dialog, EWL_CALLBACK_DELETE_WINDOW,
+ dialog_delete_cb, NULL);
+ ewl_dialog_action_position_set(EWL_DIALOG(dialog), pos);
+ ewl_widget_show(dialog);
+ if (pos == EWL_POSITION_TOP)
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog),
+ EWL_POSITION_BOTTOM);
+ else if (pos == EWL_POSITION_BOTTOM)
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog),
+ EWL_POSITION_TOP);
+ else if (pos == EWL_POSITION_LEFT)
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog),
+ EWL_POSITION_RIGHT);
+ else if (pos == EWL_POSITION_RIGHT)
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog),
+ EWL_POSITION_LEFT);
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(dialog), hbox);
+ ewl_object_padding_set(EWL_OBJECT(hbox), 20, 20, 20, 20);
+ ewl_widget_show(hbox);
+
+ o = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(o),
+ ewl_icon_theme_icon_path_get(EWL_ICON_DIALOG_INFORMATION, 46),
+ EWL_ICON_DIALOG_INFORMATION);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_object_padding_set(EWL_OBJECT(o), 0, 20, 0, 0);
+ ewl_widget_show(o);
+
+ o = ewl_text_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_text_text_set(EWL_TEXT(o), "This is a dialog window");
+ ewl_widget_show(o);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog), pos);
+
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
+ ewl_container_child_append(EWL_CONTAINER(dialog), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ dialog_response_cb, dialog);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
+ ewl_container_child_append(EWL_CONTAINER(dialog), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ dialog_response_cb, dialog);
+ ewl_widget_show(o);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog), EWL_POSITION_TOP);
+ ewl_widget_show(dialog);
}
static void
dialog_response_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Stock_Type response;
- Ewl_Widget *o;
-
- o = ewl_widget_name_find("dialog_label");
- response = ewl_stock_type_get(EWL_STOCK(w));
- if (response == EWL_STOCK_OK)
- ewl_label_text_set(EWL_LABEL(o), "OK button clicked.");
- else
- ewl_label_text_set(EWL_LABEL(o), "Cancel button clicked.");
-
- /* get rid of the dialog box */
- ewl_widget_destroy(EWL_WIDGET(data));
+ Ewl_Stock_Type response;
+ Ewl_Widget *o;
+
+ o = ewl_widget_name_find("dialog_label");
+ response = ewl_stock_type_get(EWL_STOCK(w));
+ if (response == EWL_STOCK_OK)
+ ewl_label_text_set(EWL_LABEL(o), "OK button clicked.");
+ else
+ ewl_label_text_set(EWL_LABEL(o), "Cancel button clicked.");
+
+ /* get rid of the dialog box */
+ ewl_widget_destroy(EWL_WIDGET(data));
}
static void
dialog_delete_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
}
diff --git a/src/bin/tests/dnd_snoop/ewl_dnd_snoop_test.c b/src/bin/tests/dnd_snoop/ewl_dnd_snoop_test.c
index 0ab2384..a05e6e7 100644
--- a/src/bin/tests/dnd_snoop/ewl_dnd_snoop_test.c
+++ b/src/bin/tests/dnd_snoop/ewl_dnd_snoop_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -54,433 +54,433 @@ static Ewl_Widget *text = NULL;
void
test_info(Ewl_Test *test)
{
- test->name = "DND Snoop";
- test->tip = "Watches for Xdnd events and prints information "
- "to the console.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "DND Snoop";
+ test->tip = "Watches for Xdnd events and prints information "
+ "to the console.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
- Ewl_Widget *scroll, *o;
+ const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
+ Ewl_Widget *scroll, *o;
- /* Register DND handlers */
+ /* Register DND handlers */
#ifdef ENABLE_EWL_SOFTWARE_X11
- ewl_dnd_enter_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_ENTER,
- ewl_dnd_snoop_cb_enter, NULL);
- ewl_dnd_position_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_POSITION,
- ewl_dnd_snoop_cb_position, NULL);
- ewl_dnd_status_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_STATUS,
- ewl_dnd_snoop_cb_status, NULL);
- ewl_dnd_leave_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_LEAVE,
- ewl_dnd_snoop_cb_leave, NULL);
- ewl_dnd_drop_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_DROP,
- ewl_dnd_snoop_cb_drop, NULL);
- ewl_dnd_finished_handler = ecore_event_handler_add(
- ECORE_X_EVENT_XDND_FINISHED,
- ewl_dnd_snoop_cb_finished, NULL);
- ewl_dnd_selection_clear_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_CLEAR,
- ewl_dnd_snoop_cb_selection_clear, NULL);
- ewl_dnd_selection_request_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_REQUEST,
- ewl_dnd_snoop_cb_selection_request, NULL);
- ewl_dnd_selection_notify_handler = ecore_event_handler_add(
- ECORE_X_EVENT_SELECTION_NOTIFY,
- ewl_dnd_snoop_cb_selection_notify, NULL);
- ewl_dnd_client_message_handler = ecore_event_handler_add(
- ECORE_X_EVENT_CLIENT_MESSAGE,
- ewl_dnd_snoop_cb_client_message, NULL);
+ ewl_dnd_enter_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_ENTER,
+ ewl_dnd_snoop_cb_enter, NULL);
+ ewl_dnd_position_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_POSITION,
+ ewl_dnd_snoop_cb_position, NULL);
+ ewl_dnd_status_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_STATUS,
+ ewl_dnd_snoop_cb_status, NULL);
+ ewl_dnd_leave_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_LEAVE,
+ ewl_dnd_snoop_cb_leave, NULL);
+ ewl_dnd_drop_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_DROP,
+ ewl_dnd_snoop_cb_drop, NULL);
+ ewl_dnd_finished_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_XDND_FINISHED,
+ ewl_dnd_snoop_cb_finished, NULL);
+ ewl_dnd_selection_clear_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_CLEAR,
+ ewl_dnd_snoop_cb_selection_clear, NULL);
+ ewl_dnd_selection_request_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_REQUEST,
+ ewl_dnd_snoop_cb_selection_request, NULL);
+ ewl_dnd_selection_notify_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_SELECTION_NOTIFY,
+ ewl_dnd_snoop_cb_selection_notify, NULL);
+ ewl_dnd_client_message_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_CLIENT_MESSAGE,
+ ewl_dnd_snoop_cb_client_message, NULL);
#endif
- o = ewl_entry_new();
- ewl_dnd_accepted_types_set(o, text_types);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_callback_append(o, EWL_CALLBACK_DND_POSITION, ewl_dnd_snoop_cb_dnd_position, NULL);
- ewl_callback_append(o, EWL_CALLBACK_DND_DROP, ewl_dnd_snoop_cb_dnd_drop, NULL);
- ewl_callback_append(o, EWL_CALLBACK_DND_DATA_RECEIVED, ewl_dnd_snoop_cb_dnd_data, NULL);
- ewl_widget_name_set(o, "entry");
- ewl_entry_multiline_set(EWL_ENTRY(o), TRUE);
- ewl_text_wrap_set(EWL_TEXT(o), TRUE);
- ewl_text_font_size_set(EWL_TEXT(o), 12);
- ewl_text_text_set(EWL_TEXT(o), "Drop Here");
-
- ewl_text_underline_color_set(EWL_TEXT(o), 0, 0, 0, 255);
- ewl_text_double_underline_color_set(EWL_TEXT(o), 50, 50, 50, 255);
- ewl_text_shadow_color_set(EWL_TEXT(o), 128, 128, 128, 128);
- ewl_text_outline_color_set(EWL_TEXT(o), 200, 200, 200, 200);
- ewl_text_strikethrough_color_set(EWL_TEXT(o), 0, 0, 0, 255);
- ewl_text_glow_color_set(EWL_TEXT(o), 0, 255, 0, 128);
-
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(o);
-
- scroll = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(box), scroll);
- ewl_widget_show(scroll);
-
- text = ewl_text_new();
- ewl_container_child_append(EWL_CONTAINER(scroll), text);
- ewl_widget_show(text);
-
- o = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- box = EWL_CONTAINER(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Clear");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_dnd_snoop_cb_clear, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Drag This");
- ewl_callback_append(o, EWL_CALLBACK_DND_DATA_REQUEST, ewl_dnd_snoop_cb_dnd_data_request, NULL);
- ewl_dnd_provided_types_set(o, text_types);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- return 1;
+ o = ewl_entry_new();
+ ewl_dnd_accepted_types_set(o, text_types);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_callback_append(o, EWL_CALLBACK_DND_POSITION, ewl_dnd_snoop_cb_dnd_position, NULL);
+ ewl_callback_append(o, EWL_CALLBACK_DND_DROP, ewl_dnd_snoop_cb_dnd_drop, NULL);
+ ewl_callback_append(o, EWL_CALLBACK_DND_DATA_RECEIVED, ewl_dnd_snoop_cb_dnd_data, NULL);
+ ewl_widget_name_set(o, "entry");
+ ewl_entry_multiline_set(EWL_ENTRY(o), TRUE);
+ ewl_text_wrap_set(EWL_TEXT(o), TRUE);
+ ewl_text_font_size_set(EWL_TEXT(o), 12);
+ ewl_text_text_set(EWL_TEXT(o), "Drop Here");
+
+ ewl_text_underline_color_set(EWL_TEXT(o), 0, 0, 0, 255);
+ ewl_text_double_underline_color_set(EWL_TEXT(o), 50, 50, 50, 255);
+ ewl_text_shadow_color_set(EWL_TEXT(o), 128, 128, 128, 128);
+ ewl_text_outline_color_set(EWL_TEXT(o), 200, 200, 200, 200);
+ ewl_text_strikethrough_color_set(EWL_TEXT(o), 0, 0, 0, 255);
+ ewl_text_glow_color_set(EWL_TEXT(o), 0, 255, 0, 128);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(o);
+
+ scroll = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(box), scroll);
+ ewl_widget_show(scroll);
+
+ text = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(scroll), text);
+ ewl_widget_show(text);
+
+ o = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ box = EWL_CONTAINER(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Clear");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_dnd_snoop_cb_clear, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Drag This");
+ ewl_callback_append(o, EWL_CALLBACK_DND_DATA_REQUEST, ewl_dnd_snoop_cb_dnd_data_request, NULL);
+ ewl_dnd_provided_types_set(o, text_types);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
ewl_dnd_snoop_output(char *buf)
{
- printf(buf);
- ewl_text_text_append(EWL_TEXT(text), buf);
+ printf(buf);
+ ewl_text_text_append(EWL_TEXT(text), buf);
}
static void
ewl_dnd_snoop_cb_dnd_position(Ewl_Widget *w, void *event,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- char buf[PATH_MAX];
- Ewl_Event_Mouse *ev = event;
- snprintf(buf, PATH_MAX, "Position event on widget %p: %d %d\n", w, ev->x, ev->y);
- ewl_dnd_snoop_output(buf);
+ char buf[PATH_MAX];
+ Ewl_Event_Mouse *ev = event;
+ snprintf(buf, PATH_MAX, "Position event on widget %p: %d %d\n", w, ev->x, ev->y);
+ ewl_dnd_snoop_output(buf);
}
static void
ewl_dnd_snoop_cb_dnd_drop(Ewl_Widget *w, void *event,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- char buf[PATH_MAX];
- Ewl_Event_Dnd_Drop *ev = event;
- snprintf(buf, PATH_MAX, "Drop event on widget %p: %d %d %p\n", w, ev->x, ev->y, ev->data);
- ewl_dnd_snoop_output(buf);
+ char buf[PATH_MAX];
+ Ewl_Event_Dnd_Drop *ev = event;
+ snprintf(buf, PATH_MAX, "Drop event on widget %p: %d %d %p\n", w, ev->x, ev->y, ev->data);
+ ewl_dnd_snoop_output(buf);
}
static void
ewl_dnd_snoop_cb_dnd_data(Ewl_Widget *w, void *event,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- char buf[PATH_MAX];
- Ewl_Event_Dnd_Data_Received *ev = event;
- snprintf(buf, PATH_MAX, "Data event on widget %p: %p length %d\n", w, ev->data, ev->len);
- ewl_dnd_snoop_output(buf);
+ char buf[PATH_MAX];
+ Ewl_Event_Dnd_Data_Received *ev = event;
+ snprintf(buf, PATH_MAX, "Data event on widget %p: %p length %d\n", w, ev->data, ev->len);
+ ewl_dnd_snoop_output(buf);
}
static void
ewl_dnd_snoop_cb_dnd_data_request(Ewl_Widget *w, void *event,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- char buf[PATH_MAX];
- Ewl_Embed *emb;
- Ewl_Event_Dnd_Data_Request *ev = event;
-
- snprintf(buf, PATH_MAX, "Data request on widget %p: type %s\n", w, ev->type);
- ewl_dnd_snoop_output(buf);
-
- snprintf(buf, PATH_MAX, "\tSending response: %s\n", w->inheritance);
- ewl_dnd_snoop_output(buf);
- emb = ewl_embed_widget_find(w);
- if (emb)
- ewl_engine_embed_dnd_drag_data_send(emb, ev->handle,
- (void *)w->inheritance,
- strlen(w->inheritance) + 1);
+ char buf[PATH_MAX];
+ Ewl_Embed *emb;
+ Ewl_Event_Dnd_Data_Request *ev = event;
+
+ snprintf(buf, PATH_MAX, "Data request on widget %p: type %s\n", w, ev->type);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, PATH_MAX, "\tSending response: %s\n", w->inheritance);
+ ewl_dnd_snoop_output(buf);
+ emb = ewl_embed_widget_find(w);
+ if (emb)
+ ewl_engine_embed_dnd_drag_data_send(emb, ev->handle,
+ (void *)w->inheritance,
+ strlen(w->inheritance) + 1);
}
#ifdef ENABLE_EWL_SOFTWARE_X11
static int
ewl_dnd_snoop_cb_enter(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
- int i;
- char buf[1024];
- Ecore_X_Event_Xdnd_Enter *event = ev;
-
- snprintf(buf, sizeof(buf), "\nXdnd Enter\n");
- ewl_dnd_snoop_output(buf);
-
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
- event->win, event->source);
- ewl_dnd_snoop_output(buf);
-
- for (i = 0; i < event->num_types; i++) {
- snprintf(buf, sizeof(buf), "\tType: %s\n", event->types[i]);
- ewl_dnd_snoop_output(buf);
- }
- return 1;
+ int i;
+ char buf[1024];
+ Ecore_X_Event_Xdnd_Enter *event = ev;
+
+ snprintf(buf, sizeof(buf), "\nXdnd Enter\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
+ event->win, event->source);
+ ewl_dnd_snoop_output(buf);
+
+ for (i = 0; i < event->num_types; i++) {
+ snprintf(buf, sizeof(buf), "\tType: %s\n", event->types[i]);
+ ewl_dnd_snoop_output(buf);
+ }
+ return 1;
}
static int
ewl_dnd_snoop_cb_position(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
- char buf[1024];
- Ecore_X_Event_Xdnd_Position *event = ev;
- char *name;
+ char buf[1024];
+ Ecore_X_Event_Xdnd_Position *event = ev;
+ char *name;
- snprintf(buf, sizeof(buf), "\nXdnd Position\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nXdnd Position\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n", event->win,
- event->source);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n", event->win,
+ event->source);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tPosition: %d,%d\n", event->position.x,
- event->position.y);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tPosition: %d,%d\n", event->position.x,
+ event->position.y);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->action);
- snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->action);
+ snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_status(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
- char buf[1024];
- Ecore_X_Event_Xdnd_Status *event = ev;
- char *name;
+ char buf[1024];
+ Ecore_X_Event_Xdnd_Status *event = ev;
+ char *name;
- snprintf(buf, sizeof(buf), "\nXdnd Status\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nXdnd Status\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tTarget: %d\n",
- event->win, event->target);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tTarget: %d\n",
+ event->win, event->target);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tAccepts: %d\n", event->will_accept);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tAccepts: %d\n", event->will_accept);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tRegion: %d,%d %dx%d\n",
- event->rectangle.x,
- event->rectangle.y,
- event->rectangle.width,
- event->rectangle.height);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tRegion: %d,%d %dx%d\n",
+ event->rectangle.x,
+ event->rectangle.y,
+ event->rectangle.width,
+ event->rectangle.height);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->action);
- snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->action);
+ snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_leave(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
- char buf[1024];
- Ecore_X_Event_Xdnd_Leave *event = ev;
+ char buf[1024];
+ Ecore_X_Event_Xdnd_Leave *event = ev;
- snprintf(buf, sizeof(buf), "\nXdnd Leave\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nXdnd Leave\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
- event->win, event->source);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
+ event->win, event->source);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_drop(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
- char buf[1024];
- Ecore_X_Event_Xdnd_Drop *event = ev;
- char *name;
+ char buf[1024];
+ Ecore_X_Event_Xdnd_Drop *event = ev;
+ char *name;
- snprintf(buf, sizeof(buf), "\nXdnd Drop\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nXdnd Drop\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
- event->win, event->source);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
+ event->win, event->source);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->action);
- snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->action);
+ snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tPosition: %d,%d\n",
- event->position.x, event->position.y);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tPosition: %d,%d\n",
+ event->position.x, event->position.y);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_finished(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
- char buf[1024];
- Ecore_X_Event_Xdnd_Finished *event = ev;
- char *name;
+ char buf[1024];
+ Ecore_X_Event_Xdnd_Finished *event = ev;
+ char *name;
- snprintf(buf, sizeof(buf), "\nXdnd Finished\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nXdnd Finished\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tTarget: %d\n",
- event->win, event->target);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tTarget: %d\n",
+ event->win, event->target);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tCompleted: %d\n", event->completed);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tCompleted: %d\n", event->completed);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->action);
- snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->action);
+ snprintf(buf, sizeof(buf), "\tAction: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_selection_clear(void *data __UNUSED__, int type __UNUSED__,
- void *ev)
+ void *ev)
{
- char buf[1024];
- Ecore_X_Event_Selection_Clear *event = ev;
+ char buf[1024];
+ Ecore_X_Event_Selection_Clear *event = ev;
- snprintf(buf, sizeof(buf), "\nSelection Clear\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nSelection Clear\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSelection%d\n",
- event->win, event->selection);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSelection%d\n",
+ event->win, event->selection);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_selection_request(void *data __UNUSED__, int type __UNUSED__,
- void *ev)
+ void *ev)
{
- char buf[1024];
- Ecore_X_Event_Selection_Request *event = ev;
- char *name;
+ char buf[1024];
+ Ecore_X_Event_Selection_Request *event = ev;
+ char *name;
- snprintf(buf, sizeof(buf), "\nSelection Request\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nSelection Request\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tOwner: %d\n", event->owner);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tOwner: %d\n", event->owner);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tRequestor: %d\n", event->requestor);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tRequestor: %d\n", event->requestor);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->selection);
- snprintf(buf, sizeof(buf), "\tSelection: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->selection);
+ snprintf(buf, sizeof(buf), "\tSelection: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->target);
- snprintf(buf, sizeof(buf), "\tTarget: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->target);
+ snprintf(buf, sizeof(buf), "\tTarget: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->property);
- snprintf(buf, sizeof(buf), "\tProperty: %s\n", name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->property);
+ snprintf(buf, sizeof(buf), "\tProperty: %s\n", name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_selection_notify(void *data __UNUSED__, int type __UNUSED__,
- void *ev)
+ void *ev)
{
- char buf[1024];
- Ecore_X_Event_Selection_Notify *event = ev;
+ char buf[1024];
+ Ecore_X_Event_Selection_Notify *event = ev;
- snprintf(buf, sizeof(buf), "\nSelection Notify\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nSelection Notify\n");
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSelection%d\n",
- event->win, event->selection);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSelection%d\n",
+ event->win, event->selection);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tTarget: %s\n", event->target);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tTarget: %s\n", event->target);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tData: %p\n", event->data);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tData: %p\n", event->data);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
static int
ewl_dnd_snoop_cb_client_message(void *data __UNUSED__, int type __UNUSED__,
- void *ev)
+ void *ev)
{
- char buf[1024];
- Ecore_X_Event_Client_Message *event = ev;
- char *name;
+ char buf[1024];
+ Ecore_X_Event_Client_Message *event = ev;
+ char *name;
- snprintf(buf, sizeof(buf), "\nClient Message\n");
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\nClient Message\n");
+ ewl_dnd_snoop_output(buf);
- name = XGetAtomName(ecore_x_display_get(), event->message_type);
- snprintf(buf, sizeof(buf), "\tWindow: %d\n\tType: %s\n",
- event->win,
- name);
- XFree(name);
- ewl_dnd_snoop_output(buf);
+ name = XGetAtomName(ecore_x_display_get(), event->message_type);
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tType: %s\n",
+ event->win,
+ name);
+ XFree(name);
+ ewl_dnd_snoop_output(buf);
- snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
- ewl_dnd_snoop_output(buf);
+ snprintf(buf, sizeof(buf), "\tTime: %d\n", event->time);
+ ewl_dnd_snoop_output(buf);
- return 1;
+ return 1;
}
#endif
static void
ewl_dnd_snoop_cb_clear(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_text_clear(EWL_TEXT(text));
+ ewl_text_clear(EWL_TEXT(text));
}
diff --git a/src/bin/tests/engine/ewl_engine_test.c b/src/bin/tests/engine/ewl_engine_test.c
index 498548e..a66a4d5 100644
--- a/src/bin/tests/engine/ewl_engine_test.c
+++ b/src/bin/tests/engine/ewl_engine_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -21,220 +21,220 @@ static int engine_test_set_get(char *buf, int len);
#define WIN_NAME "buffer_engine_window"
static Ewl_Unit_Test engine_unit_tests[] = {
- {"engine set/get", engine_test_set_get, NULL, -1, 1},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"engine set/get", engine_test_set_get, NULL, -1, 1},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Engine";
- test->tip = "Overrides the engine on a window.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
- test->unit_tests = engine_unit_tests;
+ test->name = "Engine";
+ test->tip = "Overrides the engine on a window.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
+ test->unit_tests = engine_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *pointer_win;
- Ewl_Widget *img;
- Ewl_Widget *o;
-
- o = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(o), "The image below is copied from an\n"
- "evas buffer engine, and reacts because of events\n"
- "fed to it from the image widget.");
- ewl_entry_editable_set(EWL_ENTRY(o), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- img = ewl_image_new();
- ewl_container_child_append(EWL_CONTAINER(box), img);
- ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL);
- ewl_callback_append(img, EWL_CALLBACK_MOUSE_DOWN, cb_mouse_down, NULL);
- ewl_callback_append(img, EWL_CALLBACK_MOUSE_UP, cb_mouse_up, NULL);
- ewl_callback_append(img, EWL_CALLBACK_MOUSE_MOVE, cb_mouse_move, NULL);
- ewl_widget_show(img);
-
- pointer_win = ewl_window_new();
- ewl_widget_name_set(pointer_win, WIN_NAME);
- ewl_object_fill_policy_set(EWL_OBJECT(pointer_win), EWL_FLAG_FILL_ALL);
- ewl_object_size_request(EWL_OBJECT(pointer_win), 64, 64);
- ewl_embed_engine_name_set(EWL_EMBED(pointer_win), "evas_buffer");
- ewl_callback_append(pointer_win, EWL_CALLBACK_CONFIGURE, cb_configure,
- img);
- ewl_callback_append(pointer_win, EWL_CALLBACK_VALUE_CHANGED,
- cb_configure, img);
- ewl_widget_show(pointer_win);
-
- o = ewl_button_new();
- ewl_container_child_append(EWL_CONTAINER(pointer_win), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *pointer_win;
+ Ewl_Widget *img;
+ Ewl_Widget *o;
+
+ o = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(o), "The image below is copied from an\n"
+ "evas buffer engine, and reacts because of events\n"
+ "fed to it from the image widget.");
+ ewl_entry_editable_set(EWL_ENTRY(o), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ img = ewl_image_new();
+ ewl_container_child_append(EWL_CONTAINER(box), img);
+ ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL);
+ ewl_callback_append(img, EWL_CALLBACK_MOUSE_DOWN, cb_mouse_down, NULL);
+ ewl_callback_append(img, EWL_CALLBACK_MOUSE_UP, cb_mouse_up, NULL);
+ ewl_callback_append(img, EWL_CALLBACK_MOUSE_MOVE, cb_mouse_move, NULL);
+ ewl_widget_show(img);
+
+ pointer_win = ewl_window_new();
+ ewl_widget_name_set(pointer_win, WIN_NAME);
+ ewl_object_fill_policy_set(EWL_OBJECT(pointer_win), EWL_FLAG_FILL_ALL);
+ ewl_object_size_request(EWL_OBJECT(pointer_win), 64, 64);
+ ewl_embed_engine_name_set(EWL_EMBED(pointer_win), "evas_buffer");
+ ewl_callback_append(pointer_win, EWL_CALLBACK_CONFIGURE, cb_configure,
+ img);
+ ewl_callback_append(pointer_win, EWL_CALLBACK_VALUE_CHANGED,
+ cb_configure, img);
+ ewl_widget_show(pointer_win);
+
+ o = ewl_button_new();
+ ewl_container_child_append(EWL_CONTAINER(pointer_win), o);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
cb_configure(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Evas_Object *eimg;
- int width, height;
- Ewl_Embed *emb = EWL_EMBED(w);
- Ewl_Image *img = EWL_IMAGE(data);
-
- eimg = img->image;
- width = ewl_object_current_w_get(EWL_OBJECT(emb));
- height = ewl_object_current_h_get(EWL_OBJECT(emb));
- evas_object_image_size_set(eimg, width, height);
- evas_object_image_data_set(eimg, emb->canvas_window);
- evas_object_image_data_update_add(eimg, 0, 0, width, height);
- ewl_object_preferred_inner_size_set(EWL_OBJECT(img), width, height);
+ Evas_Object *eimg;
+ int width, height;
+ Ewl_Embed *emb = EWL_EMBED(w);
+ Ewl_Image *img = EWL_IMAGE(data);
+
+ eimg = img->image;
+ width = ewl_object_current_w_get(EWL_OBJECT(emb));
+ height = ewl_object_current_h_get(EWL_OBJECT(emb));
+ evas_object_image_size_set(eimg, width, height);
+ evas_object_image_data_set(eimg, emb->canvas_window);
+ evas_object_image_data_update_add(eimg, 0, 0, width, height);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(img), width, height);
}
static void
cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- int x, y;
- Ewl_Widget *pointer_win;
- Ewl_Event_Mouse_Down *event = ev;
+ int x, y;
+ Ewl_Widget *pointer_win;
+ Ewl_Event_Mouse_Down *event = ev;
- pointer_win = ewl_widget_name_find(WIN_NAME);
+ pointer_win = ewl_widget_name_find(WIN_NAME);
- x = (int)((double)(event->base.x - CURRENT_X(w)) *
- ((double)CURRENT_W(pointer_win) / (double)CURRENT_W(w)));
- y = (int)((double)(event->base.y - CURRENT_Y(w)) *
- ((double)CURRENT_H(pointer_win) / (double)CURRENT_H(w)));
+ x = (int)((double)(event->base.x - CURRENT_X(w)) *
+ ((double)CURRENT_W(pointer_win) / (double)CURRENT_W(w)));
+ y = (int)((double)(event->base.y - CURRENT_Y(w)) *
+ ((double)CURRENT_H(pointer_win) / (double)CURRENT_H(w)));
- ewl_embed_mouse_down_feed(EWL_EMBED(pointer_win), event->button,
- event->clicks, x, y, event->base.modifiers);
+ ewl_embed_mouse_down_feed(EWL_EMBED(pointer_win), event->button,
+ event->clicks, x, y, event->base.modifiers);
}
static void
cb_mouse_up(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- int x, y;
- Ewl_Widget *pointer_win;
- Ewl_Event_Mouse_Up *event = ev;
+ int x, y;
+ Ewl_Widget *pointer_win;
+ Ewl_Event_Mouse_Up *event = ev;
- pointer_win = ewl_widget_name_find(WIN_NAME);
+ pointer_win = ewl_widget_name_find(WIN_NAME);
- x = (int)((double)(event->base.x - CURRENT_X(w)) *
- ((double)CURRENT_W(pointer_win) / (double)CURRENT_W(w)));
- y = (int)((double)(event->base.y - CURRENT_Y(w)) *
- ((double)CURRENT_H(pointer_win) / (double)CURRENT_H(w)));
+ x = (int)((double)(event->base.x - CURRENT_X(w)) *
+ ((double)CURRENT_W(pointer_win) / (double)CURRENT_W(w)));
+ y = (int)((double)(event->base.y - CURRENT_Y(w)) *
+ ((double)CURRENT_H(pointer_win) / (double)CURRENT_H(w)));
- ewl_embed_mouse_up_feed(EWL_EMBED(pointer_win), event->button, x, y,
- event->base.modifiers);
+ ewl_embed_mouse_up_feed(EWL_EMBED(pointer_win), event->button, x, y,
+ event->base.modifiers);
}
static void
cb_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- int x, y;
- Ewl_Widget *pointer_win;
- Ewl_Event_Mouse *event = ev;
+ int x, y;
+ Ewl_Widget *pointer_win;
+ Ewl_Event_Mouse *event = ev;
- pointer_win = ewl_widget_name_find(WIN_NAME);
+ pointer_win = ewl_widget_name_find(WIN_NAME);
- x = (int)((double)(event->x - CURRENT_X(w)) *
- ((double)CURRENT_W(pointer_win) / (double)CURRENT_W(w)));
- y = (int)((double)(event->y - CURRENT_Y(w)) *
- ((double)CURRENT_H(pointer_win) / (double)CURRENT_H(w)));
+ x = (int)((double)(event->x - CURRENT_X(w)) *
+ ((double)CURRENT_W(pointer_win) / (double)CURRENT_W(w)));
+ y = (int)((double)(event->y - CURRENT_Y(w)) *
+ ((double)CURRENT_H(pointer_win) / (double)CURRENT_H(w)));
- ewl_embed_mouse_move_feed(EWL_EMBED(pointer_win), x, y, event->modifiers);
+ ewl_embed_mouse_move_feed(EWL_EMBED(pointer_win), x, y, event->modifiers);
}
/*
static void *window_funcs[EWL_ENGINE_WINDOW_MAX] =
- {
- engine_window_new,
- engine_window_destroy,
- engine_window_move,
- engine_window_resize,
- engine_window_min_max_size_set,
- engine_window_show,
- engine_window_hide,
- engine_window_title_set,
- engine_window_name_class_set,
- engine_window_borderless_set,
- engine_window_dialog_set,
- engine_window_states_set,
- engine_window_hints_set,
- engine_window_transient_for,
- engine_window_leader_set,
- engine_window_raise,
- engine_window_lower,
- engine_keyboard_grab,
- engine_keyboard_ungrab,
- engine_pointer_grab,
- engine_pointer_ungrab,
- engine_window_selection_text_set,
- engine_window_geometry_set,
- engine_dnd_aware_set,
- engine_desktop_size_get,
- engine_dnd_drag_types_set,
- engine_dnd_drag_begin,
- engine_dnd_drag_drop,
- engine_dnd_drag_data_send,
- };
+ {
+ engine_window_new,
+ engine_window_destroy,
+ engine_window_move,
+ engine_window_resize,
+ engine_window_min_max_size_set,
+ engine_window_show,
+ engine_window_hide,
+ engine_window_title_set,
+ engine_window_name_class_set,
+ engine_window_borderless_set,
+ engine_window_dialog_set,
+ engine_window_states_set,
+ engine_window_hints_set,
+ engine_window_transient_for,
+ engine_window_leader_set,
+ engine_window_raise,
+ engine_window_lower,
+ engine_keyboard_grab,
+ engine_keyboard_ungrab,
+ engine_pointer_grab,
+ engine_pointer_ungrab,
+ engine_window_selection_text_set,
+ engine_window_geometry_set,
+ engine_dnd_aware_set,
+ engine_desktop_size_get,
+ engine_dnd_drag_types_set,
+ engine_dnd_drag_begin,
+ engine_dnd_drag_drop,
+ engine_dnd_drag_data_send,
+ };
static void *pointer_funcs[EWL_ENGINE_POINTER_MAX] =
- {
- engine_pointer_data_new,
- engine_pointer_free,
- engine_pointer_get,
- engine_pointer_set,
- };
- */
+ {
+ engine_pointer_data_new,
+ engine_pointer_free,
+ engine_pointer_get,
+ engine_pointer_set,
+ };
+ */
static Ewl_Widget *
create_unit_test_window(void)
{
- Ewl_Widget *window;
+ Ewl_Widget *window;
- window = ewl_window_new();
- ewl_embed_engine_name_set(EWL_EMBED(window), "ewl_engine");
- ewl_widget_show(window);
+ window = ewl_window_new();
+ ewl_embed_engine_name_set(EWL_EMBED(window), "ewl_engine");
+ ewl_widget_show(window);
- return window;
+ return window;
}
static int
engine_test_set_get(char *buf, int len)
{
- int ret = 0;
- const char *engine_name;
- Ewl_Widget *window;
+ int ret = 0;
+ const char *engine_name;
+ Ewl_Widget *window;
- ecore_path_group_add(ewl_engines_path, PACKAGE_LIB_DIR "/ewl/tests");
+ ecore_path_group_add(ewl_engines_path, PACKAGE_LIB_DIR "/ewl/tests");
- window = create_unit_test_window();
- engine_name = ewl_embed_engine_name_get(EWL_EMBED(window));
+ window = create_unit_test_window();
+ engine_name = ewl_embed_engine_name_get(EWL_EMBED(window));
- if (strcmp(engine_name, "ewl_engine"))
- LOG_FAILURE(buf, len, "engine name doesn't match");
- else
- ret = 1;
+ if (strcmp(engine_name, "ewl_engine"))
+ LOG_FAILURE(buf, len, "engine name doesn't match");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
/*
static int
engine_init(Ewl_Engine *engine, int *argc, char **argv)
{
- info = NEW(Ewl_Engine_Info, 1);
- info->shutdown = engine_shutdown;
- info->hooks.window = window_funcs;
- info->hooks.pointer = pointer_funcs;
+ info = NEW(Ewl_Engine_Info, 1);
+ info->shutdown = engine_shutdown;
+ info->hooks.window = window_funcs;
+ info->hooks.pointer = pointer_funcs;
- engine->functions = info;
+ engine->functions = info;
- return TRUE;
+ return TRUE;
}
static void
diff --git a/src/bin/tests/entry/ewl_entry_test.c b/src/bin/tests/entry/ewl_entry_test.c
index 5c27314..2a527fd 100644
--- a/src/bin/tests/entry/ewl_entry_test.c
+++ b/src/bin/tests/entry/ewl_entry_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -15,120 +15,120 @@ static int create_test(Ewl_Container *box);
void
test_info(Ewl_Test *test)
{
- test->name = "Entry";
- test->tip = "Defines the Ewl_Entry class to allow\n"
- "for single line editable text.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Entry";
+ test->tip = "Defines the Ewl_Entry class to allow\n"
+ "for single line editable text.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static void
fetch_entry_text(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- char *s;
-
- s = ewl_text_text_get(EWL_TEXT(entry[0]));
- if (s) {
- printf("First entry covers: %s\n", s);
- free(s);
- }
-
- s = ewl_text_text_get(EWL_TEXT(entry[1]));
- if (s) {
- printf("Second entry covers: %s\n", s);
- free(s);
- }
-
- s = ewl_text_text_get(EWL_TEXT(entry[2]));
- if (s) {
- printf("Third entry covers: %s\n", s);
- free(s);
- }
+ char *s;
+
+ s = ewl_text_text_get(EWL_TEXT(entry[0]));
+ if (s) {
+ printf("First entry covers: %s\n", s);
+ free(s);
+ }
+
+ s = ewl_text_text_get(EWL_TEXT(entry[1]));
+ if (s) {
+ printf("Second entry covers: %s\n", s);
+ free(s);
+ }
+
+ s = ewl_text_text_get(EWL_TEXT(entry[2]));
+ if (s) {
+ printf("Third entry covers: %s\n", s);
+ free(s);
+ }
}
static void
set_entry_text(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- ewl_text_text_set(EWL_TEXT(entry[0]), "Play with me ?");
- ewl_text_clear(EWL_TEXT(entry[1]));
- ewl_text_text_set(EWL_TEXT(entry[2]), "Not more than 30 characters");
+ ewl_text_text_set(EWL_TEXT(entry[0]), "Play with me ?");
+ ewl_text_clear(EWL_TEXT(entry[1]));
+ ewl_text_text_set(EWL_TEXT(entry[2]), "Not more than 30 characters");
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *entry_box;
- Ewl_Widget *button_hbox, *o;
- Ewl_Widget *button[2];
-
- /*
- * Create the main box for holding the widgets
- */
- entry_box = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), entry_box);
- ewl_box_spacing_set(EWL_BOX(entry_box), 10);
- ewl_widget_show(entry_box);
-
- entry[0] = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry[0]), "Play with me ?");
- ewl_entry_multiline_set(EWL_ENTRY(entry[0]), 1);
- ewl_object_padding_set(EWL_OBJECT(entry[0]), 5, 5, 5, 0);
- ewl_container_child_append(EWL_CONTAINER(entry_box), entry[0]);
- ewl_widget_show(entry[0]);
-
- entry[1] = ewl_entry_new();
- ewl_object_padding_set(EWL_OBJECT(entry[1]), 5, 5, 0, 0);
- ewl_container_child_append(EWL_CONTAINER(entry_box), entry[1]);
- ewl_widget_show(entry[1]);
-
- entry[2] = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry[2]), "Not more than 30 characters");
- ewl_text_length_maximum_set(EWL_TEXT(entry[2]), 30);
- ewl_object_padding_set(EWL_OBJECT(entry[2]), 5, 5, 0, 0);
- ewl_container_child_append(EWL_CONTAINER(entry_box), entry[2]);
- ewl_widget_show(entry[2]);
-
- o = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(o), "disabled");
- ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 0, 0);
- ewl_container_child_append(EWL_CONTAINER(entry_box), o);
- ewl_widget_disable(o);
- ewl_widget_show(o);
-
- button_hbox = ewl_hbox_new();
- ewl_object_alignment_set(EWL_OBJECT(button_hbox), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(entry_box), button_hbox);
- ewl_box_spacing_set(EWL_BOX(button_hbox), 5);
- ewl_widget_show(button_hbox);
-
- button[0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[0]), "Fetch text");
- ewl_container_child_append(EWL_CONTAINER(button_hbox), button[0]);
- ewl_callback_append(button[0], EWL_CALLBACK_CLICKED,
- fetch_entry_text, NULL);
- ewl_widget_show(button[0]);
-
- button[1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[1]), "Set Text");
- ewl_container_child_append(EWL_CONTAINER(button_hbox), button[1]);
- ewl_callback_append(button[1], EWL_CALLBACK_CLICKED,
- set_entry_text, NULL);
- ewl_widget_show(button[1]);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Text insert \"\"");
- ewl_container_child_append(EWL_CONTAINER(button_hbox), o);
- ewl_widget_show(o);
-
- o = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(o), "");
- ewl_container_child_append(EWL_CONTAINER(button_hbox), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *entry_box;
+ Ewl_Widget *button_hbox, *o;
+ Ewl_Widget *button[2];
+
+ /*
+ * Create the main box for holding the widgets
+ */
+ entry_box = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), entry_box);
+ ewl_box_spacing_set(EWL_BOX(entry_box), 10);
+ ewl_widget_show(entry_box);
+
+ entry[0] = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry[0]), "Play with me ?");
+ ewl_entry_multiline_set(EWL_ENTRY(entry[0]), 1);
+ ewl_object_padding_set(EWL_OBJECT(entry[0]), 5, 5, 5, 0);
+ ewl_container_child_append(EWL_CONTAINER(entry_box), entry[0]);
+ ewl_widget_show(entry[0]);
+
+ entry[1] = ewl_entry_new();
+ ewl_object_padding_set(EWL_OBJECT(entry[1]), 5, 5, 0, 0);
+ ewl_container_child_append(EWL_CONTAINER(entry_box), entry[1]);
+ ewl_widget_show(entry[1]);
+
+ entry[2] = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry[2]), "Not more than 30 characters");
+ ewl_text_length_maximum_set(EWL_TEXT(entry[2]), 30);
+ ewl_object_padding_set(EWL_OBJECT(entry[2]), 5, 5, 0, 0);
+ ewl_container_child_append(EWL_CONTAINER(entry_box), entry[2]);
+ ewl_widget_show(entry[2]);
+
+ o = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(o), "disabled");
+ ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 0, 0);
+ ewl_container_child_append(EWL_CONTAINER(entry_box), o);
+ ewl_widget_disable(o);
+ ewl_widget_show(o);
+
+ button_hbox = ewl_hbox_new();
+ ewl_object_alignment_set(EWL_OBJECT(button_hbox), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(entry_box), button_hbox);
+ ewl_box_spacing_set(EWL_BOX(button_hbox), 5);
+ ewl_widget_show(button_hbox);
+
+ button[0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[0]), "Fetch text");
+ ewl_container_child_append(EWL_CONTAINER(button_hbox), button[0]);
+ ewl_callback_append(button[0], EWL_CALLBACK_CLICKED,
+ fetch_entry_text, NULL);
+ ewl_widget_show(button[0]);
+
+ button[1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[1]), "Set Text");
+ ewl_container_child_append(EWL_CONTAINER(button_hbox), button[1]);
+ ewl_callback_append(button[1], EWL_CALLBACK_CLICKED,
+ set_entry_text, NULL);
+ ewl_widget_show(button[1]);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Text insert \"\"");
+ ewl_container_child_append(EWL_CONTAINER(button_hbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(o), "");
+ ewl_container_child_append(EWL_CONTAINER(button_hbox), o);
+ ewl_widget_show(o);
+
+ return 1;
}
diff --git a/src/bin/tests/filedialog/ewl_filedialog_test.c b/src/bin/tests/filedialog/ewl_filedialog_test.c
index 2c9d93d..c8c760f 100644
--- a/src/bin/tests/filedialog/ewl_filedialog_test.c
+++ b/src/bin/tests/filedialog/ewl_filedialog_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -17,134 +17,134 @@ static void fd_append(void *value, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Filedialog";
- test->tip = "The filedialog is intended to be used for a\n"
- "single or multi-file chooser.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Filedialog";
+ test->tip = "The filedialog is intended to be used for a\n"
+ "single or multi-file chooser.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o, *o2;
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Selected Files");
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- o = ewl_vbox_new();
- ewl_widget_name_set(o, "file_list");
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- o = ewl_hbox_new();
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- o2 = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o2), "Single select");
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_callback_append(o2, EWL_CALLBACK_CLICKED,
- dialog_cb_single_clicked, NULL);
- ewl_widget_show(o2);
-
- o2 = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o2), "Multi select");
- ewl_container_child_append(EWL_CONTAINER(o), o2);
- ewl_callback_append(o2, EWL_CALLBACK_CLICKED,
- dialog_cb_multi_clicked, NULL);
- ewl_widget_show(o2);
-
- return 1;
+ Ewl_Widget *o, *o2;
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Selected Files");
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ o = ewl_vbox_new();
+ ewl_widget_name_set(o, "file_list");
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ o = ewl_hbox_new();
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ o2 = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o2), "Single select");
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_callback_append(o2, EWL_CALLBACK_CLICKED,
+ dialog_cb_single_clicked, NULL);
+ ewl_widget_show(o2);
+
+ o2 = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o2), "Multi select");
+ ewl_container_child_append(EWL_CONTAINER(o), o2);
+ ewl_callback_append(o2, EWL_CALLBACK_CLICKED,
+ dialog_cb_multi_clicked, NULL);
+ ewl_widget_show(o2);
+
+ return 1;
}
static void
dialog_cb_single_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *fd;
- Ecore_List *list;
-
- list = ecore_list_new();
- ecore_list_append(list, "text/directory");
-
- fd = ewl_filedialog_new();
- ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "Directories", NULL, list);
- ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "C Files", "*.c", NULL);
- ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "D Files", "*.d", NULL);
- ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW,
- fd_cb_delete, NULL);
- ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
- fd_cb_value_changed, NULL);
- ewl_widget_show(fd);
+ Ewl_Widget *fd;
+ Ecore_List *list;
+
+ list = ecore_list_new();
+ ecore_list_append(list, "text/directory");
+
+ fd = ewl_filedialog_new();
+ ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "Directories", NULL, list);
+ ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "C Files", "*.c", NULL);
+ ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "D Files", "*.d", NULL);
+ ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW,
+ fd_cb_delete, NULL);
+ ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
+ fd_cb_value_changed, NULL);
+ ewl_widget_show(fd);
}
static void
dialog_cb_multi_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *fd;
-
- fd = ewl_filedialog_multiselect_new();
- ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW,
- fd_cb_delete, NULL);
- ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
- fd_cb_value_changed, NULL);
- ewl_widget_show(fd);
+ Ewl_Widget *fd;
+
+ fd = ewl_filedialog_multiselect_new();
+ ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW,
+ fd_cb_delete, NULL);
+ ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
+ fd_cb_value_changed, NULL);
+ ewl_widget_show(fd);
}
static void
fd_cb_delete(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
}
static void
fd_cb_value_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Action_Response *e;
- Ewl_Widget *list;
- Ewl_Filedialog *fd;
-
- e = ev;
-
- list = ewl_widget_name_find("file_list");
- ewl_container_reset(EWL_CONTAINER(list));
-
- /* nothing to do on a cancel */
- if (e->response == EWL_STOCK_CANCEL)
- {
- ewl_widget_destroy(w);
- return;
- }
-
- fd = EWL_FILEDIALOG(w);
- Ecore_List *l;
- l = ewl_filedialog_selected_files_get(fd);
- ecore_list_free_cb_set(l, ECORE_FREE_CB(free));
- ecore_list_for_each(l, fd_append, list);
-
- ecore_list_destroy(l);
- ewl_widget_destroy(w);
+ Ewl_Event_Action_Response *e;
+ Ewl_Widget *list;
+ Ewl_Filedialog *fd;
+
+ e = ev;
+
+ list = ewl_widget_name_find("file_list");
+ ewl_container_reset(EWL_CONTAINER(list));
+
+ /* nothing to do on a cancel */
+ if (e->response == EWL_STOCK_CANCEL)
+ {
+ ewl_widget_destroy(w);
+ return;
+ }
+
+ fd = EWL_FILEDIALOG(w);
+ Ecore_List *l;
+ l = ewl_filedialog_selected_files_get(fd);
+ ecore_list_free_cb_set(l, ECORE_FREE_CB(free));
+ ecore_list_for_each(l, fd_append, list);
+
+ ecore_list_destroy(l);
+ ewl_widget_destroy(w);
}
static void
fd_append(void *value, void *data)
{
- Ewl_Widget *list, *o;
- const char *file;
+ Ewl_Widget *list, *o;
+ const char *file;
- file = value;
- list = data;
+ file = value;
+ list = data;
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), file);
- ewl_container_child_append(EWL_CONTAINER(list), o);
- ewl_widget_show(o);
- printf("%s\n", file);
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), file);
+ ewl_container_child_append(EWL_CONTAINER(list), o);
+ ewl_widget_show(o);
+ printf("%s\n", file);
}
diff --git a/src/bin/tests/filepicker/ewl_filepicker_test.c b/src/bin/tests/filepicker/ewl_filepicker_test.c
index 0fbb702..90f48c3 100644
--- a/src/bin/tests/filepicker/ewl_filepicker_test.c
+++ b/src/bin/tests/filepicker/ewl_filepicker_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_filepicker.h"
@@ -9,128 +9,128 @@
static int create_test(Ewl_Container *box);
static void ewl_filepicker_cb_value_changed(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static int directory_test_set_get(char *buf, int len);
static int directory_test_path_split(char *buf, int len);
static Ewl_Unit_Test filepicker_unit_tests[] = {
- {"directory set/get", directory_test_set_get, NULL, -1, 1},
- {"directory path split", directory_test_path_split, NULL, -1, 1},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"directory set/get", directory_test_set_get, NULL, -1, 1},
+ {"directory path split", directory_test_path_split, NULL, -1, 1},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Filepicker";
- test->tip = "A simple file picking widget";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
- test->unit_tests = filepicker_unit_tests;
+ test->name = "Filepicker";
+ test->tip = "A simple file picking widget";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
+ test->unit_tests = filepicker_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *w;
- Ewl_Filelist_Filter *f;
-
- w = ewl_filepicker_new();
- f = ewl_filepicker_filter_add(EWL_FILEPICKER(w), "C Files",
- "*.c", NULL);
- ewl_filepicker_filter_add(EWL_FILEPICKER(w), "D Files", "*.d", NULL);
- ewl_filepicker_filter_set(EWL_FILEPICKER(w), f);
- ewl_container_child_append(box, w);
- ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
- ewl_filepicker_cb_value_changed, NULL);
- ewl_widget_show(w);
-
- return 1;
+ Ewl_Widget *w;
+ Ewl_Filelist_Filter *f;
+
+ w = ewl_filepicker_new();
+ f = ewl_filepicker_filter_add(EWL_FILEPICKER(w), "C Files",
+ "*.c", NULL);
+ ewl_filepicker_filter_add(EWL_FILEPICKER(w), "D Files", "*.d", NULL);
+ ewl_filepicker_filter_set(EWL_FILEPICKER(w), f);
+ ewl_container_child_append(box, w);
+ ewl_callback_append(w, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_filepicker_cb_value_changed, NULL);
+ ewl_widget_show(w);
+
+ return 1;
}
static void
ewl_filepicker_cb_value_changed(Ewl_Widget *w, void *ev,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Filepicker *fp;
- Ewl_Event_Action_Response *e;
-
- fp = EWL_FILEPICKER(w);
- e = ev;
-
- /* need to deal with multiselect in here */
- switch (e->response)
- {
- case EWL_STOCK_OPEN:
- {
- char *file;
-
- file = ewl_filepicker_selected_file_get(fp);
-
- if (!file)
- printf("No file selected.\n");
- else
- {
- printf("%s\n", file);
- free(file);
- }
- break;
- }
- default:
- case EWL_STOCK_CANCEL:
- printf("Cancelled\n");
- break;
- }
+ Ewl_Filepicker *fp;
+ Ewl_Event_Action_Response *e;
+
+ fp = EWL_FILEPICKER(w);
+ e = ev;
+
+ /* need to deal with multiselect in here */
+ switch (e->response)
+ {
+ case EWL_STOCK_OPEN:
+ {
+ char *file;
+
+ file = ewl_filepicker_selected_file_get(fp);
+
+ if (!file)
+ printf("No file selected.\n");
+ else
+ {
+ printf("%s\n", file);
+ free(file);
+ }
+ break;
+ }
+ default:
+ case EWL_STOCK_CANCEL:
+ printf("Cancelled\n");
+ break;
+ }
}
static int
directory_test_set_get(char *buf, int len)
{
- Ewl_Widget *fp;
- const char *t;
- int ret = 0;
-
- fp = ewl_filepicker_new();
- ewl_filepicker_directory_set(EWL_FILEPICKER(fp),
- "/tmp");
- t = ewl_filepicker_directory_get(EWL_FILEPICKER(fp));
-
- if (strcmp(t, "/tmp"))
- LOG_FAILURE(buf, len, "directory_get did not match "
- "directory_set %s", t);
- else
- ret = 1;
-
- return ret;
+ Ewl_Widget *fp;
+ const char *t;
+ int ret = 0;
+
+ fp = ewl_filepicker_new();
+ ewl_filepicker_directory_set(EWL_FILEPICKER(fp),
+ "/tmp");
+ t = ewl_filepicker_directory_get(EWL_FILEPICKER(fp));
+
+ if (strcmp(t, "/tmp"))
+ LOG_FAILURE(buf, len, "directory_get did not match "
+ "directory_set %s", t);
+ else
+ ret = 1;
+
+ return ret;
}
static int
directory_test_path_split(char *buf, int len)
{
- Ewl_Widget *fp;
- char *t;
- int i = 0, ret = 1;
- char *rez[] = {"/usr/local/bin", "/usr/local", "/usr", "/"};
-
- fp = ewl_filepicker_new();
- ewl_filepicker_directory_set(EWL_FILEPICKER(fp),
- "/usr/local/bin/");
-
- ecore_list_first_goto(EWL_FILEPICKER(fp)->path);
- while ((t = ecore_list_next(EWL_FILEPICKER(fp)->path)))
- {
- if (strcmp(rez[i], t))
- {
- LOG_FAILURE(buf, len, "path list not setup correctly. "
- "[%s didn't match %s]", t, rez[i]);
- ret = 0;
- break;
- }
- i++;
- }
-
- return ret;
+ Ewl_Widget *fp;
+ char *t;
+ int i = 0, ret = 1;
+ char *rez[] = {"/usr/local/bin", "/usr/local", "/usr", "/"};
+
+ fp = ewl_filepicker_new();
+ ewl_filepicker_directory_set(EWL_FILEPICKER(fp),
+ "/usr/local/bin/");
+
+ ecore_list_first_goto(EWL_FILEPICKER(fp)->path);
+ while ((t = ecore_list_next(EWL_FILEPICKER(fp)->path)))
+ {
+ if (strcmp(rez[i], t))
+ {
+ LOG_FAILURE(buf, len, "path list not setup correctly. "
+ "[%s didn't match %s]", t, rez[i]);
+ ret = 0;
+ break;
+ }
+ i++;
+ }
+
+ return ret;
}
diff --git a/src/bin/tests/floater/ewl_floater_test.c b/src/bin/tests/floater/ewl_floater_test.c
index c1fadf4..b33ac95 100644
--- a/src/bin/tests/floater/ewl_floater_test.c
+++ b/src/bin/tests/floater/ewl_floater_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_floater.h"
@@ -11,78 +11,78 @@ static int create_test(Ewl_Container *box);
void
test_info(Ewl_Test *test)
{
- test->name = "Floater";
- test->tip = "Defines a widget for layering above other\n "
- "widgets in EWL's drawing area, with\n"
- "the ability to follow the movement of\n"
- "another widget.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Floater";
+ test->tip = "Defines a widget for layering above other\n "
+ "widgets in EWL's drawing area, with\n"
+ "the ability to follow the movement of\n"
+ "another widget.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *separator, *button[2], *check_button[2];
- Ewl_Widget *radio_button[2], *floater;
+ Ewl_Widget *separator, *button[2], *check_button[2];
+ Ewl_Widget *radio_button[2], *floater;
- radio_button[0] = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(radio_button[0]), "With Label");
- ewl_container_child_append(EWL_CONTAINER(box), radio_button[0]);
- ewl_object_alignment_set(EWL_OBJECT(radio_button[0]),
- EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(radio_button[0]);
+ radio_button[0] = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(radio_button[0]), "With Label");
+ ewl_container_child_append(EWL_CONTAINER(box), radio_button[0]);
+ ewl_object_alignment_set(EWL_OBJECT(radio_button[0]),
+ EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(radio_button[0]);
- radio_button[1] = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(radio_button[1]), NULL);
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_button[1]),
- EWL_RADIOBUTTON(radio_button[0]));
- ewl_container_child_append(EWL_CONTAINER(box), radio_button[1]);
- ewl_object_alignment_set(EWL_OBJECT(radio_button[1]),
- EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(radio_button[1]);
+ radio_button[1] = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(radio_button[1]), NULL);
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_button[1]),
+ EWL_RADIOBUTTON(radio_button[0]));
+ ewl_container_child_append(EWL_CONTAINER(box), radio_button[1]);
+ ewl_object_alignment_set(EWL_OBJECT(radio_button[1]),
+ EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(radio_button[1]);
- floater = ewl_floater_new();
- ewl_floater_follow_set(EWL_FLOATER(floater), radio_button[1]);
- ewl_container_child_append(EWL_CONTAINER(box), floater);
- ewl_floater_position_set(EWL_FLOATER(floater), 20, 20);
- ewl_widget_show(floater);
+ floater = ewl_floater_new();
+ ewl_floater_follow_set(EWL_FLOATER(floater), radio_button[1]);
+ ewl_container_child_append(EWL_CONTAINER(box), floater);
+ ewl_floater_position_set(EWL_FLOATER(floater), 20, 20);
+ ewl_widget_show(floater);
- button[0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[0]), "With Label");
- ewl_container_child_append(EWL_CONTAINER(floater), button[0]);
- ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_LEFT);
- ewl_object_custom_size_set(EWL_OBJECT(button[0]), 100, 17);
- ewl_widget_show(button[0]);
+ button[0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[0]), "With Label");
+ ewl_container_child_append(EWL_CONTAINER(floater), button[0]);
+ ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_LEFT);
+ ewl_object_custom_size_set(EWL_OBJECT(button[0]), 100, 17);
+ ewl_widget_show(button[0]);
- button[1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[1]), NULL);
- ewl_container_child_append(EWL_CONTAINER(floater), button[1]);
- ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_LEFT);
- ewl_object_custom_size_set(EWL_OBJECT(button[1]), 100, 17);
- ewl_widget_show(button[1]);
+ button[1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[1]), NULL);
+ ewl_container_child_append(EWL_CONTAINER(floater), button[1]);
+ ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_LEFT);
+ ewl_object_custom_size_set(EWL_OBJECT(button[1]), 100, 17);
+ ewl_widget_show(button[1]);
- separator = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(floater), separator);
- ewl_widget_show(separator);
+ separator = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(floater), separator);
+ ewl_widget_show(separator);
- ewl_object_padding_set(EWL_OBJECT(separator), 2, 2, 5, 5);
+ ewl_object_padding_set(EWL_OBJECT(separator), 2, 2, 5, 5);
- check_button[0] = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check_button[0]), "With Label");
- ewl_container_child_append(EWL_CONTAINER(floater), check_button[0]);
- ewl_object_alignment_set(EWL_OBJECT(check_button[0]),
- EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(check_button[0]);
+ check_button[0] = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check_button[0]), "With Label");
+ ewl_container_child_append(EWL_CONTAINER(floater), check_button[0]);
+ ewl_object_alignment_set(EWL_OBJECT(check_button[0]),
+ EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(check_button[0]);
- check_button[1] = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(check_button[1]), NULL);
- ewl_container_child_append(EWL_CONTAINER(floater), check_button[1]);
- ewl_object_alignment_set(EWL_OBJECT(check_button[1]),
- EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(check_button[1]);
+ check_button[1] = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(check_button[1]), NULL);
+ ewl_container_child_append(EWL_CONTAINER(floater), check_button[1]);
+ ewl_object_alignment_set(EWL_OBJECT(check_button[1]),
+ EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(check_button[1]);
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/freebox/ewl_freebox_test.c b/src/bin/tests/freebox/ewl_freebox_test.c
index c493a10..7d3e4a1 100644
--- a/src/bin/tests/freebox/ewl_freebox_test.c
+++ b/src/bin/tests/freebox/ewl_freebox_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_border.h"
@@ -23,182 +23,182 @@ typedef struct Freebox_Test Freebox_Test;
struct Freebox_Test
{
- const char *name;
- const Ewl_Freebox_Layout_Type type;
- Ewl_Freebox_Comparator compare;
+ const char *name;
+ const Ewl_Freebox_Layout_Type type;
+ Ewl_Freebox_Comparator compare;
};
void
test_info(Ewl_Test *test)
{
- test->name = "Freebox";
- test->tip = "The freebox is used for a more free layout system\n"
- "then the other containers",
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Freebox";
+ test->tip = "The freebox is used for a more free layout system\n"
+ "then the other containers",
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- int i;
- const Freebox_Test fbtests[] = {
- {
- "Manual Placement",
- EWL_FREEBOX_LAYOUT_MANUAL,
- NULL
- },
- {
- "Auto Placement",
- EWL_FREEBOX_LAYOUT_AUTO,
- NULL
- },
- {
- "Comparator Placement (by name)",
- EWL_FREEBOX_LAYOUT_COMPARATOR,
- ewl_freebox_cb_compare
- },
- { NULL, EWL_FREEBOX_LAYOUT_AUTO, NULL }
- };
-
- srand(time(NULL));
-
- ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_ALL);
-
- for (i = 0; fbtests[i].name != NULL; i++) {
- Ewl_Widget *border, *hbox, *fb, *pane, *o;
-
- border = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(border),
- (char *)fbtests[i].name);
- ewl_object_fill_policy_set(EWL_OBJECT(border), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(box), border);
- ewl_widget_show(border);
-
- /* nest the freebox in a scrollpane */
- pane = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(border), pane);
- ewl_widget_show(pane);
-
- /* create a freebox of the type for this test */
- fb = ewl_freebox_new();
- ewl_freebox_layout_type_set(EWL_FREEBOX(fb), fbtests[i].type);
- if (fbtests[i].compare) {
- ewl_freebox_comparator_set(EWL_FREEBOX(fb),
- fbtests[i].compare);
- sort_fb = fb;
- }
- ewl_container_child_append(EWL_CONTAINER(pane), fb);
- ewl_widget_show(fb);
-
- /* pack controls for the freebox */
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(border), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_TOP);
- ewl_widget_show(hbox);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Add items");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_freebox_cb_add, fb);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Clear items");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_freebox_cb_clear, fb);
- ewl_widget_show(o);
- }
-
- return 1;
+ int i;
+ const Freebox_Test fbtests[] = {
+ {
+ "Manual Placement",
+ EWL_FREEBOX_LAYOUT_MANUAL,
+ NULL
+ },
+ {
+ "Auto Placement",
+ EWL_FREEBOX_LAYOUT_AUTO,
+ NULL
+ },
+ {
+ "Comparator Placement (by name)",
+ EWL_FREEBOX_LAYOUT_COMPARATOR,
+ ewl_freebox_cb_compare
+ },
+ { NULL, EWL_FREEBOX_LAYOUT_AUTO, NULL }
+ };
+
+ srand(time(NULL));
+
+ ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_ALL);
+
+ for (i = 0; fbtests[i].name != NULL; i++) {
+ Ewl_Widget *border, *hbox, *fb, *pane, *o;
+
+ border = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(border),
+ (char *)fbtests[i].name);
+ ewl_object_fill_policy_set(EWL_OBJECT(border), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(box), border);
+ ewl_widget_show(border);
+
+ /* nest the freebox in a scrollpane */
+ pane = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(border), pane);
+ ewl_widget_show(pane);
+
+ /* create a freebox of the type for this test */
+ fb = ewl_freebox_new();
+ ewl_freebox_layout_type_set(EWL_FREEBOX(fb), fbtests[i].type);
+ if (fbtests[i].compare) {
+ ewl_freebox_comparator_set(EWL_FREEBOX(fb),
+ fbtests[i].compare);
+ sort_fb = fb;
+ }
+ ewl_container_child_append(EWL_CONTAINER(pane), fb);
+ ewl_widget_show(fb);
+
+ /* pack controls for the freebox */
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(border), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_TOP);
+ ewl_widget_show(hbox);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Add items");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_freebox_cb_add, fb);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Clear items");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_freebox_cb_clear, fb);
+ ewl_widget_show(o);
+ }
+
+ return 1;
}
static void
ewl_freebox_cb_icon_change(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Freebox *fb;
+ Ewl_Freebox *fb;
- fb = data;
- ewl_freebox_resort(EWL_FREEBOX(fb));
+ fb = data;
+ ewl_freebox_resort(EWL_FREEBOX(fb));
}
static int
ewl_freebox_cb_compare(Ewl_Widget *a, Ewl_Widget *b)
{
- const char *a_txt, *b_txt;
+ const char *a_txt, *b_txt;
- a_txt = ewl_icon_label_get(EWL_ICON(a));
- b_txt = ewl_icon_label_get(EWL_ICON(b));
+ a_txt = ewl_icon_label_get(EWL_ICON(a));
+ b_txt = ewl_icon_label_get(EWL_ICON(b));
- return strcmp(a_txt, b_txt);
+ return strcmp(a_txt, b_txt);
}
static void
ewl_freebox_cb_add(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Freebox *fb;
- Ewl_Widget *i;
- int t;
-
- struct
- {
- char *name;
- char *path;
- } files[] = {
- {"Draw", PACKAGE_DATA_DIR "/ewl/images/Draw.png"},
- {"End", PACKAGE_DATA_DIR "/ewl/images/End.png"},
- {"Card", PACKAGE_DATA_DIR "/ewl/images/NewBCard.png"},
- {"Open", PACKAGE_DATA_DIR "/ewl/images/Open.png"},
- {"Package", PACKAGE_DATA_DIR "/ewl/images/Package.png"},
- {"World", PACKAGE_DATA_DIR "/ewl/images/World.png"},
- {NULL, NULL}
- };
-
- fb = data;
-
- for (t = 0; files[t].name != NULL; t++)
- {
- long width, height;
-
- width = (rand() % 30) + 30;
- height = (rand() % 30) + 30;
-
- i = ewl_icon_new();
- ewl_container_child_append(EWL_CONTAINER(fb), i);
- ewl_icon_label_set(EWL_ICON(i), files[t].name);
- ewl_icon_image_set(EWL_ICON(i), files[t].path, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(i),
- EWL_FLAG_FILL_FILL);
- ewl_object_minimum_size_set(EWL_OBJECT(i), (int)width,
- (int)height);
- if (fb == EWL_FREEBOX(sort_fb))
- {
- ewl_icon_editable_set(EWL_ICON(i), TRUE);
- ewl_callback_append(i, EWL_CALLBACK_VALUE_CHANGED,
- ewl_freebox_cb_icon_change, fb);
- }
- ewl_widget_show(i);
- }
+ Ewl_Freebox *fb;
+ Ewl_Widget *i;
+ int t;
+
+ struct
+ {
+ char *name;
+ char *path;
+ } files[] = {
+ {"Draw", PACKAGE_DATA_DIR "/ewl/images/Draw.png"},
+ {"End", PACKAGE_DATA_DIR "/ewl/images/End.png"},
+ {"Card", PACKAGE_DATA_DIR "/ewl/images/NewBCard.png"},
+ {"Open", PACKAGE_DATA_DIR "/ewl/images/Open.png"},
+ {"Package", PACKAGE_DATA_DIR "/ewl/images/Package.png"},
+ {"World", PACKAGE_DATA_DIR "/ewl/images/World.png"},
+ {NULL, NULL}
+ };
+
+ fb = data;
+
+ for (t = 0; files[t].name != NULL; t++)
+ {
+ long width, height;
+
+ width = (rand() % 30) + 30;
+ height = (rand() % 30) + 30;
+
+ i = ewl_icon_new();
+ ewl_container_child_append(EWL_CONTAINER(fb), i);
+ ewl_icon_label_set(EWL_ICON(i), files[t].name);
+ ewl_icon_image_set(EWL_ICON(i), files[t].path, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(i),
+ EWL_FLAG_FILL_FILL);
+ ewl_object_minimum_size_set(EWL_OBJECT(i), (int)width,
+ (int)height);
+ if (fb == EWL_FREEBOX(sort_fb))
+ {
+ ewl_icon_editable_set(EWL_ICON(i), TRUE);
+ ewl_callback_append(i, EWL_CALLBACK_VALUE_CHANGED,
+ ewl_freebox_cb_icon_change, fb);
+ }
+ ewl_widget_show(i);
+ }
}
static void
ewl_freebox_cb_clear(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Freebox *fb;
+ Ewl_Freebox *fb;
- fb = data;
+ fb = data;
- ewl_container_reset(EWL_CONTAINER(fb));
+ ewl_container_reset(EWL_CONTAINER(fb));
}
diff --git a/src/bin/tests/fullscreen/ewl_fullscreen_test.c b/src/bin/tests/fullscreen/ewl_fullscreen_test.c
index a0370ff..905109c 100644
--- a/src/bin/tests/fullscreen/ewl_fullscreen_test.c
+++ b/src/bin/tests/fullscreen/ewl_fullscreen_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -13,44 +13,44 @@ static void ewl_widget_cb_click(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Fullscreen";
- test->tip = "Testing fullscreen.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->func = create_test;
+ test->name = "Fullscreen";
+ test->tip = "Testing fullscreen.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->func = create_test;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *vbox, *o;
- Ewl_Embed *emb;
+ Ewl_Widget *vbox, *o;
+ Ewl_Embed *emb;
- vbox = ewl_vbox_new();
- ewl_container_child_append(box, vbox);
- ewl_widget_show(vbox);
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(box, vbox);
+ ewl_widget_show(vbox);
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "button");
- ewl_container_child_append(EWL_CONTAINER(vbox), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_click, NULL);
- ewl_widget_show(o);
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "button");
+ ewl_container_child_append(EWL_CONTAINER(vbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_click, NULL);
+ ewl_widget_show(o);
- emb = ewl_embed_widget_find(EWL_WIDGET(box));
- ewl_window_fullscreen_set(EWL_WINDOW(emb), TRUE);
+ emb = ewl_embed_widget_find(EWL_WIDGET(box));
+ ewl_window_fullscreen_set(EWL_WINDOW(emb), TRUE);
- return 1;
+ return 1;
}
static void
ewl_widget_cb_click(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- if (ewl_window_fullscreen_get(EWL_WINDOW(emb)))
- ewl_window_fullscreen_set(EWL_WINDOW(emb), FALSE);
- else
- ewl_window_fullscreen_set(EWL_WINDOW(emb), TRUE);
+ emb = ewl_embed_widget_find(w);
+ if (ewl_window_fullscreen_get(EWL_WINDOW(emb)))
+ ewl_window_fullscreen_set(EWL_WINDOW(emb), FALSE);
+ else
+ ewl_window_fullscreen_set(EWL_WINDOW(emb), TRUE);
}
diff --git a/src/bin/tests/grid/ewl_grid_test.c b/src/bin/tests/grid/ewl_grid_test.c
index 5a529b6..2ddbcac 100644
--- a/src/bin/tests/grid/ewl_grid_test.c
+++ b/src/bin/tests/grid/ewl_grid_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -30,582 +30,582 @@ static int dimensions_auto_resize(char *buf, int len);
static int orientation_set_get(char *buf, int len);
static Ewl_Unit_Test grid_unit_tests[] = {
- {"set and get dimensions", dimensions_set_get, NULL, -1, 0},
- {"set and get fixed column size", column_fixed_set_get, NULL, -1, 0},
- {"set and get fixed row size", row_fixed_set_get, NULL, -1, 0},
- {"set and get relative column size", column_relative_set_get, NULL, -1, 0},
- {"set and get relative row size", row_relative_set_get, NULL, -1, 0},
- {"remove fixed column size", column_size_remove, NULL, -1, 0},
- {"remove row column size", row_size_remove, NULL, -1, 0},
- {"set and get vertiacal homogeneous", vhomogeneous_set_get, NULL, -1, 0},
- {"set and get horizontal homogeneous", hhomogeneous_set_get, NULL, -1, 0},
- {"set and get homogeneous", homogeneous_set_get, NULL, -1, 0},
- {"set and get position", position_set_get, NULL, -1, 0},
- {"get position of floating widgets", floating_position_get, NULL, -1, 0},
- {"auto resize dimensions", dimensions_auto_resize, NULL, -1, 0},
- {"set and get the orientation", orientation_set_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"set and get dimensions", dimensions_set_get, NULL, -1, 0},
+ {"set and get fixed column size", column_fixed_set_get, NULL, -1, 0},
+ {"set and get fixed row size", row_fixed_set_get, NULL, -1, 0},
+ {"set and get relative column size", column_relative_set_get, NULL, -1, 0},
+ {"set and get relative row size", row_relative_set_get, NULL, -1, 0},
+ {"remove fixed column size", column_size_remove, NULL, -1, 0},
+ {"remove row column size", row_size_remove, NULL, -1, 0},
+ {"set and get vertiacal homogeneous", vhomogeneous_set_get, NULL, -1, 0},
+ {"set and get horizontal homogeneous", hhomogeneous_set_get, NULL, -1, 0},
+ {"set and get homogeneous", homogeneous_set_get, NULL, -1, 0},
+ {"set and get position", position_set_get, NULL, -1, 0},
+ {"get position of floating widgets", floating_position_get, NULL, -1, 0},
+ {"auto resize dimensions", dimensions_auto_resize, NULL, -1, 0},
+ {"set and get the orientation", orientation_set_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Grid";
- test->tip = "The grid\n";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
- test->unit_tests = grid_unit_tests;
+ test->name = "Grid";
+ test->tip = "The grid\n";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
+ test->unit_tests = grid_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *vbox;
- Ewl_Widget *hbox;
- Ewl_Widget *w;
- Ewl_Widget *grid;
-
- /*
- * Setup the main structure
- */
- vbox = ewl_vbox_new();
- ewl_container_child_append(box, vbox);
- ewl_widget_show(vbox);
-
- /* the grid */
- grid = ewl_grid_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), grid);
- ewl_object_fill_policy_set(EWL_OBJECT(grid), EWL_FLAG_FILL_FILL);
- ewl_grid_dimensions_set(EWL_GRID(grid), 5, 4);
- ewl_grid_column_relative_w_set(EWL_GRID(grid), 0, 0.25);
- ewl_grid_row_fixed_h_set(EWL_GRID(grid), 3, 50);
- ewl_grid_row_preferred_h_use(EWL_GRID(grid), 2);
- ewl_widget_show(grid);
-
- /* the seperator */
- w = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), w);
- ewl_widget_show(w);
-
- /* the hbox */
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_VSHRINK);
- ewl_box_homogeneous_set(EWL_BOX(hbox), TRUE);
- ewl_widget_show(hbox);
-
- /* fill the hbox with content */
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "Append");
- ewl_container_child_append(EWL_CONTAINER(hbox), w);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED, child_append_cb, grid);
- ewl_widget_show(w);
-
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "Prepend");
- ewl_container_child_prepend(EWL_CONTAINER(hbox), w);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED, child_prepend_cb, grid);
- ewl_widget_show(w);
-
- /*
- * fill the grid with content
- */
- w = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(w), "This column is\n 25% wide");
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(grid), w);
- ewl_grid_child_position_set(EWL_GRID(grid), w, 0, 0, 0, 1);
- ewl_widget_show(w);
-
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "This row is 50px height");
- ewl_container_child_append(EWL_CONTAINER(grid), w);
- ewl_grid_child_position_set(EWL_GRID(grid), w, 1, 2, 3, 3);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED, button_clicked_cb, NULL);
- ewl_widget_show(w);
-
- w = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(w), "This row use the\n"
- "preferred height");
- ewl_container_child_append(EWL_CONTAINER(grid), w);
- ewl_grid_child_position_set(EWL_GRID(grid), w, 3, 4, 2, 2);
- ewl_widget_show(w);
-
- return 1;
+ Ewl_Widget *vbox;
+ Ewl_Widget *hbox;
+ Ewl_Widget *w;
+ Ewl_Widget *grid;
+
+ /*
+ * Setup the main structure
+ */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(box, vbox);
+ ewl_widget_show(vbox);
+
+ /* the grid */
+ grid = ewl_grid_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), grid);
+ ewl_object_fill_policy_set(EWL_OBJECT(grid), EWL_FLAG_FILL_FILL);
+ ewl_grid_dimensions_set(EWL_GRID(grid), 5, 4);
+ ewl_grid_column_relative_w_set(EWL_GRID(grid), 0, 0.25);
+ ewl_grid_row_fixed_h_set(EWL_GRID(grid), 3, 50);
+ ewl_grid_row_preferred_h_use(EWL_GRID(grid), 2);
+ ewl_widget_show(grid);
+
+ /* the seperator */
+ w = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), w);
+ ewl_widget_show(w);
+
+ /* the hbox */
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL
+ | EWL_FLAG_FILL_VSHRINK);
+ ewl_box_homogeneous_set(EWL_BOX(hbox), TRUE);
+ ewl_widget_show(hbox);
+
+ /* fill the hbox with content */
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "Append");
+ ewl_container_child_append(EWL_CONTAINER(hbox), w);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED, child_append_cb, grid);
+ ewl_widget_show(w);
+
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "Prepend");
+ ewl_container_child_prepend(EWL_CONTAINER(hbox), w);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED, child_prepend_cb, grid);
+ ewl_widget_show(w);
+
+ /*
+ * fill the grid with content
+ */
+ w = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(w), "This column is\n 25% wide");
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(grid), w);
+ ewl_grid_child_position_set(EWL_GRID(grid), w, 0, 0, 0, 1);
+ ewl_widget_show(w);
+
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "This row is 50px height");
+ ewl_container_child_append(EWL_CONTAINER(grid), w);
+ ewl_grid_child_position_set(EWL_GRID(grid), w, 1, 2, 3, 3);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED, button_clicked_cb, NULL);
+ ewl_widget_show(w);
+
+ w = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(w), "This row use the\n"
+ "preferred height");
+ ewl_container_child_append(EWL_CONTAINER(grid), w);
+ ewl_grid_child_position_set(EWL_GRID(grid), w, 3, 4, 2, 2);
+ ewl_widget_show(w);
+
+ return 1;
}
static void
child_append_cb(Ewl_Widget *w __UNUSED__, void *e __UNUSED__, void *d)
{
- Ewl_Widget *button;
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Append");
- ewl_container_child_append(EWL_CONTAINER(d), button);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_clicked_cb,
- NULL);
- ewl_widget_show(button);
+ Ewl_Widget *button;
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Append");
+ ewl_container_child_append(EWL_CONTAINER(d), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_clicked_cb,
+ NULL);
+ ewl_widget_show(button);
}
static void
child_prepend_cb(Ewl_Widget *w __UNUSED__, void *e __UNUSED__, void *d)
{
- Ewl_Widget *button;
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Prepend");
- ewl_container_child_prepend(EWL_CONTAINER(d), button);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_clicked_cb,
- NULL);
- ewl_widget_show(button);
+ Ewl_Widget *button;
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Prepend");
+ ewl_container_child_prepend(EWL_CONTAINER(d), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_clicked_cb,
+ NULL);
+ ewl_widget_show(button);
}
static void
button_clicked_cb(Ewl_Widget *w, void *e __UNUSED__, void *d __UNUSED__)
{
- Ewl_Widget *g;
- int start_col, end_col, start_row, end_row;
-
- g = w->parent;
- ewl_grid_child_position_get(EWL_GRID(g), w, &start_col, &end_col,
- &start_row, &end_row);
- printf("child position:\n\t\tstart\tend\n"
- " column:\t%i\t%i\n"
- " row:\t\t%i\t%i\n\n", start_col, end_col, start_row, end_row);
+ Ewl_Widget *g;
+ int start_col, end_col, start_row, end_row;
+
+ g = w->parent;
+ ewl_grid_child_position_get(EWL_GRID(g), w, &start_col, &end_col,
+ &start_row, &end_row);
+ printf("child position:\n\t\tstart\tend\n"
+ " column:\t%i\t%i\n"
+ " row:\t\t%i\t%i\n\n", start_col, end_col, start_row, end_row);
}
/* unit tests */
static int
dimensions_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int row, col;
- int ret = 1;
-
- grid = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(grid), 5, 6);
- ewl_grid_dimensions_get(EWL_GRID(grid), &col, &row);
-
- if (col != 5 || row != 6) {
- snprintf(buf, len, "dimensions are %dx%d, but should be 5x6",
- col, row);
- ret = 0;
- }
-
- ewl_widget_destroy(grid);
-
- return ret;
+ Ewl_Widget *grid;
+ int row, col;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(grid), 5, 6);
+ ewl_grid_dimensions_get(EWL_GRID(grid), &col, &row);
+
+ if (col != 5 || row != 6) {
+ snprintf(buf, len, "dimensions are %dx%d, but should be 5x6",
+ col, row);
+ ret = 0;
+ }
+
+ ewl_widget_destroy(grid);
+
+ return ret;
}
static int
column_fixed_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int fixed;
- int ret = 1;
-
- grid = ewl_grid_new();
- fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
- if (fixed != 0) {
- snprintf(buf, len, "the column has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
- }
-
- /* now set a fixed size and see if we get it back */
- ewl_grid_column_fixed_w_set(EWL_GRID(grid), 1, 123);
- fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
- if (fixed != 123) {
- snprintf(buf, len, "the column has a wrong fixed size (%d)!",
- fixed);
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int fixed;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
+ if (fixed != 0) {
+ snprintf(buf, len, "the column has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* now set a fixed size and see if we get it back */
+ ewl_grid_column_fixed_w_set(EWL_GRID(grid), 1, 123);
+ fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
+ if (fixed != 123) {
+ snprintf(buf, len, "the column has a wrong fixed size (%d)!",
+ fixed);
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
row_fixed_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int fixed;
- int ret = 1;
-
- grid = ewl_grid_new();
- fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
- if (fixed != 0) {
- snprintf(buf, len, "the row has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
- }
-
- /* now set a fixed size and see if we get it back */
- ewl_grid_row_fixed_h_set(EWL_GRID(grid), 1, 123);
- fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
- if (fixed != 123) {
- snprintf(buf, len, "the row has a wrong fixed size (%d)!",
- fixed);
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int fixed;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
+ if (fixed != 0) {
+ snprintf(buf, len, "the row has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* now set a fixed size and see if we get it back */
+ ewl_grid_row_fixed_h_set(EWL_GRID(grid), 1, 123);
+ fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
+ if (fixed != 123) {
+ snprintf(buf, len, "the row has a wrong fixed size (%d)!",
+ fixed);
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
column_relative_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- float rel;
- int ret = 1;
-
- grid = ewl_grid_new();
- rel = ewl_grid_column_relative_w_get(EWL_GRID(grid), 1);
- if (rel != 0.0) {
- snprintf(buf, len, "the column has a relative size (%f), where"
- " it shouldn't", rel);
- ret = 0;
- goto CLEANUP;
- }
-
- /* now set a relative size and see if we get it back */
- ewl_grid_column_relative_w_set(EWL_GRID(grid), 1, 0.5);
- rel = ewl_grid_column_relative_w_get(EWL_GRID(grid), 1);
- if (rel != 0.5) {
- snprintf(buf, len, "the column has a wrong relative size (%f)!",
- rel);
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ float rel;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ rel = ewl_grid_column_relative_w_get(EWL_GRID(grid), 1);
+ if (rel != 0.0) {
+ snprintf(buf, len, "the column has a relative size (%f), where"
+ " it shouldn't", rel);
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* now set a relative size and see if we get it back */
+ ewl_grid_column_relative_w_set(EWL_GRID(grid), 1, 0.5);
+ rel = ewl_grid_column_relative_w_get(EWL_GRID(grid), 1);
+ if (rel != 0.5) {
+ snprintf(buf, len, "the column has a wrong relative size (%f)!",
+ rel);
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
row_relative_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- float rel;
- int ret = 1;
-
- grid = ewl_grid_new();
- rel = ewl_grid_row_relative_h_get(EWL_GRID(grid), 1);
- if (rel != 0) {
- snprintf(buf, len, "the row has a rel size (%f), where"
- " it shouldn't", rel);
- ret = 0;
- goto CLEANUP;
- }
-
- /* now set a rel size and see if we get it back */
- ewl_grid_row_relative_h_set(EWL_GRID(grid), 1, 0.5);
- rel = ewl_grid_row_relative_h_get(EWL_GRID(grid), 1);
- if (rel != 0.5) {
- snprintf(buf, len, "the row has a wrong relative size (%f)!",
- rel);
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ float rel;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ rel = ewl_grid_row_relative_h_get(EWL_GRID(grid), 1);
+ if (rel != 0) {
+ snprintf(buf, len, "the row has a rel size (%f), where"
+ " it shouldn't", rel);
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* now set a rel size and see if we get it back */
+ ewl_grid_row_relative_h_set(EWL_GRID(grid), 1, 0.5);
+ rel = ewl_grid_row_relative_h_get(EWL_GRID(grid), 1);
+ if (rel != 0.5) {
+ snprintf(buf, len, "the row has a wrong relative size (%f)!",
+ rel);
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
column_size_remove(char *buf, int len)
{
- Ewl_Widget *grid;
- int fixed;
- int ret = 1;
-
- grid = ewl_grid_new();
- ewl_grid_column_fixed_w_set(EWL_GRID(grid), 1, 102);
- ewl_grid_column_w_remove(EWL_GRID(grid), 1);
- fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
- if (fixed != 0) {
- snprintf(buf, len, "the column has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int fixed;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ ewl_grid_column_fixed_w_set(EWL_GRID(grid), 1, 102);
+ ewl_grid_column_w_remove(EWL_GRID(grid), 1);
+ fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
+ if (fixed != 0) {
+ snprintf(buf, len, "the column has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
row_size_remove(char *buf, int len)
{
- Ewl_Widget *grid;
- int fixed;
- int ret = 1;
-
- grid = ewl_grid_new();
- ewl_grid_row_fixed_h_set(EWL_GRID(grid), 1, 102);
- ewl_grid_row_h_remove(EWL_GRID(grid), 1);
- fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
- if (fixed != 0) {
- snprintf(buf, len, "the row has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int fixed;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+ ewl_grid_row_fixed_h_set(EWL_GRID(grid), 1, 102);
+ ewl_grid_row_h_remove(EWL_GRID(grid), 1);
+ fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
+ if (fixed != 0) {
+ snprintf(buf, len, "the row has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
vhomogeneous_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int ret = 1;
-
- grid = ewl_grid_new();
-
- /* test true */
- ewl_grid_vhomogeneous_set(EWL_GRID(grid), TRUE);
- if (!ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is not vhomogeneous");
- ret = 0;
- goto CLEANUP;
- }
-
- /* test false */
- ewl_grid_vhomogeneous_set(EWL_GRID(grid), FALSE);
- if (ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is vhomogeneous");
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+
+ /* test true */
+ ewl_grid_vhomogeneous_set(EWL_GRID(grid), TRUE);
+ if (!ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
+ LOG_FAILURE(buf, len, "grid is not vhomogeneous");
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* test false */
+ ewl_grid_vhomogeneous_set(EWL_GRID(grid), FALSE);
+ if (ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
+ LOG_FAILURE(buf, len, "grid is vhomogeneous");
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
hhomogeneous_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int ret = 1;
-
- grid = ewl_grid_new();
-
- /* test true */
- ewl_grid_hhomogeneous_set(EWL_GRID(grid), TRUE);
- if (!ewl_grid_hhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is not hhomogeneous");
- ret = 0;
- goto CLEANUP;
- }
-
- /* test false */
- ewl_grid_hhomogeneous_set(EWL_GRID(grid), FALSE);
- if (ewl_grid_hhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is hhomogeneous");
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+
+ /* test true */
+ ewl_grid_hhomogeneous_set(EWL_GRID(grid), TRUE);
+ if (!ewl_grid_hhomogeneous_get(EWL_GRID(grid))) {
+ LOG_FAILURE(buf, len, "grid is not hhomogeneous");
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* test false */
+ ewl_grid_hhomogeneous_set(EWL_GRID(grid), FALSE);
+ if (ewl_grid_hhomogeneous_get(EWL_GRID(grid))) {
+ LOG_FAILURE(buf, len, "grid is hhomogeneous");
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
homogeneous_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int ret = 1;
-
- grid = ewl_grid_new();
-
- /* test true */
- ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
- if (!(ewl_grid_hhomogeneous_get(EWL_GRID(grid))
- || ewl_grid_vhomogeneous_get(EWL_GRID(grid)))) {
- LOG_FAILURE(buf, len, "grid is not homogeneous");
- ret = 0;
- goto CLEANUP;
- }
-
- /* test false */
- ewl_grid_homogeneous_set(EWL_GRID(grid), FALSE);
- if (ewl_grid_hhomogeneous_get(EWL_GRID(grid))
- || ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is homogeneous");
- ret = 0;
- goto CLEANUP;
- }
-
+ Ewl_Widget *grid;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+
+ /* test true */
+ ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
+ if (!(ewl_grid_hhomogeneous_get(EWL_GRID(grid))
+ || ewl_grid_vhomogeneous_get(EWL_GRID(grid)))) {
+ LOG_FAILURE(buf, len, "grid is not homogeneous");
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ /* test false */
+ ewl_grid_homogeneous_set(EWL_GRID(grid), FALSE);
+ if (ewl_grid_hhomogeneous_get(EWL_GRID(grid))
+ || ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
+ LOG_FAILURE(buf, len, "grid is homogeneous");
+ ret = 0;
+ goto CLEANUP;
+ }
+
CLEANUP:
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
position_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- Ewl_Widget *child;
- int ret = 1;
- int col_start, col_end, row_start, row_end;
+ Ewl_Widget *grid;
+ Ewl_Widget *child;
+ int ret = 1;
+ int col_start, col_end, row_start, row_end;
- grid = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(grid), 5, 6);
- ewl_widget_show(grid);
+ grid = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(grid), 5, 6);
+ ewl_widget_show(grid);
- child = ewl_cell_new();
- ewl_container_child_prepend(EWL_CONTAINER(grid), child);
- ewl_grid_child_position_set(EWL_GRID(grid), child, 0, 2, 1, 3);
- ewl_widget_show(child);
+ child = ewl_cell_new();
+ ewl_container_child_prepend(EWL_CONTAINER(grid), child);
+ ewl_grid_child_position_set(EWL_GRID(grid), child, 0, 2, 1, 3);
+ ewl_widget_show(child);
- ewl_grid_child_position_get(EWL_GRID(grid), child, &col_start, &col_end,
- &row_start, &row_end);
+ ewl_grid_child_position_get(EWL_GRID(grid), child, &col_start, &col_end,
+ &row_start, &row_end);
- if (col_start != 0 || col_end != 2 || row_start != 1 || row_end != 3) {
- LOG_FAILURE(buf, len, "child has wrong position");
- ret = 0;
- }
+ if (col_start != 0 || col_end != 2 || row_start != 1 || row_end != 3) {
+ LOG_FAILURE(buf, len, "child has wrong position");
+ ret = 0;
+ }
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
floating_position_get(char *buf, int len)
{
- Ewl_Widget *grid;
- Ewl_Widget *w[5];
- Ewl_Widget *pl;
- int ret = 1, i;
- int row = 0, col = 0;
-
- grid = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(grid), 2, 3);
- ewl_widget_show(grid);
-
- /* we place one widget */
- pl = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(grid), pl);
- ewl_grid_child_position_set(EWL_GRID(grid), pl, 0, 0, 1, 1);
- ewl_widget_show(pl);
-
- /* first add the children to the grid */
- for (i = 0; i < 5; i++) {
- w[i] = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(grid), w[i]);
- ewl_widget_show(w[i]);
- }
-
- /* now check the positions */
- for (i = 0; i < 5; i++) {
- int r, c;
-
- ewl_grid_child_position_get(EWL_GRID(grid), w[i], &c, NULL, &r,
- NULL);
- if (c != col || r != row) {
- LOG_FAILURE(buf, len, "child isn't placed right");
- ret = 0;
- break;
- }
- col++;
- if (col > 1) {
- col = 0;
- row++;
- }
- /* here is our placed widget we don't want to check this
- * position */
- if (col == 0 && row == 1)
- col = 1;
- }
-
- ewl_widget_destroy(grid);
-
- return ret;
+ Ewl_Widget *grid;
+ Ewl_Widget *w[5];
+ Ewl_Widget *pl;
+ int ret = 1, i;
+ int row = 0, col = 0;
+
+ grid = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(grid), 2, 3);
+ ewl_widget_show(grid);
+
+ /* we place one widget */
+ pl = ewl_cell_new();
+ ewl_container_child_append(EWL_CONTAINER(grid), pl);
+ ewl_grid_child_position_set(EWL_GRID(grid), pl, 0, 0, 1, 1);
+ ewl_widget_show(pl);
+
+ /* first add the children to the grid */
+ for (i = 0; i < 5; i++) {
+ w[i] = ewl_cell_new();
+ ewl_container_child_append(EWL_CONTAINER(grid), w[i]);
+ ewl_widget_show(w[i]);
+ }
+
+ /* now check the positions */
+ for (i = 0; i < 5; i++) {
+ int r, c;
+
+ ewl_grid_child_position_get(EWL_GRID(grid), w[i], &c, NULL, &r,
+ NULL);
+ if (c != col || r != row) {
+ LOG_FAILURE(buf, len, "child isn't placed right");
+ ret = 0;
+ break;
+ }
+ col++;
+ if (col > 1) {
+ col = 0;
+ row++;
+ }
+ /* here is our placed widget we don't want to check this
+ * position */
+ if (col == 0 && row == 1)
+ col = 1;
+ }
+
+ ewl_widget_destroy(grid);
+
+ return ret;
}
static int
dimensions_auto_resize(char *buf, int len)
{
- Ewl_Widget *grid;
- int ret = 1, i, number = 26;
+ Ewl_Widget *grid;
+ int ret = 1, i, number = 26;
- grid = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(grid), 2, 0);
- ewl_widget_show(grid);
+ grid = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(grid), 2, 0);
+ ewl_widget_show(grid);
- for (i = 0; i < number; i++) {
- Ewl_Widget *child;
+ for (i = 0; i < number; i++) {
+ Ewl_Widget *child;
- child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(grid), child);
- ewl_widget_show(child);
- }
+ child = ewl_cell_new();
+ ewl_container_child_append(EWL_CONTAINER(grid), child);
+ ewl_widget_show(child);
+ }
- i = 0;
- ewl_grid_dimensions_get(EWL_GRID(grid), NULL, &i);
+ i = 0;
+ ewl_grid_dimensions_get(EWL_GRID(grid), NULL, &i);
- if (i != number / 2) {
- LOG_FAILURE(buf, len, "the grid doesn't have the expected dimensions");
- ret = 0;
- }
+ if (i != number / 2) {
+ LOG_FAILURE(buf, len, "the grid doesn't have the expected dimensions");
+ ret = 0;
+ }
- ewl_widget_destroy(grid);
+ ewl_widget_destroy(grid);
- return ret;
+ return ret;
}
static int
orientation_set_get(char *buf, int len)
{
- Ewl_Widget *grid;
- int ret = 1;
-
- grid = ewl_grid_new();
-
- ewl_grid_orientation_set(EWL_GRID(grid), EWL_ORIENTATION_HORIZONTAL);
- if (ewl_grid_orientation_get(EWL_GRID(grid))
- != EWL_ORIENTATION_HORIZONTAL) {
- LOG_FAILURE(buf, len, "orientation is not horizontal");
- ret = 0;
- goto CLEANUP;
- }
-
- ewl_grid_orientation_set(EWL_GRID(grid), EWL_ORIENTATION_VERTICAL);
- if (ewl_grid_orientation_get(EWL_GRID(grid))
- != EWL_ORIENTATION_VERTICAL) {
- LOG_FAILURE(buf, len, "orientation is not vertiacal");
- ret = 0;
- goto CLEANUP;
- }
+ Ewl_Widget *grid;
+ int ret = 1;
+
+ grid = ewl_grid_new();
+
+ ewl_grid_orientation_set(EWL_GRID(grid), EWL_ORIENTATION_HORIZONTAL);
+ if (ewl_grid_orientation_get(EWL_GRID(grid))
+ != EWL_ORIENTATION_HORIZONTAL) {
+ LOG_FAILURE(buf, len, "orientation is not horizontal");
+ ret = 0;
+ goto CLEANUP;
+ }
+
+ ewl_grid_orientation_set(EWL_GRID(grid), EWL_ORIENTATION_VERTICAL);
+ if (ewl_grid_orientation_get(EWL_GRID(grid))
+ != EWL_ORIENTATION_VERTICAL) {
+ LOG_FAILURE(buf, len, "orientation is not vertiacal");
+ ret = 0;
+ goto CLEANUP;
+ }
CLEANUP:
- ewl_widget_destroy(grid);
- return ret;
+ ewl_widget_destroy(grid);
+ return ret;
}
diff --git a/src/bin/tests/histogram/ewl_histogram_test.c b/src/bin/tests/histogram/ewl_histogram_test.c
index 4f5af8d..70cd3ef 100644
--- a/src/bin/tests/histogram/ewl_histogram_test.c
+++ b/src/bin/tests/histogram/ewl_histogram_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_overlay.h"
@@ -13,77 +13,77 @@ static void ewl_histogram_test_cb_configure(Ewl_Widget *w, void *event, void *da
void
test_info(Ewl_Test *test)
{
- test->name = "Histogram";
- test->tip = "Defines an image histogram.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Histogram";
+ test->tip = "Defines an image histogram.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *overlay;
- Ewl_Widget *img;
- Ewl_Widget *hist;
+ Ewl_Widget *overlay;
+ Ewl_Widget *img;
+ Ewl_Widget *hist;
- overlay = ewl_overlay_new();
- ewl_container_child_append(EWL_CONTAINER(box), overlay);
- ewl_object_fill_policy_set(EWL_OBJECT(overlay), EWL_FLAG_FILL_ALL);
- ewl_callback_append(EWL_WIDGET(overlay), EWL_CALLBACK_CONFIGURE,
- ewl_histogram_test_cb_configure, NULL);
- ewl_widget_show(overlay);
+ overlay = ewl_overlay_new();
+ ewl_container_child_append(EWL_CONTAINER(box), overlay);
+ ewl_object_fill_policy_set(EWL_OBJECT(overlay), EWL_FLAG_FILL_ALL);
+ ewl_callback_append(EWL_WIDGET(overlay), EWL_CALLBACK_CONFIGURE,
+ ewl_histogram_test_cb_configure, NULL);
+ ewl_widget_show(overlay);
- img = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(img),
- PACKAGE_DATA_DIR "/ewl/images/entrance.png");
- ewl_image_proportional_set(EWL_IMAGE(img), TRUE);
- ewl_container_child_append(EWL_CONTAINER(overlay), img);
- ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL);
- ewl_widget_show(img);
+ img = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(img),
+ PACKAGE_DATA_DIR "/ewl/images/entrance.png");
+ ewl_image_proportional_set(EWL_IMAGE(img), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(overlay), img);
+ ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(img);
- hist = ewl_histogram_new();
- ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_Y);
- ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
- ewl_container_child_append(EWL_CONTAINER(overlay), hist);
- ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
- ewl_widget_show(hist);
+ hist = ewl_histogram_new();
+ ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_Y);
+ ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
+ ewl_container_child_append(EWL_CONTAINER(overlay), hist);
+ ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(hist);
- hist = ewl_histogram_new();
- ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R);
- ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
- ewl_container_child_append(EWL_CONTAINER(overlay), hist);
- ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
- ewl_widget_show(hist);
+ hist = ewl_histogram_new();
+ ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R);
+ ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
+ ewl_container_child_append(EWL_CONTAINER(overlay), hist);
+ ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(hist);
- hist = ewl_histogram_new();
- ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G);
- ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
- ewl_container_child_append(EWL_CONTAINER(overlay), hist);
- ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
- ewl_widget_show(hist);
+ hist = ewl_histogram_new();
+ ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G);
+ ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
+ ewl_container_child_append(EWL_CONTAINER(overlay), hist);
+ ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(hist);
- hist = ewl_histogram_new();
- ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B);
- ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
- ewl_container_child_append(EWL_CONTAINER(overlay), hist);
- ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
- ewl_widget_show(hist);
+ hist = ewl_histogram_new();
+ ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B);
+ ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
+ ewl_container_child_append(EWL_CONTAINER(overlay), hist);
+ ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
+ ewl_widget_show(hist);
- return 1;
+ return 1;
}
static void
ewl_histogram_test_cb_configure(Ewl_Widget *w, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *child;
- Ewl_Container *c = EWL_CONTAINER(w);
+ Ewl_Widget *child;
+ Ewl_Container *c = EWL_CONTAINER(w);
- ewl_container_child_iterate_begin(c);
- while ((child = ewl_container_child_next(c))) {
- ewl_object_place(EWL_OBJECT(child), CURRENT_X(c), CURRENT_Y(c),
- CURRENT_W(c), CURRENT_H(c));
- }
+ ewl_container_child_iterate_begin(c);
+ while ((child = ewl_container_child_next(c))) {
+ ewl_object_place(EWL_OBJECT(child), CURRENT_X(c), CURRENT_Y(c),
+ CURRENT_W(c), CURRENT_H(c));
+ }
}
diff --git a/src/bin/tests/icon/ewl_icon_test.c b/src/bin/tests/icon/ewl_icon_test.c
index b017ae8..e4150bb 100644
--- a/src/bin/tests/icon/ewl_icon_test.c
+++ b/src/bin/tests/icon/ewl_icon_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_icon.h"
@@ -12,110 +12,110 @@ static int create_test(Ewl_Container *box);
void
test_info(Ewl_Test *test)
{
- test->name = "Icon";
- test->tip = "";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Icon";
+ test->tip = "";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o, *o2, *hbox;
-
- hbox = ewl_hbox_new();
- ewl_container_child_append(box, hbox);
- ewl_widget_show(hbox);
-
- o = ewl_icon_new();
- ewl_box_orientation_set(EWL_BOX(o), EWL_ORIENTATION_HORIZONTAL);
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_icon_label_set(EWL_ICON(o), "Draw");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_show(o);
-
- o = ewl_icon_new();
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_icon_label_set(EWL_ICON(o), "Fill None");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_show(o);
-
- o = ewl_icon_new();
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_icon_label_set(EWL_ICON(o), "Draw");
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_show(o);
-
- o = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_icon_new();
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)");
- ewl_icon_editable_set(EWL_ICON(o), TRUE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o2 = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set "
- "on it.\n\n That data is just \n"
- "text, but could\nbe any widget.");
- ewl_widget_show(o2);
-
- o = ewl_icon_new();
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/World.png", NULL);
- ewl_icon_extended_data_set(EWL_ICON(o), o2);
- ewl_icon_label_set(EWL_ICON(o), "World");
- ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_icon_new();
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
- ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_icon_new();
- ewl_icon_image_set(EWL_ICON(o),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
- ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
- ewl_icon_editable_set(EWL_ICON(o), TRUE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- o = ewl_icon_new();
- ewl_icon_alt_text_set(EWL_ICON(o), "Icon Alt Text");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *o, *o2, *hbox;
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(box, hbox);
+ ewl_widget_show(hbox);
+
+ o = ewl_icon_new();
+ ewl_box_orientation_set(EWL_BOX(o), EWL_ORIENTATION_HORIZONTAL);
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_icon_label_set(EWL_ICON(o), "Draw");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_icon_label_set(EWL_ICON(o), "Fill None");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_new();
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_icon_label_set(EWL_ICON(o), "Draw");
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_new();
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)");
+ ewl_icon_editable_set(EWL_ICON(o), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o2 = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set "
+ "on it.\n\n That data is just \n"
+ "text, but could\nbe any widget.");
+ ewl_widget_show(o2);
+
+ o = ewl_icon_new();
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/World.png", NULL);
+ ewl_icon_extended_data_set(EWL_ICON(o), o2);
+ ewl_icon_label_set(EWL_ICON(o), "World");
+ ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_new();
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
+ ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_new();
+ ewl_icon_image_set(EWL_ICON(o),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
+ ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
+ ewl_icon_editable_set(EWL_ICON(o), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_new();
+ ewl_icon_alt_text_set(EWL_ICON(o), "Icon Alt Text");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ return 1;
}
diff --git a/src/bin/tests/icon_theme/ewl_icon_theme_test.c b/src/bin/tests/icon_theme/ewl_icon_theme_test.c
index f7eba3b..e1bf694 100644
--- a/src/bin/tests/icon_theme/ewl_icon_theme_test.c
+++ b/src/bin/tests/icon_theme/ewl_icon_theme_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_freebox.h"
@@ -12,260 +12,260 @@
static int ewl_icon_theme_pos = 0;
const char *icons[] = {
- EWL_ICON_ADDRESS_BOOK_NEW,
- EWL_ICON_APPLICATION_EXIT,
- EWL_ICON_APPOINTMENT_NEW,
- EWL_ICON_CONTACT_NEW,
- EWL_ICON_DIALOG_APPLY,
- EWL_ICON_DIALOG_CANCEL,
- EWL_ICON_DIALOG_CLOSE,
- EWL_ICON_DIALOG_OK,
- EWL_ICON_DOCUMENT_NEW,
- EWL_ICON_DOCUMENT_OPEN,
- EWL_ICON_DOCUMENT_OPEN_RECENT,
- EWL_ICON_DOCUMENT_PAGE_SETUP,
- EWL_ICON_DOCUMENT_PRINT,
- EWL_ICON_DOCUMENT_PRINT_PREVIEW,
- EWL_ICON_DOCUMENT_PROPERTIES,
- EWL_ICON_DOCUMENT_REVERT,
- EWL_ICON_DOCUMENT_SAVE,
- EWL_ICON_DOCUMENT_SAVE_AS,
- EWL_ICON_EDIT_COPY,
- EWL_ICON_EDIT_CUT,
- EWL_ICON_EDIT_DELETE,
- EWL_ICON_EDIT_FIND,
- EWL_ICON_EDIT_FIND_REPLACE,
- EWL_ICON_EDIT_PASTE,
- EWL_ICON_EDIT_REDO,
- EWL_ICON_EDIT_SELECT_ALL,
- EWL_ICON_EDIT_UNDO,
- EWL_ICON_FORMAT_INDENT_LESS,
- EWL_ICON_FORMAT_INDENT_MORE,
- EWL_ICON_FORMAT_JUSTIFY_CENTER,
- EWL_ICON_FORMAT_JUSTIFY_FILL,
- EWL_ICON_FORMAT_JUSTIFY_LEFT,
- EWL_ICON_FORMAT_JUSTIFY_RIGHT,
- EWL_ICON_FORMAT_TEXT_DIRECTION_LTR,
- EWL_ICON_FORMAT_TEXT_DIRECTION_RTL,
- EWL_ICON_FORMAT_TEXT_BOLD,
- EWL_ICON_FORMAT_TEXT_ITALIC,
- EWL_ICON_FORMAT_TEXT_UNDERLINE,
- EWL_ICON_FORMAT_TEXT_STRIKETHROUGH,
- EWL_ICON_GO_BOTTOM,
- EWL_ICON_GO_DOWN,
- EWL_ICON_GO_FIRST,
- EWL_ICON_GO_HOME,
- EWL_ICON_GO_JUMP,
- EWL_ICON_GO_LAST,
- EWL_ICON_GO_NEXT,
- EWL_ICON_GO_PREVIOUS,
- EWL_ICON_GO_TOP,
- EWL_ICON_GO_UP,
- EWL_ICON_HELP_ABOUT,
- EWL_ICON_HELP_CONTENTS,
- EWL_ICON_HELP_FAQ,
- EWL_ICON_INSERT_IMAGE,
- EWL_ICON_INSERT_LINK,
- EWL_ICON_INSERT_OBJECT,
- EWL_ICON_INSERT_TEXT,
- EWL_ICON_LIST_ADD,
- EWL_ICON_LIST_REMOVE,
- EWL_ICON_MAIL_FORWARD,
- EWL_ICON_MAIL_MARK_IMPORTANT,
- EWL_ICON_MAIL_MARK_JUNK,
- EWL_ICON_MAIL_MARK_NOTJUNK,
- EWL_ICON_MAIL_MARK_READ,
- EWL_ICON_MAIL_MARK_UNREAD,
- EWL_ICON_MAIL_MESSAGE_NEW,
- EWL_ICON_MAIL_REPLY_ALL,
- EWL_ICON_MAIL_REPLY_SENDER,
- EWL_ICON_MAIL_SEND_RECEIVE,
- EWL_ICON_MEDIA_EJECT,
- EWL_ICON_MEDIA_PLAYBACK_PAUSE,
- EWL_ICON_MEDIA_PLAYBACK_START,
- EWL_ICON_MEDIA_PLAYBACK_STOP,
- EWL_ICON_MEDIA_RECORD,
- EWL_ICON_MEDIA_SEEK_BACKWARD,
- EWL_ICON_MEDIA_SEEK_FORWARD,
- EWL_ICON_MEDIA_SKIP_BACKWARD,
- EWL_ICON_MEDIA_SKIP_FORWARD,
- EWL_ICON_SYSTEM_LOCK_SCREEN,
- EWL_ICON_SYSTEM_LOG_OUT,
- EWL_ICON_SYSTEM_RUN,
- EWL_ICON_SYSTEM_SEARCH,
- EWL_ICON_TOOLS_CHECK_SPELLING,
- EWL_ICON_VIEW_FULLSCREEN,
- EWL_ICON_VIEW_REFRESH,
- EWL_ICON_VIEW_SORT_ASCENDING,
- EWL_ICON_VIEW_SORT_DESCENDING,
- EWL_ICON_WINDOW_CLOSE,
- EWL_ICON_WINDOW_NEW,
- EWL_ICON_ZOOM_BEST_FIT,
- EWL_ICON_ZOOM_IN,
- EWL_ICON_ZOOM_ORIGINAL,
- EWL_ICON_ZOOM_OUT,
- EWL_ICON_PROCESS_WORKING,
- EWL_ICON_ACCESSORIES_CALCULATOR,
- EWL_ICON_ACCESSORIES_CHARACTER_MAP,
- EWL_ICON_ACCESSORIES_DICTIONARY,
- EWL_ICON_ACCESSORIES_TEXT_EDITOR,
- EWL_ICON_HELP_BROWSER,
- EWL_ICON_MULTIMEDIA_VOLUME_CONTROL,
- EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY,
- EWL_ICON_PREFERENCES_DESKTOP_FONT,
- EWL_ICON_PREFERENCES_DESKTOP_KEYBOARD,
- EWL_ICON_PREFERENCES_DESKTOP_LOCALE,
- EWL_ICON_PREFERENCES_DESKTOP_MULTIMEDIA,
- EWL_ICON_PREFERENCES_DESKTOP_SCREENSAVER,
- EWL_ICON_PREFERENCES_DESKTOP_THEME,
- EWL_ICON_PREFERENCES_DESKTOP_WALLPAPER,
- EWL_ICON_SYSTEM_FILE_MANAGER,
- EWL_ICON_SYSTEM_SOFTWARE_UPDATE,
- EWL_ICON_UTILITIES_TERMINAL,
- EWL_ICON_APPLICATIONS_ACCESSORIES,
- EWL_ICON_APPLICATIONS_DEVELOPMENT,
- EWL_ICON_APPLICATIONS_GAMES,
- EWL_ICON_APPLICATIONS_GRAPHICS,
- EWL_ICON_APPLICATIONS_INTERNET,
- EWL_ICON_APPLICATIONS_MULTIMEDIA,
- EWL_ICON_APPLICATIONS_OFFICE,
- EWL_ICON_APPLICATIONS_OTHER,
- EWL_ICON_APPLICATIONS_SYSTEM,
- EWL_ICON_APPLICATIONS_UTILITIES,
- EWL_ICON_PREFERENCES_DESKTOP,
- EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY,
- EWL_ICON_PREFERENCES_DESKTOP_PERIPHERALS,
- EWL_ICON_PREFERENCES_DESKTOP_PERSONAL,
- EWL_ICON_PREFERENCES_OTHER,
- EWL_ICON_PREFERENCES_SYSTEM,
- EWL_ICON_PREFERENCES_SYSTEM_NETWORK,
- EWL_ICON_SYSTEM_HELP,
- EWL_ICON_AUDIO_CARD,
- EWL_ICON_AUDIO_INPUT_MICROPHONE,
- EWL_ICON_BATTERY,
- EWL_ICON_CAMERA_PHOTO,
- EWL_ICON_CAMERA_VIDEO,
- EWL_ICON_COMPUTER,
- EWL_ICON_DRIVE_CDROM,
- EWL_ICON_DRIVE_HARDDISK,
- EWL_ICON_DRIVE_REMOVABLE_MEDIA,
- EWL_ICON_INPUT_GAMING,
- EWL_ICON_INPUT_KEYBOARD,
- EWL_ICON_INPUT_MOUSE,
- EWL_ICON_MEDIA_CDROM,
- EWL_ICON_MEDIA_FLOPPY,
- EWL_ICON_MULTIMEDIA_PLAYER,
- EWL_ICON_NETWORK_WIRED,
- EWL_ICON_NETWORK_WIRELESS,
- EWL_ICON_PRINTER,
- EWL_ICON_EMBLEM_DEFAULT,
- EWL_ICON_EMBLEM_DOCUMENTS,
- EWL_ICON_EMBLEM_DOWNLOADS,
- EWL_ICON_EMBLEM_FAVORITE,
- EWL_ICON_EMBLEM_IMPORTANT,
- EWL_ICON_EMBLEM_MAIL,
- EWL_ICON_EMBLEM_PHOTOS,
- EWL_ICON_EMBLEM_READONLY,
- EWL_ICON_EMBLEM_SHARED,
- EWL_ICON_EMBLEM_SYMBOLIC_LINK,
- EWL_ICON_EMBLEM_SYNCHRONIZED,
- EWL_ICON_EMBLEM_SYSTEM,
- EWL_ICON_EMBLEM_UNREADABLE,
- EWL_ICON_FACE_ANGEL,
- EWL_ICON_FACE_CRYING,
- EWL_ICON_FACE_DEVIL_GRIN,
- EWL_ICON_FACE_DEVIL_SAD,
- EWL_ICON_FACE_GLASSES,
- EWL_ICON_FACE_KISS,
- EWL_ICON_FACE_MONKEY,
- EWL_ICON_FACE_PLAIN,
- EWL_ICON_FACE_SAD,
- EWL_ICON_FACE_SMILE,
- EWL_ICON_FACE_SMILE_BIG,
- EWL_ICON_FACE_SMIRK,
- EWL_ICON_FACE_SURPRISE,
- EWL_ICON_FACE_WINK,
- EWL_ICON_APPLICATION_X_EXECUTABLE,
- EWL_ICON_AUDIO_X_GENERIC,
- EWL_ICON_FONT_X_GENERIC,
- EWL_ICON_IMAGE_X_GENERIC,
- EWL_ICON_PACKAGE_X_GENERIC,
- EWL_ICON_TEXT_HTML,
- EWL_ICON_TEXT_X_GENERIC,
- EWL_ICON_TEXT_X_GENERIC_TEMPLATE,
- EWL_ICON_TEXT_X_SCRIPT,
- EWL_ICON_VIDEO_X_GENERIC,
- EWL_ICON_X_OFFICE_ADDRESS_BOOK,
- EWL_ICON_X_OFFICE_CALENDAR,
- EWL_ICON_X_OFFICE_DOCUMENT,
- EWL_ICON_X_OFFICE_PRESENTATION,
- EWL_ICON_X_OFFICE_SPREADSHEET,
- EWL_ICON_FOLDER,
- EWL_ICON_FOLDER_NEW,
- EWL_ICON_FOLDER_REMOTE,
- EWL_ICON_NETWORK_SERVER,
- EWL_ICON_NETWORK_WORKGROUP,
- EWL_ICON_START_HERE,
- EWL_ICON_USER_DESKTOP,
- EWL_ICON_USER_HOME,
- EWL_ICON_USER_TRASH,
- EWL_ICON_APPOINTMENT_MISSED,
- EWL_ICON_APPOINTMENT_SOON,
- EWL_ICON_AUDIO_VOLUME_HIGH,
- EWL_ICON_AUDIO_VOLUME_LOW,
- EWL_ICON_AUDIO_VOLUME_MEDIUM,
- EWL_ICON_AUDIO_VOLUME_MUTED,
- EWL_ICON_BATTERY_CAUTION,
- EWL_ICON_BATTERY_LOW,
- EWL_ICON_DIALOG_ERROR,
- EWL_ICON_DIALOG_INFORMATION,
- EWL_ICON_DIALOG_PASSWORD,
- EWL_ICON_DIALOG_QUESTION,
- EWL_ICON_DIALOG_WARNING,
- EWL_ICON_FOLDER_DRAG_ACCEPT,
- EWL_ICON_FOLDER_OPEN,
- EWL_ICON_FOLDER_VISITING,
- EWL_ICON_IMAGE_LOADING,
- EWL_ICON_IMAGE_MISSING,
- EWL_ICON_MAIL_ATTACHMENT,
- EWL_ICON_MAIL_UNREAD,
- EWL_ICON_MAIL_READ,
- EWL_ICON_MAIL_REPLIED,
- EWL_ICON_MAIL_SIGNED,
- EWL_ICON_MAIL_SIGNED_VERIFIED,
- EWL_ICON_MEDIA_PLAYLIST_REPEAT,
- EWL_ICON_MEDIA_PLAYLIST_SHUFFLE,
- EWL_ICON_NETWORK_ERROR,
- EWL_ICON_NETWORK_IDLE,
- EWL_ICON_NETWORK_OFFLINE,
- EWL_ICON_NETWORK_RECEIVE,
- EWL_ICON_NETWORK_TRANSMIT,
- EWL_ICON_NETWORK_TRANSMIT_RECEIVE,
- EWL_ICON_PRINTER_ERROR,
- EWL_ICON_PRINTER_PRINTING,
- EWL_ICON_SOFTWARE_UPDATE_AVAILABLE,
- EWL_ICON_SOFTWARE_UPDATE_URGENT,
- EWL_ICON_SYNC_ERROR,
- EWL_ICON_SYNC_SYNCHRONIZING,
- EWL_ICON_TASK_DUE,
- EWL_ICON_TASK_PASSED_DUE,
- EWL_ICON_USER_AWAY,
- EWL_ICON_USER_IDLE,
- EWL_ICON_USER_OFFLINE,
- EWL_ICON_USER_ONLINE,
- EWL_ICON_USER_TRASH_FULL,
- EWL_ICON_WEATHER_CLEAR,
- EWL_ICON_WEATHER_CLEAR_NIGHT,
- EWL_ICON_WEATHER_FEW_CLOUDS,
- EWL_ICON_WEATHER_FEW_CLOUDS_NIGHT,
- EWL_ICON_WEATHER_FOG,
- EWL_ICON_WEATHER_OVERCAST,
- EWL_ICON_WEATHER_SEVERE_ALERT,
- EWL_ICON_WEATHER_SHOWERS,
- EWL_ICON_WEATHER_SHOWERS_SCATTERED,
- EWL_ICON_WEATHER_SNOW,
- EWL_ICON_WEATHER_STORM,
- NULL
+ EWL_ICON_ADDRESS_BOOK_NEW,
+ EWL_ICON_APPLICATION_EXIT,
+ EWL_ICON_APPOINTMENT_NEW,
+ EWL_ICON_CONTACT_NEW,
+ EWL_ICON_DIALOG_APPLY,
+ EWL_ICON_DIALOG_CANCEL,
+ EWL_ICON_DIALOG_CLOSE,
+ EWL_ICON_DIALOG_OK,
+ EWL_ICON_DOCUMENT_NEW,
+ EWL_ICON_DOCUMENT_OPEN,
+ EWL_ICON_DOCUMENT_OPEN_RECENT,
+ EWL_ICON_DOCUMENT_PAGE_SETUP,
+ EWL_ICON_DOCUMENT_PRINT,
+ EWL_ICON_DOCUMENT_PRINT_PREVIEW,
+ EWL_ICON_DOCUMENT_PROPERTIES,
+ EWL_ICON_DOCUMENT_REVERT,
+ EWL_ICON_DOCUMENT_SAVE,
+ EWL_ICON_DOCUMENT_SAVE_AS,
+ EWL_ICON_EDIT_COPY,
+ EWL_ICON_EDIT_CUT,
+ EWL_ICON_EDIT_DELETE,
+ EWL_ICON_EDIT_FIND,
+ EWL_ICON_EDIT_FIND_REPLACE,
+ EWL_ICON_EDIT_PASTE,
+ EWL_ICON_EDIT_REDO,
+ EWL_ICON_EDIT_SELECT_ALL,
+ EWL_ICON_EDIT_UNDO,
+ EWL_ICON_FORMAT_INDENT_LESS,
+ EWL_ICON_FORMAT_INDENT_MORE,
+ EWL_ICON_FORMAT_JUSTIFY_CENTER,
+ EWL_ICON_FORMAT_JUSTIFY_FILL,
+ EWL_ICON_FORMAT_JUSTIFY_LEFT,
+ EWL_ICON_FORMAT_JUSTIFY_RIGHT,
+ EWL_ICON_FORMAT_TEXT_DIRECTION_LTR,
+ EWL_ICON_FORMAT_TEXT_DIRECTION_RTL,
+ EWL_ICON_FORMAT_TEXT_BOLD,
+ EWL_ICON_FORMAT_TEXT_ITALIC,
+ EWL_ICON_FORMAT_TEXT_UNDERLINE,
+ EWL_ICON_FORMAT_TEXT_STRIKETHROUGH,
+ EWL_ICON_GO_BOTTOM,
+ EWL_ICON_GO_DOWN,
+ EWL_ICON_GO_FIRST,
+ EWL_ICON_GO_HOME,
+ EWL_ICON_GO_JUMP,
+ EWL_ICON_GO_LAST,
+ EWL_ICON_GO_NEXT,
+ EWL_ICON_GO_PREVIOUS,
+ EWL_ICON_GO_TOP,
+ EWL_ICON_GO_UP,
+ EWL_ICON_HELP_ABOUT,
+ EWL_ICON_HELP_CONTENTS,
+ EWL_ICON_HELP_FAQ,
+ EWL_ICON_INSERT_IMAGE,
+ EWL_ICON_INSERT_LINK,
+ EWL_ICON_INSERT_OBJECT,
+ EWL_ICON_INSERT_TEXT,
+ EWL_ICON_LIST_ADD,
+ EWL_ICON_LIST_REMOVE,
+ EWL_ICON_MAIL_FORWARD,
+ EWL_ICON_MAIL_MARK_IMPORTANT,
+ EWL_ICON_MAIL_MARK_JUNK,
+ EWL_ICON_MAIL_MARK_NOTJUNK,
+ EWL_ICON_MAIL_MARK_READ,
+ EWL_ICON_MAIL_MARK_UNREAD,
+ EWL_ICON_MAIL_MESSAGE_NEW,
+ EWL_ICON_MAIL_REPLY_ALL,
+ EWL_ICON_MAIL_REPLY_SENDER,
+ EWL_ICON_MAIL_SEND_RECEIVE,
+ EWL_ICON_MEDIA_EJECT,
+ EWL_ICON_MEDIA_PLAYBACK_PAUSE,
+ EWL_ICON_MEDIA_PLAYBACK_START,
+ EWL_ICON_MEDIA_PLAYBACK_STOP,
+ EWL_ICON_MEDIA_RECORD,
+ EWL_ICON_MEDIA_SEEK_BACKWARD,
+ EWL_ICON_MEDIA_SEEK_FORWARD,
+ EWL_ICON_MEDIA_SKIP_BACKWARD,
+ EWL_ICON_MEDIA_SKIP_FORWARD,
+ EWL_ICON_SYSTEM_LOCK_SCREEN,
+ EWL_ICON_SYSTEM_LOG_OUT,
+ EWL_ICON_SYSTEM_RUN,
+ EWL_ICON_SYSTEM_SEARCH,
+ EWL_ICON_TOOLS_CHECK_SPELLING,
+ EWL_ICON_VIEW_FULLSCREEN,
+ EWL_ICON_VIEW_REFRESH,
+ EWL_ICON_VIEW_SORT_ASCENDING,
+ EWL_ICON_VIEW_SORT_DESCENDING,
+ EWL_ICON_WINDOW_CLOSE,
+ EWL_ICON_WINDOW_NEW,
+ EWL_ICON_ZOOM_BEST_FIT,
+ EWL_ICON_ZOOM_IN,
+ EWL_ICON_ZOOM_ORIGINAL,
+ EWL_ICON_ZOOM_OUT,
+ EWL_ICON_PROCESS_WORKING,
+ EWL_ICON_ACCESSORIES_CALCULATOR,
+ EWL_ICON_ACCESSORIES_CHARACTER_MAP,
+ EWL_ICON_ACCESSORIES_DICTIONARY,
+ EWL_ICON_ACCESSORIES_TEXT_EDITOR,
+ EWL_ICON_HELP_BROWSER,
+ EWL_ICON_MULTIMEDIA_VOLUME_CONTROL,
+ EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY,
+ EWL_ICON_PREFERENCES_DESKTOP_FONT,
+ EWL_ICON_PREFERENCES_DESKTOP_KEYBOARD,
+ EWL_ICON_PREFERENCES_DESKTOP_LOCALE,
+ EWL_ICON_PREFERENCES_DESKTOP_MULTIMEDIA,
+ EWL_ICON_PREFERENCES_DESKTOP_SCREENSAVER,
+ EWL_ICON_PREFERENCES_DESKTOP_THEME,
+ EWL_ICON_PREFERENCES_DESKTOP_WALLPAPER,
+ EWL_ICON_SYSTEM_FILE_MANAGER,
+ EWL_ICON_SYSTEM_SOFTWARE_UPDATE,
+ EWL_ICON_UTILITIES_TERMINAL,
+ EWL_ICON_APPLICATIONS_ACCESSORIES,
+ EWL_ICON_APPLICATIONS_DEVELOPMENT,
+ EWL_ICON_APPLICATIONS_GAMES,
+ EWL_ICON_APPLICATIONS_GRAPHICS,
+ EWL_ICON_APPLICATIONS_INTERNET,
+ EWL_ICON_APPLICATIONS_MULTIMEDIA,
+ EWL_ICON_APPLICATIONS_OFFICE,
+ EWL_ICON_APPLICATIONS_OTHER,
+ EWL_ICON_APPLICATIONS_SYSTEM,
+ EWL_ICON_APPLICATIONS_UTILITIES,
+ EWL_ICON_PREFERENCES_DESKTOP,
+ EWL_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY,
+ EWL_ICON_PREFERENCES_DESKTOP_PERIPHERALS,
+ EWL_ICON_PREFERENCES_DESKTOP_PERSONAL,
+ EWL_ICON_PREFERENCES_OTHER,
+ EWL_ICON_PREFERENCES_SYSTEM,
+ EWL_ICON_PREFERENCES_SYSTEM_NETWORK,
+ EWL_ICON_SYSTEM_HELP,
+ EWL_ICON_AUDIO_CARD,
+ EWL_ICON_AUDIO_INPUT_MICROPHONE,
+ EWL_ICON_BATTERY,
+ EWL_ICON_CAMERA_PHOTO,
+ EWL_ICON_CAMERA_VIDEO,
+ EWL_ICON_COMPUTER,
+ EWL_ICON_DRIVE_CDROM,
+ EWL_ICON_DRIVE_HARDDISK,
+ EWL_ICON_DRIVE_REMOVABLE_MEDIA,
+ EWL_ICON_INPUT_GAMING,
+ EWL_ICON_INPUT_KEYBOARD,
+ EWL_ICON_INPUT_MOUSE,
+ EWL_ICON_MEDIA_CDROM,
+ EWL_ICON_MEDIA_FLOPPY,
+ EWL_ICON_MULTIMEDIA_PLAYER,
+ EWL_ICON_NETWORK_WIRED,
+ EWL_ICON_NETWORK_WIRELESS,
+ EWL_ICON_PRINTER,
+ EWL_ICON_EMBLEM_DEFAULT,
+ EWL_ICON_EMBLEM_DOCUMENTS,
+ EWL_ICON_EMBLEM_DOWNLOADS,
+ EWL_ICON_EMBLEM_FAVORITE,
+ EWL_ICON_EMBLEM_IMPORTANT,
+ EWL_ICON_EMBLEM_MAIL,
+ EWL_ICON_EMBLEM_PHOTOS,
+ EWL_ICON_EMBLEM_READONLY,
+ EWL_ICON_EMBLEM_SHARED,
+ EWL_ICON_EMBLEM_SYMBOLIC_LINK,
+ EWL_ICON_EMBLEM_SYNCHRONIZED,
+ EWL_ICON_EMBLEM_SYSTEM,
+ EWL_ICON_EMBLEM_UNREADABLE,
+ EWL_ICON_FACE_ANGEL,
+ EWL_ICON_FACE_CRYING,
+ EWL_ICON_FACE_DEVIL_GRIN,
+ EWL_ICON_FACE_DEVIL_SAD,
+ EWL_ICON_FACE_GLASSES,
+ EWL_ICON_FACE_KISS,
+ EWL_ICON_FACE_MONKEY,
+ EWL_ICON_FACE_PLAIN,
+ EWL_ICON_FACE_SAD,
+ EWL_ICON_FACE_SMILE,
+ EWL_ICON_FACE_SMILE_BIG,
+ EWL_ICON_FACE_SMIRK,
+ EWL_ICON_FACE_SURPRISE,
+ EWL_ICON_FACE_WINK,
+ EWL_ICON_APPLICATION_X_EXECUTABLE,
+ EWL_ICON_AUDIO_X_GENERIC,
+ EWL_ICON_FONT_X_GENERIC,
+ EWL_ICON_IMAGE_X_GENERIC,
+ EWL_ICON_PACKAGE_X_GENERIC,
+ EWL_ICON_TEXT_HTML,
+ EWL_ICON_TEXT_X_GENERIC,
+ EWL_ICON_TEXT_X_GENERIC_TEMPLATE,
+ EWL_ICON_TEXT_X_SCRIPT,
+ EWL_ICON_VIDEO_X_GENERIC,
+ EWL_ICON_X_OFFICE_ADDRESS_BOOK,
+ EWL_ICON_X_OFFICE_CALENDAR,
+ EWL_ICON_X_OFFICE_DOCUMENT,
+ EWL_ICON_X_OFFICE_PRESENTATION,
+ EWL_ICON_X_OFFICE_SPREADSHEET,
+ EWL_ICON_FOLDER,
+ EWL_ICON_FOLDER_NEW,
+ EWL_ICON_FOLDER_REMOTE,
+ EWL_ICON_NETWORK_SERVER,
+ EWL_ICON_NETWORK_WORKGROUP,
+ EWL_ICON_START_HERE,
+ EWL_ICON_USER_DESKTOP,
+ EWL_ICON_USER_HOME,
+ EWL_ICON_USER_TRASH,
+ EWL_ICON_APPOINTMENT_MISSED,
+ EWL_ICON_APPOINTMENT_SOON,
+ EWL_ICON_AUDIO_VOLUME_HIGH,
+ EWL_ICON_AUDIO_VOLUME_LOW,
+ EWL_ICON_AUDIO_VOLUME_MEDIUM,
+ EWL_ICON_AUDIO_VOLUME_MUTED,
+ EWL_ICON_BATTERY_CAUTION,
+ EWL_ICON_BATTERY_LOW,
+ EWL_ICON_DIALOG_ERROR,
+ EWL_ICON_DIALOG_INFORMATION,
+ EWL_ICON_DIALOG_PASSWORD,
+ EWL_ICON_DIALOG_QUESTION,
+ EWL_ICON_DIALOG_WARNING,
+ EWL_ICON_FOLDER_DRAG_ACCEPT,
+ EWL_ICON_FOLDER_OPEN,
+ EWL_ICON_FOLDER_VISITING,
+ EWL_ICON_IMAGE_LOADING,
+ EWL_ICON_IMAGE_MISSING,
+ EWL_ICON_MAIL_ATTACHMENT,
+ EWL_ICON_MAIL_UNREAD,
+ EWL_ICON_MAIL_READ,
+ EWL_ICON_MAIL_REPLIED,
+ EWL_ICON_MAIL_SIGNED,
+ EWL_ICON_MAIL_SIGNED_VERIFIED,
+ EWL_ICON_MEDIA_PLAYLIST_REPEAT,
+ EWL_ICON_MEDIA_PLAYLIST_SHUFFLE,
+ EWL_ICON_NETWORK_ERROR,
+ EWL_ICON_NETWORK_IDLE,
+ EWL_ICON_NETWORK_OFFLINE,
+ EWL_ICON_NETWORK_RECEIVE,
+ EWL_ICON_NETWORK_TRANSMIT,
+ EWL_ICON_NETWORK_TRANSMIT_RECEIVE,
+ EWL_ICON_PRINTER_ERROR,
+ EWL_ICON_PRINTER_PRINTING,
+ EWL_ICON_SOFTWARE_UPDATE_AVAILABLE,
+ EWL_ICON_SOFTWARE_UPDATE_URGENT,
+ EWL_ICON_SYNC_ERROR,
+ EWL_ICON_SYNC_SYNCHRONIZING,
+ EWL_ICON_TASK_DUE,
+ EWL_ICON_TASK_PASSED_DUE,
+ EWL_ICON_USER_AWAY,
+ EWL_ICON_USER_IDLE,
+ EWL_ICON_USER_OFFLINE,
+ EWL_ICON_USER_ONLINE,
+ EWL_ICON_USER_TRASH_FULL,
+ EWL_ICON_WEATHER_CLEAR,
+ EWL_ICON_WEATHER_CLEAR_NIGHT,
+ EWL_ICON_WEATHER_FEW_CLOUDS,
+ EWL_ICON_WEATHER_FEW_CLOUDS_NIGHT,
+ EWL_ICON_WEATHER_FOG,
+ EWL_ICON_WEATHER_OVERCAST,
+ EWL_ICON_WEATHER_SEVERE_ALERT,
+ EWL_ICON_WEATHER_SHOWERS,
+ EWL_ICON_WEATHER_SHOWERS_SCATTERED,
+ EWL_ICON_WEATHER_SNOW,
+ EWL_ICON_WEATHER_STORM,
+ NULL
};
static int create_test(Ewl_Container *box);
@@ -274,63 +274,63 @@ static int ewl_icon_theme_idle(void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Icon Theme";
- test->tip = "Testing the Icon Theme";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Icon Theme";
+ test->tip = "Testing the Icon Theme";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *fbox, *scroll;
+ Ewl_Widget *fbox, *scroll;
- scroll = ewl_scrollpane_new();
- ewl_container_child_append(box, scroll);
- ewl_object_minimum_size_set(EWL_OBJECT(scroll), 240, 180);
- ewl_widget_show(scroll);
+ scroll = ewl_scrollpane_new();
+ ewl_container_child_append(box, scroll);
+ ewl_object_minimum_size_set(EWL_OBJECT(scroll), 240, 180);
+ ewl_widget_show(scroll);
- fbox = ewl_vfreebox_new();
- ewl_container_child_append(EWL_CONTAINER(scroll), fbox);
- ewl_widget_show(fbox);
+ fbox = ewl_vfreebox_new();
+ ewl_container_child_append(EWL_CONTAINER(scroll), fbox);
+ ewl_widget_show(fbox);
- ewl_icon_theme_pos = 0;
+ ewl_icon_theme_pos = 0;
- ecore_idle_enterer_add(ewl_icon_theme_idle, fbox);
+ ecore_idle_enterer_add(ewl_icon_theme_idle, fbox);
- return 1;
+ return 1;
}
static int
ewl_icon_theme_idle(void *data)
{
- Ewl_Widget *o, *fbox;
- int count = 0, ret = 0;
+ Ewl_Widget *o, *fbox;
+ int count = 0, ret = 0;
- fbox = data;
- for ( ; icons[ewl_icon_theme_pos] != NULL;
- ewl_icon_theme_pos++, count ++)
- {
- const char *path;
+ fbox = data;
+ for ( ; icons[ewl_icon_theme_pos] != NULL;
+ ewl_icon_theme_pos++, count ++)
+ {
+ const char *path;
- if (count >= EWL_ICON_THEME_PER_LOOP)
- {
- ret = 1;
- break;
- }
+ if (count >= EWL_ICON_THEME_PER_LOOP)
+ {
+ ret = 1;
+ break;
+ }
- path = ewl_icon_theme_icon_path_get(icons[ewl_icon_theme_pos],
- EWL_ICON_SIZE_MEDIUM);
- o = ewl_icon_simple_new();
- if (path) ewl_icon_image_set(EWL_ICON(o), path,
- icons[ewl_icon_theme_pos]);
- ewl_icon_label_set(EWL_ICON(o), icons[ewl_icon_theme_pos]);
- ewl_container_child_append(EWL_CONTAINER(fbox), o);
- ewl_widget_show(o);
- }
+ path = ewl_icon_theme_icon_path_get(icons[ewl_icon_theme_pos],
+ EWL_ICON_SIZE_MEDIUM);
+ o = ewl_icon_simple_new();
+ if (path) ewl_icon_image_set(EWL_ICON(o), path,
+ icons[ewl_icon_theme_pos]);
+ ewl_icon_label_set(EWL_ICON(o), icons[ewl_icon_theme_pos]);
+ ewl_container_child_append(EWL_CONTAINER(fbox), o);
+ ewl_widget_show(o);
+ }
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/image/ewl_image_test.c b/src/bin/tests/image/ewl_image_test.c
index 4c9ad51..273380a 100644
--- a/src/bin/tests/image/ewl_image_test.c
+++ b/src/bin/tests/image/ewl_image_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -33,267 +33,267 @@ static int constrain_test_set_get(char *buf, int len);
static int proportional_test_set_get(char *buf, int len);
static Ewl_Unit_Test image_unit_tests[] = {
- {"image path set/get", path_test_set_get, NULL, -1, 0},
- {"image scale set/get", scale_test_set_get, NULL, -1, 0},
- {"image size set/get", size_test_set_get, NULL, -1, 0},
- {"image constrain set/get", constrain_test_set_get, NULL, -1, 0},
- {"image proportional set/get", proportional_test_set_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"image path set/get", path_test_set_get, NULL, -1, 0},
+ {"image scale set/get", scale_test_set_get, NULL, -1, 0},
+ {"image size set/get", size_test_set_get, NULL, -1, 0},
+ {"image constrain set/get", constrain_test_set_get, NULL, -1, 0},
+ {"image proportional set/get", proportional_test_set_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Image";
- test->tip = "Provides a widget for displaying evas\n"
- "loadable images, and edjes.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
- test->unit_tests = image_unit_tests;
+ test->name = "Image";
+ test->tip = "Provides a widget for displaying evas\n"
+ "loadable images, and edjes.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
+ test->unit_tests = image_unit_tests;
}
static void
destroy_image_test(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- ecore_dlist_destroy(images);
- if (last_dir)
- free(last_dir);
+ ecore_dlist_destroy(images);
+ if (last_dir)
+ free(last_dir);
}
static void
image_goto_prev_cb(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- char *img = NULL;
+ char *img = NULL;
- ecore_dlist_previous(images);
- img = ecore_dlist_current(images);
+ ecore_dlist_previous(images);
+ img = ecore_dlist_current(images);
- if (!img) img = ecore_dlist_last_goto(images);
+ if (!img) img = ecore_dlist_last_goto(images);
- ewl_text_text_set(EWL_TEXT(entry_path), img);
- ewl_image_file_set(EWL_IMAGE(image), img, NULL);
+ ewl_text_text_set(EWL_TEXT(entry_path), img);
+ ewl_image_file_set(EWL_IMAGE(image), img, NULL);
}
static void
image_remove_cb(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- char *img = NULL;
+ char *img = NULL;
- ecore_dlist_remove_destroy(images);
-
- img = ecore_dlist_current(images);
+ ecore_dlist_remove_destroy(images);
+
+ img = ecore_dlist_current(images);
- if (!img) img = ecore_dlist_last_goto(images);
+ if (!img) img = ecore_dlist_last_goto(images);
- ewl_text_text_set(EWL_TEXT(entry_path), img);
- ewl_image_file_set(EWL_IMAGE(image), img, NULL);
+ ewl_text_text_set(EWL_TEXT(entry_path), img);
+ ewl_image_file_set(EWL_IMAGE(image), img, NULL);
}
static void
image_load(const char *img)
{
- if (img && ecore_file_exists(img)) {
- ecore_dlist_append(images, strdup(img));
- ecore_dlist_last_goto(images);
- ewl_image_file_set(EWL_IMAGE(image), img, NULL);
- } else
- printf("ERROR: %s does not exist\n", img);
+ if (img && ecore_file_exists(img)) {
+ ecore_dlist_append(images, strdup(img));
+ ecore_dlist_last_goto(images);
+ ewl_image_file_set(EWL_IMAGE(image), img, NULL);
+ } else
+ printf("ERROR: %s does not exist\n", img);
}
static void
image_goto_next_cb(Ewl_Widget * w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- char *img = NULL;
+ char *img = NULL;
- ecore_dlist_next(images);
- img = ecore_dlist_current(images);
+ ecore_dlist_next(images);
+ img = ecore_dlist_current(images);
- if (!img)
- img = ecore_dlist_first_goto(images);
+ if (!img)
+ img = ecore_dlist_first_goto(images);
- ewl_text_text_set(EWL_TEXT(entry_path), img);
- ewl_image_file_set(EWL_IMAGE(image), img, NULL);
+ ewl_text_text_set(EWL_TEXT(entry_path), img);
+ ewl_image_file_set(EWL_IMAGE(image), img, NULL);
}
void
entry_path_cb_value_changed(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- char *img;
+ char *img;
- img = ewl_text_text_get(EWL_TEXT(w));
- image_load(img);
- free(img);
+ img = ewl_text_text_get(EWL_TEXT(w));
+ image_load(img);
+ free(img);
}
int
create_test(Ewl_Container *image_box)
{
- Ewl_Widget *scrollpane;
- Ewl_Widget *box;
- Ewl_Widget *button;
- Ewl_Widget *note;
- char *image_file = NULL;
-
- images = ecore_dlist_new();
- ecore_dlist_free_cb_set(images, free);
-
- scrollpane = ewl_scrollpane_new();
- ewl_callback_append(scrollpane, EWL_CALLBACK_DELETE_WINDOW,
- destroy_image_test, NULL);
- ewl_container_child_append(image_box, scrollpane);
- ewl_widget_show(scrollpane);
-
- if ((ecore_file_exists(PACKAGE_DATA_DIR "/ewl/images/e-logo.png")))
- image_file = strdup(PACKAGE_DATA_DIR "/ewl/images/e-logo.png");
- else if ((ecore_file_exists(PACKAGE_SOURCE_DIR "/data/images/e-logo.png")))
- image_file = strdup(PACKAGE_SOURCE_DIR "/data/images/e-logo.png");
- else if ((ecore_file_exists("./data/images/e-logo.png")))
- image_file = strdup("./data/images/e-logo.png");
- else if ((ecore_file_exists("../data/images/e-logo.png")))
- image_file = strdup("../data/images/e-logo.png");
-
- image = ewl_image_new();
- ewl_image_file_set(EWL_IMAGE(image), image_file, NULL);
- ewl_object_padding_set(EWL_OBJECT(image), 0, 0, 5, 0);
- ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(scrollpane), image);
- ewl_widget_show(image);
-
- if (image_file)
- ecore_dlist_append(images, image_file);
-
- box = ewl_hbox_new();
- ewl_box_spacing_set(EWL_BOX(box), 5);
- ewl_object_fill_policy_set(EWL_OBJECT(box),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_container_child_append(image_box, box);
- ewl_widget_show(box);
-
- entry_path = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(entry_path), image_file);
- ewl_object_fill_policy_set(EWL_OBJECT(entry_path),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_object_alignment_set(EWL_OBJECT(entry_path), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(box), entry_path);
- ewl_callback_append(entry_path, EWL_CALLBACK_VALUE_CHANGED,
- entry_path_cb_value_changed, NULL);
- ewl_widget_show(entry_path);
-
- button = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(button), EWL_STOCK_OPEN);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED,
- create_image_fd_cb, entry_path);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
- ewl_container_child_append(EWL_CONTAINER(box), button);
- ewl_widget_show(button);
-
- box = ewl_hbox_new();
- ewl_box_spacing_set(EWL_BOX(box), 5);
- ewl_object_fill_policy_set(EWL_OBJECT(box),
- EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(box),
- EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(image_box, box);
- ewl_widget_show(box);
-
- /* the previous button */
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Previous");
- ewl_container_child_append(EWL_CONTAINER(box), button);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED,
- image_goto_prev_cb, NULL);
- ewl_widget_show(button);
-
- /* the remove button */
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Remove");
- ewl_container_child_append(EWL_CONTAINER(box), button);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED,
- image_remove_cb, NULL);
- ewl_widget_show(button);
-
- /* the next button */
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Next");
- ewl_container_child_append(EWL_CONTAINER(box), button);
- ewl_callback_append(button, EWL_CALLBACK_CLICKED,
- image_goto_next_cb, NULL);
- ewl_widget_show(button);
-
- box = ewl_hbox_new();
- ewl_container_child_append(image_box, box);
- ewl_object_alignment_set(EWL_OBJECT(box), EWL_FLAG_ALIGN_CENTER);
- ewl_object_maximum_h_set(EWL_OBJECT(box), 20);
- ewl_widget_show(box);
-
- note = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(note), "Simple image viewer, load up images and page through them.");
- ewl_container_child_append(EWL_CONTAINER(box), note);
- ewl_widget_show(note);
-
- ewl_widget_show(image);
-
- return 1;
+ Ewl_Widget *scrollpane;
+ Ewl_Widget *box;
+ Ewl_Widget *button;
+ Ewl_Widget *note;
+ char *image_file = NULL;
+
+ images = ecore_dlist_new();
+ ecore_dlist_free_cb_set(images, free);
+
+ scrollpane = ewl_scrollpane_new();
+ ewl_callback_append(scrollpane, EWL_CALLBACK_DELETE_WINDOW,
+ destroy_image_test, NULL);
+ ewl_container_child_append(image_box, scrollpane);
+ ewl_widget_show(scrollpane);
+
+ if ((ecore_file_exists(PACKAGE_DATA_DIR "/ewl/images/e-logo.png")))
+ image_file = strdup(PACKAGE_DATA_DIR "/ewl/images/e-logo.png");
+ else if ((ecore_file_exists(PACKAGE_SOURCE_DIR "/data/images/e-logo.png")))
+ image_file = strdup(PACKAGE_SOURCE_DIR "/data/images/e-logo.png");
+ else if ((ecore_file_exists("./data/images/e-logo.png")))
+ image_file = strdup("./data/images/e-logo.png");
+ else if ((ecore_file_exists("../data/images/e-logo.png")))
+ image_file = strdup("../data/images/e-logo.png");
+
+ image = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(image), image_file, NULL);
+ ewl_object_padding_set(EWL_OBJECT(image), 0, 0, 5, 0);
+ ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(scrollpane), image);
+ ewl_widget_show(image);
+
+ if (image_file)
+ ecore_dlist_append(images, image_file);
+
+ box = ewl_hbox_new();
+ ewl_box_spacing_set(EWL_BOX(box), 5);
+ ewl_object_fill_policy_set(EWL_OBJECT(box),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_container_child_append(image_box, box);
+ ewl_widget_show(box);
+
+ entry_path = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(entry_path), image_file);
+ ewl_object_fill_policy_set(EWL_OBJECT(entry_path),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(entry_path), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(box), entry_path);
+ ewl_callback_append(entry_path, EWL_CALLBACK_VALUE_CHANGED,
+ entry_path_cb_value_changed, NULL);
+ ewl_widget_show(entry_path);
+
+ button = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(button), EWL_STOCK_OPEN);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED,
+ create_image_fd_cb, entry_path);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(EWL_CONTAINER(box), button);
+ ewl_widget_show(button);
+
+ box = ewl_hbox_new();
+ ewl_box_spacing_set(EWL_BOX(box), 5);
+ ewl_object_fill_policy_set(EWL_OBJECT(box),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(box),
+ EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(image_box, box);
+ ewl_widget_show(box);
+
+ /* the previous button */
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Previous");
+ ewl_container_child_append(EWL_CONTAINER(box), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED,
+ image_goto_prev_cb, NULL);
+ ewl_widget_show(button);
+
+ /* the remove button */
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Remove");
+ ewl_container_child_append(EWL_CONTAINER(box), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED,
+ image_remove_cb, NULL);
+ ewl_widget_show(button);
+
+ /* the next button */
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Next");
+ ewl_container_child_append(EWL_CONTAINER(box), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED,
+ image_goto_next_cb, NULL);
+ ewl_widget_show(button);
+
+ box = ewl_hbox_new();
+ ewl_container_child_append(image_box, box);
+ ewl_object_alignment_set(EWL_OBJECT(box), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_maximum_h_set(EWL_OBJECT(box), 20);
+ ewl_widget_show(box);
+
+ note = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(note), "Simple image viewer, load up images and page through them.");
+ ewl_container_child_append(EWL_CONTAINER(box), note);
+ ewl_widget_show(note);
+
+ ewl_widget_show(image);
+
+ return 1;
}
static void
create_image_fd_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- if (fd)
- return;
-
- fd = ewl_filedialog_new();
- ewl_window_title_set(EWL_WINDOW(fd), "Select an Image...");
- ewl_window_name_set(EWL_WINDOW(fd), "EWL Image Test");
- ewl_window_class_set(EWL_WINDOW(fd), "EWL Filedialog");
- ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
- create_image_fd_window_response, user_data);
- if (last_dir)
- ewl_filedialog_directory_set(EWL_FILEDIALOG(fd), last_dir);
- ewl_widget_show(fd);
+ if (fd)
+ return;
+
+ fd = ewl_filedialog_new();
+ ewl_window_title_set(EWL_WINDOW(fd), "Select an Image...");
+ ewl_window_name_set(EWL_WINDOW(fd), "EWL Image Test");
+ ewl_window_class_set(EWL_WINDOW(fd), "EWL Filedialog");
+ ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
+ create_image_fd_window_response, user_data);
+ if (last_dir)
+ ewl_filedialog_directory_set(EWL_FILEDIALOG(fd), last_dir);
+ ewl_widget_show(fd);
}
static void
create_image_fd_window_response(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Event_Action_Response *e;
- Ewl_Widget *entry = data;
-
- e = ev;
-
- if (e->response == EWL_STOCK_OK) {
- char *filename;
- const char *dir;
-
- filename = ewl_filedialog_selected_file_get(EWL_FILEDIALOG (w));
- printf("File open from image test: %s\n", filename);
- if (filename) {
- ewl_text_text_set(EWL_TEXT(entry), filename);
- image_load(filename);
- free (filename);
- }
- if (last_dir) {
- free(last_dir);
- last_dir = NULL;
- }
-
- dir = ewl_filedialog_directory_get(EWL_FILEDIALOG(fd));
- if (dir)
- last_dir = strdup(dir);
- }
- else {
- printf("Test program says bugger off.\n");
- }
-
- ewl_widget_destroy(fd);
- fd = NULL;
+ Ewl_Event_Action_Response *e;
+ Ewl_Widget *entry = data;
+
+ e = ev;
+
+ if (e->response == EWL_STOCK_OK) {
+ char *filename;
+ const char *dir;
+
+ filename = ewl_filedialog_selected_file_get(EWL_FILEDIALOG (w));
+ printf("File open from image test: %s\n", filename);
+ if (filename) {
+ ewl_text_text_set(EWL_TEXT(entry), filename);
+ image_load(filename);
+ free (filename);
+ }
+ if (last_dir) {
+ free(last_dir);
+ last_dir = NULL;
+ }
+
+ dir = ewl_filedialog_directory_get(EWL_FILEDIALOG(fd));
+ if (dir)
+ last_dir = strdup(dir);
+ }
+ else {
+ printf("Test program says bugger off.\n");
+ }
+
+ ewl_widget_destroy(fd);
+ fd = NULL;
}
/*
@@ -302,94 +302,94 @@ create_image_fd_window_response(Ewl_Widget *w, void *ev, void *data)
static int
path_test_set_get(char *buf, int len)
{
- Ewl_Widget *o;
- const char *t;
- int ret = 0;
+ Ewl_Widget *o;
+ const char *t;
+ int ret = 0;
- o = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(o), "/invalid/path");
- t = ewl_image_file_path_get(EWL_IMAGE(o));
+ o = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(o), "/invalid/path");
+ t = ewl_image_file_path_get(EWL_IMAGE(o));
- if (strcmp(t, "/invalid/path"))
- LOG_FAILURE(buf, len, "path_get did not match path_set.");
- else
- ret = 1;
+ if (strcmp(t, "/invalid/path"))
+ LOG_FAILURE(buf, len, "path_get did not match path_set.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
static int
scale_test_set_get(char *buf, int len)
{
- Ewl_Widget *o;
- int ret = 0;
- double sw, sh;
+ Ewl_Widget *o;
+ int ret = 0;
+ double sw, sh;
- o = ewl_image_new();
- ewl_image_scale_set(EWL_IMAGE(o), 2.0, 2.0);
- ewl_image_scale_get(EWL_IMAGE(o), &sw, &sh);
+ o = ewl_image_new();
+ ewl_image_scale_set(EWL_IMAGE(o), 2.0, 2.0);
+ ewl_image_scale_get(EWL_IMAGE(o), &sw, &sh);
- if (sw != 2.0 || sh != 2.0)
- LOG_FAILURE(buf, len, "scale_get did not match scale_set.");
- else
- ret = 1;
+ if (sw != 2.0 || sh != 2.0)
+ LOG_FAILURE(buf, len, "scale_get did not match scale_set.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
static int
size_test_set_get(char *buf, int len)
{
- Ewl_Widget *o;
- int ret = 0;
- int sw, sh;
+ Ewl_Widget *o;
+ int ret = 0;
+ int sw, sh;
- o = ewl_image_new();
- ewl_image_size_set(EWL_IMAGE(o), 2, 2);
- ewl_image_size_get(EWL_IMAGE(o), &sw, &sh);
+ o = ewl_image_new();
+ ewl_image_size_set(EWL_IMAGE(o), 2, 2);
+ ewl_image_size_get(EWL_IMAGE(o), &sw, &sh);
- if (sw != 2 || sh != 2)
- LOG_FAILURE(buf, len, "size_get did not match size_set.");
- else
- ret = 1;
+ if (sw != 2 || sh != 2)
+ LOG_FAILURE(buf, len, "size_get did not match size_set.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
static int
constrain_test_set_get(char *buf, int len)
{
- Ewl_Widget *o;
- int ret = 0;
- int sw;
+ Ewl_Widget *o;
+ int ret = 0;
+ int sw;
- o = ewl_image_new();
- ewl_image_constrain_set(EWL_IMAGE(o), 2);
- sw = ewl_image_constrain_get(EWL_IMAGE(o));
+ o = ewl_image_new();
+ ewl_image_constrain_set(EWL_IMAGE(o), 2);
+ sw = ewl_image_constrain_get(EWL_IMAGE(o));
- if (sw != 2)
- LOG_FAILURE(buf, len, "scale_get did not match scale_set.");
- else
- ret = 1;
+ if (sw != 2)
+ LOG_FAILURE(buf, len, "scale_get did not match scale_set.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
static int
proportional_test_set_get(char *buf, int len)
{
- Ewl_Widget *o;
- unsigned int p;
- int ret = 0;
+ Ewl_Widget *o;
+ unsigned int p;
+ int ret = 0;
- o = ewl_image_new();
- ewl_image_proportional_set(EWL_IMAGE(o), TRUE);
- p = ewl_image_proportional_get(EWL_IMAGE(o));
+ o = ewl_image_new();
+ ewl_image_proportional_set(EWL_IMAGE(o), TRUE);
+ p = ewl_image_proportional_get(EWL_IMAGE(o));
- if (p != TRUE)
- LOG_FAILURE(buf, len, "proportional_get did not match set.");
- else
- ret = 1;
+ if (p != TRUE)
+ LOG_FAILURE(buf, len, "proportional_get did not match set.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/image_thumbnail/ewl_image_thumbnail_test.c b/src/bin/tests/image_thumbnail/ewl_image_thumbnail_test.c
index 1c82824..cf8c6f1 100644
--- a/src/bin/tests/image_thumbnail/ewl_image_thumbnail_test.c
+++ b/src/bin/tests/image_thumbnail/ewl_image_thumbnail_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_image.h"
@@ -16,57 +16,57 @@ static int create_test(Ewl_Container *box);
void
test_info(Ewl_Test *test)
{
- test->name = "Image Thumbnail";
- test->tip = "Provides a widget for displaying\n"
- "thumbnails of images.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Image Thumbnail";
+ test->tip = "Provides a widget for displaying\n"
+ "thumbnails of images.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
int
create_test(Ewl_Container *box)
{
- Ewl_Widget *image;
- Ewl_Widget *thumb;
- Ewl_Widget *image_box;
- char *image_file = NULL;
- char *icon_file = NULL;
+ Ewl_Widget *image;
+ Ewl_Widget *thumb;
+ Ewl_Widget *image_box;
+ char *image_file = NULL;
+ char *icon_file = NULL;
- image_box = EWL_WIDGET(box);
+ image_box = EWL_WIDGET(box);
- if ((ecore_file_exists(PACKAGE_DATA_DIR "/ewl/images/e-logo.png")) != -1)
- image_file = strdup(PACKAGE_DATA_DIR "/ewl/images/e-logo.png");
- else if ((ecore_file_exists(PACKAGE_SOURCE_DIR "/data/images/e-logo.png")) != -1)
- image_file = strdup(PACKAGE_SOURCE_DIR "/data/images/e-logo.png");
- else if ((ecore_file_exists("./data/images/e-logo.png")) != -1)
- image_file = strdup("./data/images/e-logo.png");
- else if ((ecore_file_exists("../data/images/e-logo.png")) != -1)
- image_file = strdup("../data/images/e-logo.png");
+ if ((ecore_file_exists(PACKAGE_DATA_DIR "/ewl/images/e-logo.png")) != -1)
+ image_file = strdup(PACKAGE_DATA_DIR "/ewl/images/e-logo.png");
+ else if ((ecore_file_exists(PACKAGE_SOURCE_DIR "/data/images/e-logo.png")) != -1)
+ image_file = strdup(PACKAGE_SOURCE_DIR "/data/images/e-logo.png");
+ else if ((ecore_file_exists("./data/images/e-logo.png")) != -1)
+ image_file = strdup("./data/images/e-logo.png");
+ else if ((ecore_file_exists("../data/images/e-logo.png")) != -1)
+ image_file = strdup("../data/images/e-logo.png");
- image = ewl_image_new();
- ewl_image_file_set(EWL_IMAGE(image), image_file, NULL);
- ewl_object_padding_set(EWL_OBJECT(image), 0, 0, 5, 0);
- ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(image_box), image);
- ewl_widget_show(image);
+ image = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(image), image_file, NULL);
+ ewl_object_padding_set(EWL_OBJECT(image), 0, 0, 5, 0);
+ ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(image_box), image);
+ ewl_widget_show(image);
- if ((ecore_file_exists(PACKAGE_DATA_DIR "/ewl/images/Draw.png")) != -1)
- icon_file = strdup(PACKAGE_DATA_DIR "/ewl/images/Draw.png");
- else if ((ecore_file_exists(PACKAGE_SOURCE_DIR "/data/images/Draw.png")) != -1)
- icon_file = strdup(PACKAGE_SOURCE_DIR "/data/images/Draw.png");
- else if ((ecore_file_exists("./data/images/Draw.png")) != -1)
- icon_file = strdup("./data/images/Draw.png");
- else if ((ecore_file_exists("../data/images/Draw.png")) != -1)
- icon_file = strdup("../data/images/Draw.png");
+ if ((ecore_file_exists(PACKAGE_DATA_DIR "/ewl/images/Draw.png")) != -1)
+ icon_file = strdup(PACKAGE_DATA_DIR "/ewl/images/Draw.png");
+ else if ((ecore_file_exists(PACKAGE_SOURCE_DIR "/data/images/Draw.png")) != -1)
+ icon_file = strdup(PACKAGE_SOURCE_DIR "/data/images/Draw.png");
+ else if ((ecore_file_exists("./data/images/Draw.png")) != -1)
+ icon_file = strdup("./data/images/Draw.png");
+ else if ((ecore_file_exists("../data/images/Draw.png")) != -1)
+ icon_file = strdup("../data/images/Draw.png");
- thumb = ewl_image_thumbnail_get(EWL_IMAGE(image));
- ewl_image_constrain_set(EWL_IMAGE(thumb), 32);
- if (icon_file)
- ewl_image_file_path_set(EWL_IMAGE(thumb), icon_file);
- ewl_container_child_append(EWL_CONTAINER(image_box), thumb);
- ewl_widget_show(thumb);
+ thumb = ewl_image_thumbnail_get(EWL_IMAGE(image));
+ ewl_image_constrain_set(EWL_IMAGE(thumb), 32);
+ if (icon_file)
+ ewl_image_file_path_set(EWL_IMAGE(thumb), icon_file);
+ ewl_container_child_append(EWL_CONTAINER(image_box), thumb);
+ ewl_widget_show(thumb);
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/io_manager/ewl_io_manager_test.c b/src/bin/tests/io_manager/ewl_io_manager_test.c
index 947f563..48e0aef 100644
--- a/src/bin/tests/io_manager/ewl_io_manager_test.c
+++ b/src/bin/tests/io_manager/ewl_io_manager_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -20,89 +20,89 @@ static void cb_fd_delete(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "IO Manager";
- test->tip = "Defines a system for doing IO of URIs";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "IO Manager";
+ test->tip = "Defines a system for doing IO of URIs";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o, *o2;
+ Ewl_Widget *o, *o2;
- o2 = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o2), EWL_STOCK_OPEN);
- ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_clicked, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(box, o2);
- ewl_widget_show(o2);
+ o2 = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o2), EWL_STOCK_OPEN);
+ ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_clicked, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(box, o2);
+ ewl_widget_show(o2);
- o = ewl_scrollpane_new();
- ewl_container_child_append(box, o);
- ewl_widget_name_set(o, "scroll");
- ewl_widget_show(o);
+ o = ewl_scrollpane_new();
+ ewl_container_child_append(box, o);
+ ewl_widget_name_set(o, "scroll");
+ ewl_widget_show(o);
- return 1;
+ return 1;
}
static void
cb_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *fd;
- Ecore_List *filters;
-
- filters = ecore_list_new();
- ecore_list_append(filters, strdup("image/jpeg"));
- ecore_list_append(filters, strdup("image/png"));
- ecore_list_append(filters, strdup("image/gif"));
-
- fd = ewl_filedialog_new();
- ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "txt", "*.txt", NULL);
- ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "Images", NULL, filters);
- ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW, cb_fd_delete, NULL);
- ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, cb_open, NULL);
- ewl_widget_show(fd);
+ Ewl_Widget *fd;
+ Ecore_List *filters;
+
+ filters = ecore_list_new();
+ ecore_list_append(filters, strdup("image/jpeg"));
+ ecore_list_append(filters, strdup("image/png"));
+ ecore_list_append(filters, strdup("image/gif"));
+
+ fd = ewl_filedialog_new();
+ ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "txt", "*.txt", NULL);
+ ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "Images", NULL, filters);
+ ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW, cb_fd_delete, NULL);
+ ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, cb_open, NULL);
+ ewl_widget_show(fd);
}
static void
cb_fd_delete(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
}
static void
cb_open(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
- Ewl_Event_Action_Response *e;
- Ewl_Filedialog *fd;
- Ewl_Widget *scroll, *t;
- char *s;
+ Ewl_Event_Action_Response *e;
+ Ewl_Filedialog *fd;
+ Ewl_Widget *scroll, *t;
+ char *s;
- e = ev;
+ e = ev;
- if (e->response == EWL_STOCK_CANCEL)
- return;
+ if (e->response == EWL_STOCK_CANCEL)
+ return;
- fd = EWL_FILEDIALOG(w);
- s = ewl_filedialog_selected_file_get(fd);
- ewl_widget_destroy(w);
+ fd = EWL_FILEDIALOG(w);
+ s = ewl_filedialog_selected_file_get(fd);
+ ewl_widget_destroy(w);
- scroll = ewl_widget_name_find("scroll");
- ewl_container_reset(EWL_CONTAINER(scroll));
+ scroll = ewl_widget_name_find("scroll");
+ ewl_container_reset(EWL_CONTAINER(scroll));
- t = ewl_io_manager_uri_read(s);
- if (!t)
- {
- printf("Unable to create widget from file (%s)\n", s);
- return;
- }
- ewl_container_child_append(EWL_CONTAINER(scroll), t);
- ewl_widget_show(t);
+ t = ewl_io_manager_uri_read(s);
+ if (!t)
+ {
+ printf("Unable to create widget from file (%s)\n", s);
+ return;
+ }
+ ewl_container_child_append(EWL_CONTAINER(scroll), t);
+ ewl_widget_show(t);
- free(s);
+ free(s);
}
diff --git a/src/bin/tests/kinetic_scrollpane/ewl_kinetic_scrollpane_test.c b/src/bin/tests/kinetic_scrollpane/ewl_kinetic_scrollpane_test.c
index 7b3118b..bc283e1 100644
--- a/src/bin/tests/kinetic_scrollpane/ewl_kinetic_scrollpane_test.c
+++ b/src/bin/tests/kinetic_scrollpane/ewl_kinetic_scrollpane_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_tree.h"
@@ -21,206 +21,206 @@ static int kinetic_vmin_get(char *buf, int len);
static int kinetic_fps_get(char *buf, int len);
static Ewl_Unit_Test kinetic_tree_unit_tests[] = {
- {"get type of scrolling", scroll_type_get, NULL, -1, 0},
- {"get kinetic dampning", kinetic_dampen_get, NULL, -1, 0},
- {"get maximum kinetic velocity", kinetic_vmax_get, NULL, -1, 0},
- {"get minimum kinetic velocity", kinetic_vmin_get, NULL, -1, 0},
- {"get kinetic fps", kinetic_fps_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
+ {"get type of scrolling", scroll_type_get, NULL, -1, 0},
+ {"get kinetic dampning", kinetic_dampen_get, NULL, -1, 0},
+ {"get maximum kinetic velocity", kinetic_vmax_get, NULL, -1, 0},
+ {"get minimum kinetic velocity", kinetic_vmin_get, NULL, -1, 0},
+ {"get kinetic fps", kinetic_fps_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
};
void
test_info(Ewl_Test *test)
{
- test->name = "Kinetic Scrollpane";
- test->tip = "A kinetic scrollpane";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
- test->unit_tests = kinetic_tree_unit_tests;
+ test->name = "Kinetic Scrollpane";
+ test->tip = "A kinetic scrollpane";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
+ test->unit_tests = kinetic_tree_unit_tests;
}
static void destroy_test(Ewl_Widget *w, void *ev, void *data)
{
- ecore_list_destroy(data);
+ ecore_list_destroy(data);
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *tree, *o, *c;
- Ewl_Model *model;
- Ewl_View *view;
- Ecore_List *data;
- int i;
-
- data = ecore_list_new();
- ecore_list_free_cb_set(data, ECORE_FREE_CB(free));
- ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_DESTROY, destroy_test, data);
- for (i = 0; i < 500; i++)
- {
- char text[10];
-
- snprintf(text, sizeof(text), "Row: %d", i);
- ecore_list_append(data, strdup(text));
- }
-
- c = ewl_vpaned_new();
- ewl_container_child_append(box, c);
- ewl_widget_show(c);
-
- model = ewl_model_ecore_list_instance();
- view = ewl_label_view_get();
-
- o = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o), "Normal Scrolling");
- ewl_container_child_append(EWL_CONTAINER(c), o);
- ewl_widget_show(o);
-
- tree = ewl_tree_new();
- ewl_tree_headers_visible_set(EWL_TREE(tree), FALSE);
- ewl_tree_fixed_rows_set(EWL_TREE(tree), TRUE);
- ewl_tree_kinetic_scrolling_set(EWL_TREE(tree), EWL_KINETIC_SCROLL_NORMAL);
- ewl_tree_kinetic_fps_set(EWL_TREE(tree), 30);
- ewl_tree_column_count_set(EWL_TREE(tree), 1);
- ewl_mvc_model_set(EWL_MVC(tree), model);
- ewl_mvc_view_set(EWL_MVC(tree), view);
- ewl_mvc_data_set(EWL_MVC(tree), data);
- ewl_container_child_append(EWL_CONTAINER(o), tree);
- ewl_widget_show(tree);
-
- o = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o), "Embeded Type Scrolling");
- ewl_container_child_append(EWL_CONTAINER(c), o);
- ewl_widget_show(o);
-
- tree = ewl_tree_new();
- ewl_tree_headers_visible_set(EWL_TREE(tree), FALSE);
- ewl_tree_fixed_rows_set(EWL_TREE(tree), TRUE);
- ewl_tree_kinetic_scrolling_set(EWL_TREE(tree), EWL_KINETIC_SCROLL_EMBEDDED);
- ewl_tree_kinetic_fps_set(EWL_TREE(tree), 30);
- ewl_tree_kinetic_dampen_set(EWL_TREE(tree), 0.99);
- ewl_tree_column_count_set(EWL_TREE(tree), 1);
- ewl_mvc_model_set(EWL_MVC(tree), model);
- ewl_mvc_view_set(EWL_MVC(tree), view);
- ewl_mvc_data_set(EWL_MVC(tree), data);
- ewl_container_child_append(EWL_CONTAINER(o), tree);
- ewl_widget_show(tree);
-
- return 1;
+ Ewl_Widget *tree, *o, *c;
+ Ewl_Model *model;
+ Ewl_View *view;
+ Ecore_List *data;
+ int i;
+
+ data = ecore_list_new();
+ ecore_list_free_cb_set(data, ECORE_FREE_CB(free));
+ ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_DESTROY, destroy_test, data);
+ for (i = 0; i < 500; i++)
+ {
+ char text[10];
+
+ snprintf(text, sizeof(text), "Row: %d", i);
+ ecore_list_append(data, strdup(text));
+ }
+
+ c = ewl_vpaned_new();
+ ewl_container_child_append(box, c);
+ ewl_widget_show(c);
+
+ model = ewl_model_ecore_list_instance();
+ view = ewl_label_view_get();
+
+ o = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o), "Normal Scrolling");
+ ewl_container_child_append(EWL_CONTAINER(c), o);
+ ewl_widget_show(o);
+
+ tree = ewl_tree_new();
+ ewl_tree_headers_visible_set(EWL_TREE(tree), FALSE);
+ ewl_tree_fixed_rows_set(EWL_TREE(tree), TRUE);
+ ewl_tree_kinetic_scrolling_set(EWL_TREE(tree), EWL_KINETIC_SCROLL_NORMAL);
+ ewl_tree_kinetic_fps_set(EWL_TREE(tree), 30);
+ ewl_tree_column_count_set(EWL_TREE(tree), 1);
+ ewl_mvc_model_set(EWL_MVC(tree), model);
+ ewl_mvc_view_set(EWL_MVC(tree), view);
+ ewl_mvc_data_set(EWL_MVC(tree), data);
+ ewl_container_child_append(EWL_CONTAINER(o), tree);
+ ewl_widget_show(tree);
+
+ o = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o), "Embeded Type Scrolling");
+ ewl_container_child_append(EWL_CONTAINER(c), o);
+ ewl_widget_show(o);
+
+ tree = ewl_tree_new();
+ ewl_tree_headers_visible_set(EWL_TREE(tree), FALSE);
+ ewl_tree_fixed_rows_set(EWL_TREE(tree), TRUE);
+ ewl_tree_kinetic_scrolling_set(EWL_TREE(tree), EWL_KINETIC_SCROLL_EMBEDDED);
+ ewl_tree_kinetic_fps_set(EWL_TREE(tree), 30);
+ ewl_tree_kinetic_dampen_set(EWL_TREE(tree), 0.99);
+ ewl_tree_column_count_set(EWL_TREE(tree), 1);
+ ewl_mvc_model_set(EWL_MVC(tree), model);
+ ewl_mvc_view_set(EWL_MVC(tree), view);
+ ewl_mvc_data_set(EWL_MVC(tree), data);
+ ewl_container_child_append(EWL_CONTAINER(o), tree);
+ ewl_widget_show(tree);
+
+ return 1;
}
static int
scroll_type_get(char *buf, int len)
{
- Ewl_Widget *tree;
- Ewl_Kinetic_Scroll type;
- int ret = 1;
+ Ewl_Widget *tree;
+ Ewl_Kinetic_Scroll type;
+ int ret = 1;
- tree = ewl_tree_new();
- ewl_tree_kinetic_scrolling_set(EWL_TREE(tree),
- EWL_KINETIC_SCROLL_NORMAL);
- type = ewl_tree_kinetic_scrolling_get(EWL_TREE(tree));
+ tree = ewl_tree_new();
+ ewl_tree_kinetic_scrolling_set(EWL_TREE(tree),
+ EWL_KINETIC_SCROLL_NORMAL);
+ type = ewl_tree_kinetic_scrolling_get(EWL_TREE(tree));
- if (type != EWL_KINETIC_SCROLL_NORMAL)
- {
- LOG_FAILURE(buf, len, "get type is different from the set one");
- ret = 0;
- }
+ if (type != EWL_KINETIC_SCROLL_NORMAL)
+ {
+ LOG_FAILURE(buf, len, "get type is different from the set one");
+ ret = 0;
+ }
- ewl_widget_destroy(tree);
+ ewl_widget_destroy(tree);
- return ret;
+ return ret;
}
static int
kinetic_dampen_get(char *buf, int len)
{
- Ewl_Widget *tree;
- double val, set;
- int ret = 1;
-
- set = 0.06;
- tree = ewl_tree_new();
- ewl_tree_kinetic_dampen_set(EWL_TREE(tree), set);
- val = ewl_tree_kinetic_dampen_get(EWL_TREE(tree));
-
- if (val != set)
- {
- LOG_FAILURE(buf, len, "get dampen is different from the set dampen");
- ret = 0;
- }
-
- ewl_widget_destroy(tree);
-
- return ret;
+ Ewl_Widget *tree;
+ double val, set;
+ int ret = 1;
+
+ set = 0.06;
+ tree = ewl_tree_new();
+ ewl_tree_kinetic_dampen_set(EWL_TREE(tree), set);
+ val = ewl_tree_kinetic_dampen_get(EWL_TREE(tree));
+
+ if (val != set)
+ {
+ LOG_FAILURE(buf, len, "get dampen is different from the set dampen");
+ ret = 0;
+ }
+
+ ewl_widget_destroy(tree);
+
+ return ret;
}
static int
kinetic_vmax_get(char *buf, int len)
{
- Ewl_Widget *tree;
- double val, set;
- int ret = 1;
+ Ewl_Widget *tree;
+ double val, set;
+ int ret = 1;
- set = 27;
- tree = ewl_tree_new();
- ewl_tree_kinetic_max_velocity_set(EWL_TREE(tree), set);
- val = ewl_tree_kinetic_max_velocity_get(EWL_TREE(tree));
+ set = 27;
+ tree = ewl_tree_new();
+ ewl_tree_kinetic_max_velocity_set(EWL_TREE(tree), set);
+ val = ewl_tree_kinetic_max_velocity_get(EWL_TREE(tree));
- if (val != set)
- {
- LOG_FAILURE(buf, len, "get vmax is different from the set vmax");
- ret = 0;
- }
+ if (val != set)
+ {
+ LOG_FAILURE(buf, len, "get vmax is different from the set vmax");
+ ret = 0;
+ }
- ewl_widget_destroy(tree);
+ ewl_widget_destroy(tree);
- return ret;
+ return ret;
}
static int
kinetic_vmin_get(char *buf, int len)
{
- Ewl_Widget *tree;
- double val, set;
- int ret = 1;
+ Ewl_Widget *tree;
+ double val, set;
+ int ret = 1;
- set = 13;
- tree = ewl_tree_new();
- ewl_tree_kinetic_min_velocity_set(EWL_TREE(tree), set);
- val = ewl_tree_kinetic_min_velocity_get(EWL_TREE(tree));
+ set = 13;
+ tree = ewl_tree_new();
+ ewl_tree_kinetic_min_velocity_set(EWL_TREE(tree), set);
+ val = ewl_tree_kinetic_min_velocity_get(EWL_TREE(tree));
- if (val != set)
- {
- LOG_FAILURE(buf, len, "get vmin is different from the set vmin");
- ret = 0;
- }
+ if (val != set)
+ {
+ LOG_FAILURE(buf, len, "get vmin is different from the set vmin");
+ ret = 0;
+ }
- ewl_widget_destroy(tree);
+ ewl_widget_destroy(tree);
- return ret;
+ return ret;
}
static int
kinetic_fps_get(char *buf, int len)
{
- Ewl_Widget *tree;
- int val;
- int ret = 1;
+ Ewl_Widget *tree;
+ int val;
+ int ret = 1;
- tree = ewl_tree_new();
- ewl_tree_kinetic_fps_set(EWL_TREE(tree), 3);
- val = ewl_tree_kinetic_fps_get(EWL_TREE(tree));
+ tree = ewl_tree_new();
+ ewl_tree_kinetic_fps_set(EWL_TREE(tree), 3);
+ val = ewl_tree_kinetic_fps_get(EWL_TREE(tree));
- if (val != 3)
- {
- LOG_FAILURE(buf, len, "get fps is different from the set fps");
- ret = 0;
- }
+ if (val != 3)
+ {
+ LOG_FAILURE(buf, len, "get fps is different from the set fps");
+ ret = 0;
+ }
- ewl_widget_destroy(tree);
+ ewl_widget_destroy(tree);
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/label/ewl_label_test.c b/src/bin/tests/label/ewl_label_test.c
index b9d5b74..a94748b 100644
--- a/src/bin/tests/label/ewl_label_test.c
+++ b/src/bin/tests/label/ewl_label_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_button.h"
@@ -16,117 +16,117 @@ static int label_null_test_set_get(char *buf, int len);
static int label_test_set_get(char *buf, int len);
static Ewl_Unit_Test label_unit_tests[] = {
- {"label null get", label_null_test_get, NULL, -1, 0},
- {"label null set/get", label_null_test_set_get, NULL, -1, 0},
- {"label set/get", label_test_set_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"label null get", label_null_test_get, NULL, -1, 0},
+ {"label null set/get", label_null_test_set_get, NULL, -1, 0},
+ {"label set/get", label_test_set_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Label";
- test->tip = "Defines a widget for displaying a label";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
- test->unit_tests = label_unit_tests;
+ test->name = "Label";
+ test->tip = "Defines a widget for displaying a label";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
+ test->unit_tests = label_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *body, *o2, *o;
+ Ewl_Widget *body, *o2, *o;
- body = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), body);
- ewl_widget_show(body);
+ body = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), body);
+ ewl_widget_show(body);
- o = ewl_label_new();
- ewl_container_child_append(EWL_CONTAINER(body), o);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_label_text_set(EWL_LABEL(o), "First label");
- ewl_widget_show(o);
+ o = ewl_label_new();
+ ewl_container_child_append(EWL_CONTAINER(body), o);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_label_text_set(EWL_LABEL(o), "First label");
+ ewl_widget_show(o);
- o2 = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o2), "Change Label");
- ewl_container_child_append(EWL_CONTAINER(body), o2);
- ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_click, o);
- ewl_widget_show(o2);
+ o2 = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o2), "Change Label");
+ ewl_container_child_append(EWL_CONTAINER(body), o2);
+ ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_click, o);
+ ewl_widget_show(o2);
- return 1;
+ return 1;
}
void
cb_click(Ewl_Widget *w __UNUSED__, void *e __UNUSED__, void *data)
{
- if ((counter % 2) == 0)
- ewl_label_text_set(EWL_LABEL(data), "Second Label");
- else
- ewl_label_text_set(EWL_LABEL(data), "First label");
+ if ((counter % 2) == 0)
+ ewl_label_text_set(EWL_LABEL(data), "Second Label");
+ else
+ ewl_label_text_set(EWL_LABEL(data), "First label");
- counter ++;
+ counter ++;
}
static int
label_null_test_get(char *buf, int len)
{
- Ewl_Widget *label;
- int ret = 0;
+ Ewl_Widget *label;
+ int ret = 0;
- label = ewl_label_new();
+ label = ewl_label_new();
- if (ewl_label_text_get(EWL_LABEL(label)))
- LOG_FAILURE(buf, len, "text_get not NULL");
- else
- ret = 1;
+ if (ewl_label_text_get(EWL_LABEL(label)))
+ LOG_FAILURE(buf, len, "text_get not NULL");
+ else
+ ret = 1;
- ewl_widget_destroy(label);
+ ewl_widget_destroy(label);
- return ret;
+ return ret;
}
static int
label_null_test_set_get(char *buf, int len)
{
- Ewl_Widget *label;
- const char *val;
- int ret = 0;
+ Ewl_Widget *label;
+ const char *val;
+ int ret = 0;
- label = ewl_label_new();
+ label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(label), "some text");
- ewl_label_text_set(EWL_LABEL(label), NULL);
+ ewl_label_text_set(EWL_LABEL(label), "some text");
+ ewl_label_text_set(EWL_LABEL(label), NULL);
- val = ewl_label_text_get(EWL_LABEL(label));
- if (val)
- LOG_FAILURE(buf, len, "text_set_get %s instead of NULL", val);
- else
- ret = 1;
+ val = ewl_label_text_get(EWL_LABEL(label));
+ if (val)
+ LOG_FAILURE(buf, len, "text_set_get %s instead of NULL", val);
+ else
+ ret = 1;
- ewl_widget_destroy(label);
+ ewl_widget_destroy(label);
- return ret;
+ return ret;
}
static int
label_test_set_get(char *buf, int len)
{
- Ewl_Widget *label;
- const char *val;
- int ret = 0;
+ Ewl_Widget *label;
+ const char *val;
+ int ret = 0;
- label = ewl_label_new();
+ label = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(label), "some text");
+ ewl_label_text_set(EWL_LABEL(label), "some text");
- val = ewl_label_text_get(EWL_LABEL(label));
- if (strcmp(val, "some text"))
- LOG_FAILURE(buf, len, "%s is not 'some text'", val);
- else
- ret = 1;
+ val = ewl_label_text_get(EWL_LABEL(label));
+ if (strcmp(val, "some text"))
+ LOG_FAILURE(buf, len, "%s is not 'some text'", val);
+ else
+ ret = 1;
- ewl_widget_destroy(label);
+ ewl_widget_destroy(label);
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/layer/ewl_layer_test.c b/src/bin/tests/layer/ewl_layer_test.c
index 271fe1c..8e1b2e2 100644
--- a/src/bin/tests/layer/ewl_layer_test.c
+++ b/src/bin/tests/layer/ewl_layer_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_overlay.h"
@@ -16,11 +16,11 @@ static void configure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
void
test_info(Ewl_Test *test)
{
- test->name = "Layer";
- test->tip = "sets the layer of a widget";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_MISC;
+ test->name = "Layer";
+ test->tip = "sets the layer of a widget";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_MISC;
}
static Ewl_Widget * button_row1[20];
@@ -30,142 +30,142 @@ static Ewl_Widget * dbutton[2];
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *w, *c, *spec;
- int i;
-
- /*
- * Create the overlay container
- */
- c = ewl_overlay_new();
- ewl_container_child_append(EWL_CONTAINER(box), c);
- ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_FILL);
- ewl_widget_show(c);
-
- /*
- * Create the spectrum
- */
- w = ewl_spectrum_new();
- ewl_container_child_append(EWL_CONTAINER(c), w);
- ewl_widget_layer_priority_set(w, 0);
- spec = w;
-
- /*
- * And now create the first row of buttons
- */
- for (i = 0; i < 20; i++) {
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "Hide");
- ewl_container_child_append(EWL_CONTAINER(c), w);
- ewl_widget_layer_priority_set(w, i - 10);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- spectrum_hide, spec);
- ewl_widget_show(w);
-
- button_row1[i] = w;
- }
-
- /*
- * Create the second row
- */
- for (i = 0; i < 20; i++) {
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "Show");
- ewl_container_child_append(EWL_CONTAINER(c), w);
- ewl_widget_layer_priority_set(w, 10 - i);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- spectrum_show, spec);
- ewl_widget_show(w);
-
- button_row2[i] = w;
- }
-
- /*
- * the dynamicly layered button
- */
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "Up/Down");
- ewl_container_child_append(EWL_CONTAINER(c), w);
- ewl_widget_layer_priority_set(w, 3);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- layer_change, NULL);
- ewl_widget_show(w);
- dbutton[0] = w;
-
- /*
- * the disabled button
- */
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "Disabled");
- ewl_widget_layer_priority_set(w, 2);
- ewl_container_child_append(EWL_CONTAINER(c), w);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED);
- ewl_widget_show(w);
- dbutton[1] = w;
-
- ewl_callback_append(c, EWL_CALLBACK_CONFIGURE, configure_cb, NULL);
-
- return 1;
+ Ewl_Widget *w, *c, *spec;
+ int i;
+
+ /*
+ * Create the overlay container
+ */
+ c = ewl_overlay_new();
+ ewl_container_child_append(EWL_CONTAINER(box), c);
+ ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_FILL);
+ ewl_widget_show(c);
+
+ /*
+ * Create the spectrum
+ */
+ w = ewl_spectrum_new();
+ ewl_container_child_append(EWL_CONTAINER(c), w);
+ ewl_widget_layer_priority_set(w, 0);
+ spec = w;
+
+ /*
+ * And now create the first row of buttons
+ */
+ for (i = 0; i < 20; i++) {
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "Hide");
+ ewl_container_child_append(EWL_CONTAINER(c), w);
+ ewl_widget_layer_priority_set(w, i - 10);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ spectrum_hide, spec);
+ ewl_widget_show(w);
+
+ button_row1[i] = w;
+ }
+
+ /*
+ * Create the second row
+ */
+ for (i = 0; i < 20; i++) {
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "Show");
+ ewl_container_child_append(EWL_CONTAINER(c), w);
+ ewl_widget_layer_priority_set(w, 10 - i);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ spectrum_show, spec);
+ ewl_widget_show(w);
+
+ button_row2[i] = w;
+ }
+
+ /*
+ * the dynamicly layered button
+ */
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "Up/Down");
+ ewl_container_child_append(EWL_CONTAINER(c), w);
+ ewl_widget_layer_priority_set(w, 3);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ layer_change, NULL);
+ ewl_widget_show(w);
+ dbutton[0] = w;
+
+ /*
+ * the disabled button
+ */
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "Disabled");
+ ewl_widget_layer_priority_set(w, 2);
+ ewl_container_child_append(EWL_CONTAINER(c), w);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED);
+ ewl_widget_show(w);
+ dbutton[1] = w;
+
+ ewl_callback_append(c, EWL_CALLBACK_CONFIGURE, configure_cb, NULL);
+
+ return 1;
}
static void
spectrum_show(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Widget *spec;
+ Ewl_Widget *spec;
- spec = user_data;
- ewl_widget_show(spec);
- return;
+ spec = user_data;
+ ewl_widget_show(spec);
+ return;
}
static void
spectrum_hide(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__,
- void *user_data)
+ void *user_data)
{
- Ewl_Widget *spec;
+ Ewl_Widget *spec;
- spec = user_data;
- ewl_widget_hide(spec);
- return;
+ spec = user_data;
+ ewl_widget_hide(spec);
+ return;
}
static void
layer_change(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- if (ewl_widget_layer_priority_get(w) == 3)
- ewl_widget_layer_priority_set(w, 1);
- else
- ewl_widget_layer_priority_set(w, 3);
+ if (ewl_widget_layer_priority_get(w) == 3)
+ ewl_widget_layer_priority_set(w, 1);
+ else
+ ewl_widget_layer_priority_set(w, 3);
}
static void
configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
+ void *user_data __UNUSED__)
{
- int x, y;
- int i;
-
- x = CURRENT_X(w);
- y = CURRENT_Y(w);
- /*
- * place the first row of buttons
- */
- for (i = 0; i < 20; i++)
- ewl_object_position_request(EWL_OBJECT(button_row1[i]),
- i * 5 + x, i * 5 + y);
- /*
- * place the second row
- */
- for (i = 0; i < 20; i++)
- ewl_object_position_request(EWL_OBJECT(button_row2[i]),
- i * 5 + 40 + x, i * 5 + y);
-
- ewl_object_position_request(EWL_OBJECT(dbutton[0]), 180 + x, 0 + y);
- ewl_object_position_request(EWL_OBJECT(dbutton[1]), 220 + x, 20 + y);
+ int x, y;
+ int i;
+
+ x = CURRENT_X(w);
+ y = CURRENT_Y(w);
+ /*
+ * place the first row of buttons
+ */
+ for (i = 0; i < 20; i++)
+ ewl_object_position_request(EWL_OBJECT(button_row1[i]),
+ i * 5 + x, i * 5 + y);
+ /*
+ * place the second row
+ */
+ for (i = 0; i < 20; i++)
+ ewl_object_position_request(EWL_OBJECT(button_row2[i]),
+ i * 5 + 40 + x, i * 5 + y);
+
+ ewl_object_position_request(EWL_OBJECT(dbutton[0]), 180 + x, 0 + y);
+ ewl_object_position_request(EWL_OBJECT(dbutton[1]), 220 + x, 20 + y);
}
diff --git a/src/bin/tests/list/ewl_list_test.c b/src/bin/tests/list/ewl_list_test.c
index 3a8d856..aeda98b 100644
--- a/src/bin/tests/list/ewl_list_test.c
+++ b/src/bin/tests/list/ewl_list_test.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "Ewl_Test.h"
#include "ewl_test_private.h"
#include "ewl_border.h"
@@ -13,15 +13,15 @@
typedef struct List_Test_Row_Data List_Test_Row_Data;
struct List_Test_Row_Data
{
- char *image;
- char *text;
+ char *image;
+ char *text;
};
typedef struct List_Test_Data List_Test_Data;
struct List_Test_Data
{
- unsigned int count;
- List_Test_Row_Data **rows;
+ unsigned int count;
+ List_Test_Row_Data **rows;
};
static int create_test(Ewl_Container *win);
@@ -31,241 +31,241 @@ static void list_cb_value_changed(Ewl_Widget *w, void *ev, void *data);
static void list_cb_multi_value_changed(Ewl_Widget *w, void *ev, void *data);
static Ewl_Widget *list_test_cb_widget_fetch(void *data, unsigned int row,
- unsigned int col);
+ unsigned int col);
static void *list_test_data_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
static unsigned int list_test_data_count_get(void *data);
static void list_cb_select_none(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "List";
- test->tip = "Defines a widget for laying out other\n"
- "widgets in a list like manner.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "List";
+ test->tip = "Defines a widget for laying out other\n"
+ "widgets in a list like manner.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ecore_List *str_data;
- Ewl_Widget *list, *o;
- Ewl_Model *model;
- Ewl_View *view;
- void *data;
-
- /* create a list using an ecore_list of strings of labels */
- o = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o), "Label List (single select)");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- str_data = ecore_list_new();
- ecore_list_append(str_data, "first");
- ecore_list_append(str_data, "second");
- ecore_list_append(str_data, "third");
- ecore_list_append(str_data, "fourth");
-
- model = ewl_model_ecore_list_instance();
- view = ewl_label_view_get();
-
- list = ewl_list_new();
- ewl_container_child_append(EWL_CONTAINER(o), list);
- ewl_box_orientation_set(EWL_BOX(list), EWL_ORIENTATION_HORIZONTAL);
- ewl_mvc_model_set(EWL_MVC(list), model);
- ewl_mvc_view_set(EWL_MVC(list), view);
- ewl_mvc_data_set(EWL_MVC(list), str_data);
- ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
- list_cb_value_changed, NULL);
- ewl_widget_show(list);
-
- /* create a list using an ecore_list of strings of labels */
- o = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o), "Label List (multi select)");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- list = ewl_list_new();
- ewl_container_child_append(EWL_CONTAINER(o), list);
- ewl_box_orientation_set(EWL_BOX(list), EWL_ORIENTATION_HORIZONTAL);
- ewl_mvc_model_set(EWL_MVC(list), model);
- ewl_mvc_view_set(EWL_MVC(list), view);
- ewl_mvc_data_set(EWL_MVC(list), str_data);
- ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_MULTI);
- ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
- list_cb_multi_value_changed, NULL);
- ewl_widget_show(list);
-
- /* Create a list from a custom array with a custom assign on the
- * view */
- o = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(o), "Custom List");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- model = ewl_model_new();
- ewl_model_data_fetch_set(model, list_test_data_fetch);
- ewl_model_data_count_set(model, list_test_data_count_get);
-
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, list_test_cb_widget_fetch);
- ewl_view_header_fetch_set(view, NULL);
-
- data = list_test_data_setup();
-
- list = ewl_list_new();
- ewl_container_child_append(EWL_CONTAINER(o), list);
- ewl_mvc_model_set(EWL_MVC(list), model);
- ewl_mvc_view_set(EWL_MVC(list), view);
- ewl_mvc_data_set(EWL_MVC(list), data);
- ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_NONE);
- ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
- list_cb_select_none, NULL);
- ewl_widget_show(list);
-
-
- return 1;
+ Ecore_List *str_data;
+ Ewl_Widget *list, *o;
+ Ewl_Model *model;
+ Ewl_View *view;
+ void *data;
+
+ /* create a list using an ecore_list of strings of labels */
+ o = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o), "Label List (single select)");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ str_data = ecore_list_new();
+ ecore_list_append(str_data, "first");
+ ecore_list_append(str_data, "second");
+ ecore_list_append(str_data, "third");
+ ecore_list_append(str_data, "fourth");
+
+ model = ewl_model_ecore_list_instance();
+ view = ewl_label_view_get();
+
+ list = ewl_list_new();
+ ewl_container_child_append(EWL_CONTAINER(o), list);
+ ewl_box_orientation_set(EWL_BOX(list), EWL_ORIENTATION_HORIZONTAL);
+ ewl_mvc_model_set(EWL_MVC(list), model);
+ ewl_mvc_view_set(EWL_MVC(list), view);
+ ewl_mvc_data_set(EWL_MVC(list), str_data);
+ ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
+ list_cb_value_changed, NULL);
+ ewl_widget_show(list);
+
+ /* create a list using an ecore_list of strings of labels */
+ o = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o), "Label List (multi select)");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ list = ewl_list_new();
+ ewl_container_child_append(EWL_CONTAINER(o), list);
+ ewl_box_orientation_set(EWL_BOX(list), EWL_ORIENTATION_HORIZONTAL);
+ ewl_mvc_model_set(EWL_MVC(list), model);
+ ewl_mvc_view_set(EWL_MVC(list), view);
+ ewl_mvc_data_set(EWL_MVC(list), str_data);
+ ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_MULTI);
+ ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
+ list_cb_multi_value_changed, NULL);
+ ewl_widget_show(list);
+
+ /* Create a list from a custom array with a custom assign on the
+ * view */
+ o = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(o), "Custom List");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ model = ewl_model_new();
+ ewl_model_data_fetch_set(model, list_test_data_fetch);
+ ewl_model_data_count_set(model, list_test_data_count_get);
+
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, list_test_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, NULL);
+
+ data = list_test_data_setup();
+
+ list = ewl_list_new();
+ ewl_container_child_append(EWL_CONTAINER(o), list);
+ ewl_mvc_model_set(EWL_MVC(list), model);
+ ewl_mvc_view_set(EWL_MVC(list), view);
+ ewl_mvc_data_set(EWL_MVC(list), data);
+ ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_NONE);
+ ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
+ list_cb_select_none, NULL);
+ ewl_widget_show(list);
+
+
+ return 1;
}
static void *
list_test_data_setup(void)
{
- List_Test_Data *data;
+ List_Test_Data *data;
- data = calloc(1, sizeof(List_Test_Data));
- data->rows = calloc(3, sizeof(List_Test_Row_Data *));
+ data = calloc(1, sizeof(List_Test_Data));
+ data->rows = calloc(3, sizeof(List_Test_Row_Data *));
- data->rows[0] = calloc(1, sizeof(List_Test_Row_Data));
- data->rows[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- data->rows[0]->text = strdup("The E logo");
+ data->rows[0] = calloc(1, sizeof(List_Test_Row_Data));
+ data->rows[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ data->rows[0]->text = strdup("The E logo");
- data->rows[1] = calloc(1, sizeof(List_Test_Row_Data));
- data->rows[1]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/entice.png");
- data->rows[1]->text = strdup("The Entice image");
+ data->rows[1] = calloc(1, sizeof(List_Test_Row_Data));
+ data->rows[1]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/entice.png");
+ data->rows[1]->text = strdup("The Entice image");
- data->rows[2] = calloc(1, sizeof(List_Test_Row_Data));
- data->rows[2]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/entrance.png");
- data->rows[2]->text = strdup("The Entrance image");
+ data->rows[2] = calloc(1, sizeof(List_Test_Row_Data));
+ data->rows[2]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/entrance.png");
+ data->rows[2]->text = strdup("The Entrance image");
- data->count = 3;
+ data->count = 3;
- return data;
+ return data;
}
static Ewl_Widget *
list_test_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int col __UNUSED__)
+ unsigned int col __UNUSED__)
{
- Ewl_Widget *w;
- List_Test_Row_Data *d;
+ Ewl_Widget *w;
+ List_Test_Row_Data *d;
- d = data;
+ d = data;
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), d->text);
- ewl_button_image_set(EWL_BUTTON(w), d->image, NULL);
- ewl_button_image_size_set(EWL_BUTTON(w), 24, 24);
- ewl_widget_show(w);
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), d->text);
+ ewl_button_image_set(EWL_BUTTON(w), d->image, NULL);
+ ewl_button_image_size_set(EWL_BUTTON(w), 24, 24);
+ ewl_widget_show(w);
- return w;
+ return w;
}
static void *
list_test_data_fetch(void *data, unsigned int row,
- unsigned int column __UNUSED__)
+ unsigned int column __UNUSED__)
{
- List_Test_Data *d;
+ List_Test_Data *d;
- d = data;
+ d = data;
- /* NOTE: this is just for testing purposes, should not be needed in a
- * normal app */
- if (row >= d->count)
- {
- printf("Asking for too many rows\n");
- return NULL;
- }
+ /* NOTE: this is just for testing purposes, should not be needed in a
+ * normal app */
+ if (row >= d->count)
+ {
+ printf("Asking for too many rows\n");
+ return NULL;
+ }
- return d->rows[row];
+ return d->rows[row];
}
static unsigned int
list_test_data_count_get(void *data)
{
- List_Test_Data *d;
+ List_Test_Data *d;
- d = data;
+ d = data;
- return d->count;
+ return d->count;
}
static void
list_cb_value_changed(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_List *list;
- Ecore_List *el;
- Ewl_Selection_Idx *idx;
+ Ewl_List *list;
+ Ecore_List *el;
+ Ewl_Selection_Idx *idx;
- list = EWL_LIST(w);
- el = ewl_mvc_data_get(EWL_MVC(list));
- idx = ewl_mvc_selected_get(EWL_MVC(list));
+ list = EWL_LIST(w);
+ el = ewl_mvc_data_get(EWL_MVC(list));
+ idx = ewl_mvc_selected_get(EWL_MVC(list));
- ecore_list_index_goto(el, idx->row);
- printf("Selected (%d) (%s)\n", idx->row,
- (char *)ecore_list_current(el));
+ ecore_list_index_goto(el, idx->row);
+ printf("Selected (%d) (%s)\n", idx->row,
+ (char *)ecore_list_current(el));
}
static void
list_cb_multi_value_changed(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ecore_List *selected, *el;
- Ewl_Selection *sel;
-
- printf("Selected:\n");
-
- el = ewl_mvc_data_get(EWL_MVC(w));
- selected = ewl_mvc_selected_list_get(EWL_MVC(w));
-
- ecore_list_first_goto(selected);
- while ((sel = ecore_list_next(selected)))
- {
- if (sel->type == EWL_SELECTION_TYPE_INDEX)
- {
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- ecore_list_index_goto(el, idx->row);
- printf(" %d (%s)\n", idx->row,
- (char *)ecore_list_current(el));
- }
- else
- {
- Ewl_Selection_Range *idx;
- unsigned int i;
-
- idx = EWL_SELECTION_RANGE(sel);
- for (i = idx->start.row; i <= idx->end.row; i++)
- {
- ecore_list_index_goto(el, i);
- printf(" %d (%s)\n", i,
- (char *)ecore_list_current(el));
- }
- }
- }
+ Ecore_List *selected, *el;
+ Ewl_Selection *sel;
+
+ printf("Selected:\n");
+
+ el = ewl_mvc_data_get(EWL_MVC(w));
+ selected = ewl_mvc_selected_list_get(EWL_MVC(w));
+
+ ecore_list_first_goto(selected);
+ while ((sel = ecore_list_next(selected)))
+ {
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ ecore_list_index_goto(el, idx->row);
+ printf(" %d (%s)\n", idx->row,
+ (char *)ecore_list_current(el));
+ }
+ else
+ {
+ Ewl_Selection_Range *idx;
+ unsigned int i;
+
+ idx = EWL_SELECTION_RANGE(sel);
+ for (i = idx->start.row; i <= idx->end.row; i++)
+ {
+ ecore_list_index_goto(el, i);
+ printf(" %d (%s)\n", i,
+ (char *)ecore_list_current(el));
+ }
+ }
+ }
}
static void
list_cb_select_none(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- printf("ERROR, shouldn't get selection changed callbacks.\n");
+ printf("ERROR, shouldn't get selection changed callbacks.\n");
}
--
Enlightenment DR17 toolkit based (based on the EFL)
More information about the Pkg-e-commits
mailing list