[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 6a8f811b408422c5cf1f01598f6dc92ad07e907d
Author: dj2 <dj2>
Date: Tue May 6 20:18:54 2008 +0000
- change tabs to spaces (Ewl uses 8 space indent now instead of a tab)
diff --git a/src/bin/tests/media/ewl_media_test.c b/src/bin/tests/media/ewl_media_test.c
index cb54820..8cf5d2d 100644
--- a/src/bin/tests/media/ewl_media_test.c
+++ b/src/bin/tests/media/ewl_media_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_filedialog.h"
@@ -20,8 +20,8 @@ static Ewl_Widget *video, *seeker, *fd_win;
static Ewl_Media_Module_Type module_type;
typedef struct {
- Ewl_Stock_Type name;
- Ewl_Callback_Function func;
+ Ewl_Stock_Type name;
+ Ewl_Callback_Function func;
} Ewl_Media_Test_Control;
static int create_test(Ewl_Container *box);
@@ -43,283 +43,283 @@ static void key_up_cb(Ewl_Widget *w, void *event, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Media";
- test->tip = "A widget to display media files.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Media";
+ test->tip = "A widget to display media files.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o, *o2;
-
- if (!ewl_media_is_available())
- {
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o),
- "Ewl_Media is not available. "
- "Please install Emotion "
- "and rebuild Ewl.");
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- return 1;
- }
-
- o = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(o), "Gstreamer");
- ewl_container_child_append(box, o);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- cb_gstreamer_change, NULL);
- ewl_widget_show(o);
-
- o2 = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(o2), "Xine");
- ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o2), EWL_RADIOBUTTON(o));
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o2), TRUE);
- ewl_container_child_append(box, o2);
- ewl_callback_append(o2, EWL_CALLBACK_VALUE_CHANGED,
- cb_xine_change, NULL);
- ewl_widget_show(o2);
-
- module_type = EWL_MEDIA_MODULE_XINE;
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Launch media test");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, cb_launch, NULL);
- ewl_container_child_append(box, o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *o, *o2;
+
+ if (!ewl_media_is_available())
+ {
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o),
+ "Ewl_Media is not available. "
+ "Please install Emotion "
+ "and rebuild Ewl.");
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ return 1;
+ }
+
+ o = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Gstreamer");
+ ewl_container_child_append(box, o);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ cb_gstreamer_change, NULL);
+ ewl_widget_show(o);
+
+ o2 = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(o2), "Xine");
+ ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o2), EWL_RADIOBUTTON(o));
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o2), TRUE);
+ ewl_container_child_append(box, o2);
+ ewl_callback_append(o2, EWL_CALLBACK_VALUE_CHANGED,
+ cb_xine_change, NULL);
+ ewl_widget_show(o2);
+
+ module_type = EWL_MEDIA_MODULE_XINE;
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Launch media test");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, cb_launch, NULL);
+ ewl_container_child_append(box, o);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
cb_gstreamer_change(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- module_type = EWL_MEDIA_MODULE_GSTREAMER;
+ module_type = EWL_MEDIA_MODULE_GSTREAMER;
}
static void
cb_xine_change(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- module_type = EWL_MEDIA_MODULE_XINE;
+ module_type = EWL_MEDIA_MODULE_XINE;
}
static void
cb_launch(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data __UNUSED__)
{
- create_media_window(module_type);
+ create_media_window(module_type);
}
static void
del_cb(Ewl_Widget *w, void *event __UNUSED__, void *data __UNUSED__)
{
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
}
static void
play_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_media_play_set(EWL_MEDIA(video), 1);
+ ewl_media_play_set(EWL_MEDIA(video), 1);
}
static void
stop_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_media_play_set(EWL_MEDIA(video), 0);
+ ewl_media_play_set(EWL_MEDIA(video), 0);
}
static void
ff_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- double p;
+ double p;
- p = ewl_media_position_get(EWL_MEDIA(video));
- ewl_media_position_set(EWL_MEDIA(video), p + 10.0);
+ p = ewl_media_position_get(EWL_MEDIA(video));
+ ewl_media_position_set(EWL_MEDIA(video), p + 10.0);
}
static void
rew_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- double p;
+ double p;
- p = ewl_media_position_get(EWL_MEDIA(video));
- ewl_media_position_set(EWL_MEDIA(video), p - 10.0);
+ p = ewl_media_position_get(EWL_MEDIA(video));
+ ewl_media_position_set(EWL_MEDIA(video), p - 10.0);
}
static void
video_change_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__, void *data)
{
- char buf[512];
- int h, m;
- double s;
- Ewl_Text *t;
- double pos;
-
- t = data;
- pos = ewl_media_position_get(EWL_MEDIA(video));
-
- ewl_range_value_set(EWL_RANGE(seeker), pos);
- ewl_media_position_time_get(EWL_MEDIA(video), &h, &m, &s);
- snprintf(buf, sizeof(buf), "%02i:%02i:%02.0f", h, m, s);
- ewl_text_text_set(t, buf);
+ char buf[512];
+ int h, m;
+ double s;
+ Ewl_Text *t;
+ double pos;
+
+ t = data;
+ pos = ewl_media_position_get(EWL_MEDIA(video));
+
+ ewl_range_value_set(EWL_RANGE(seeker), pos);
+ ewl_media_position_time_get(EWL_MEDIA(video), &h, &m, &s);
+ snprintf(buf, sizeof(buf), "%02i:%02i:%02.0f", h, m, s);
+ ewl_text_text_set(t, buf);
}
static void
seeker_move_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- double val;
+ double val;
- val = ewl_range_value_get(EWL_RANGE(seeker));
- if (ewl_media_seekable_get(EWL_MEDIA(video)))
- ewl_media_position_set(EWL_MEDIA(video), val);
+ val = ewl_range_value_get(EWL_RANGE(seeker));
+ if (ewl_media_seekable_get(EWL_MEDIA(video)))
+ ewl_media_position_set(EWL_MEDIA(video), val);
}
static void
open_file_cb(Ewl_Widget *w, void *event, void *data __UNUSED__)
{
- Ewl_Event_Action_Response *e;
+ Ewl_Event_Action_Response *e;
- ewl_widget_hide(fd_win);
+ ewl_widget_hide(fd_win);
- e = event;
- if (e->response == EWL_STOCK_OK)
- {
- int len;
- char *file = NULL;
+ e = event;
+ if (e->response == EWL_STOCK_OK)
+ {
+ int len;
+ char *file = NULL;
- file = ewl_filedialog_selected_file_get(EWL_FILEDIALOG(w));
- ewl_media_media_set(EWL_MEDIA(video), file);
- if (file) free(file);
+ file = ewl_filedialog_selected_file_get(EWL_FILEDIALOG(w));
+ ewl_media_media_set(EWL_MEDIA(video), file);
+ if (file) free(file);
- len = ewl_media_length_get(EWL_MEDIA(video));
- ewl_range_maximum_value_set(EWL_RANGE(seeker), len);
- }
+ len = ewl_media_length_get(EWL_MEDIA(video));
+ ewl_range_maximum_value_set(EWL_RANGE(seeker), len);
+ }
}
static void
open_cb(Ewl_Widget *w __UNUSED__, void *event __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- if (!fd_win)
- {
- fd_win = ewl_filedialog_new();
- ewl_callback_append(fd_win, EWL_CALLBACK_VALUE_CHANGED, open_file_cb, NULL);
- }
+ if (!fd_win)
+ {
+ fd_win = ewl_filedialog_new();
+ ewl_callback_append(fd_win, EWL_CALLBACK_VALUE_CHANGED, open_file_cb, NULL);
+ }
- ewl_widget_show(fd_win);
+ ewl_widget_show(fd_win);
}
static void
key_up_cb(Ewl_Widget *w, void *event, void *data)
{
- Ewl_Event_Key *e = event;
+ Ewl_Event_Key *e = event;
- if (!strcmp(e->keyname, "p"))
- ewl_media_play_set(EWL_MEDIA(video), 1);
+ if (!strcmp(e->keyname, "p"))
+ ewl_media_play_set(EWL_MEDIA(video), 1);
- else if (!strcmp(e->keyname, "s"))
- ewl_media_play_set(EWL_MEDIA(video), 0);
+ else if (!strcmp(e->keyname, "s"))
+ ewl_media_play_set(EWL_MEDIA(video), 0);
- else if (!strcmp(e->keyname, "q"))
- del_cb(w, event, data);
+ else if (!strcmp(e->keyname, "q"))
+ del_cb(w, event, data);
}
static void
create_media_window(Ewl_Media_Module_Type type)
{
- Ewl_Widget *win, *o = NULL, *b = NULL;
- Ewl_Widget *controls = NULL, *time = NULL;
-
- win = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(win), "EWL Media test");
- ewl_window_name_set(EWL_WINDOW(win), "EWL_Media_test");
- ewl_window_class_set(EWL_WINDOW(win), "EWL_Media_test");
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, del_cb, NULL);
- ewl_callback_append(win, EWL_CALLBACK_KEY_UP, key_up_cb, NULL);
- ewl_object_h_request(EWL_OBJECT(win), 280);
- ewl_object_fill_policy_set(EWL_OBJECT(win), EWL_FLAG_FILL_FILL);
- ewl_widget_show(win);
-
- /* box to contain everything */
- b = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(win), b);
- ewl_object_fill_policy_set(EWL_OBJECT(b), EWL_FLAG_FILL_FILL);
- ewl_widget_show(b);
-
- /* create the time widget now so we can pass it to the video as data */
- time = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(time), "00:00:00");
-
- /* the video */
- video = ewl_media_new();
- ewl_container_child_append(EWL_CONTAINER(b), video);
- ewl_media_module_set(EWL_MEDIA(video), type);
- ewl_object_fill_policy_set(EWL_OBJECT(video), EWL_FLAG_FILL_ALL);
- ewl_callback_append(video, EWL_CALLBACK_VALUE_CHANGED, video_change_cb, time);
- ewl_widget_show(video);
-
- /* box to contain contols and scrollers */
- controls = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(controls),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_container_child_append(EWL_CONTAINER(b), controls);
- ewl_widget_show(controls);
-
- /* hold the controls */
- b = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(controls), b);
- ewl_widget_show(b);
-
- {
- Ewl_Media_Test_Control controls [] = {
- { EWL_STOCK_PLAY, play_cb },
- { EWL_STOCK_STOP, stop_cb },
- { EWL_STOCK_REWIND, rew_cb },
- { EWL_STOCK_FASTFORWARD, ff_cb },
- { EWL_STOCK_OPEN, open_cb },
- { EWL_STOCK_NONE, NULL }
- };
- int i;
-
- for(i = 0; controls[i].name != EWL_STOCK_NONE; i++) {
- o = ewl_button_new();
- ewl_stock_type_set(EWL_STOCK(o), controls[i].name);
- ewl_container_child_append(EWL_CONTAINER(b), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- controls[i].func, NULL);
- ewl_widget_show(o);
- }
- }
-
- b = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(controls), b);
- ewl_widget_show(b);
-
- /* the video seeker */
- seeker = ewl_hseeker_new();
- ewl_container_child_append(EWL_CONTAINER(b), seeker);
- ewl_object_fill_policy_set(EWL_OBJECT(seeker),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_range_value_set(EWL_RANGE(seeker), 0.0);
- ewl_range_maximum_value_set(EWL_RANGE(seeker), 0.0);
- ewl_range_step_set(EWL_RANGE(seeker), 1.0);
- ewl_callback_append(seeker, EWL_CALLBACK_VALUE_CHANGED, seeker_move_cb, video);
- ewl_widget_show(seeker);
-
- /* the time text spot */
- ewl_container_child_append(EWL_CONTAINER(b), time);
- ewl_object_insets_set(EWL_OBJECT(time), 0, 3, 0, 0);
- ewl_object_fill_policy_set(EWL_OBJECT(time), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(time);
+ Ewl_Widget *win, *o = NULL, *b = NULL;
+ Ewl_Widget *controls = NULL, *time = NULL;
+
+ win = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(win), "EWL Media test");
+ ewl_window_name_set(EWL_WINDOW(win), "EWL_Media_test");
+ ewl_window_class_set(EWL_WINDOW(win), "EWL_Media_test");
+ ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, del_cb, NULL);
+ ewl_callback_append(win, EWL_CALLBACK_KEY_UP, key_up_cb, NULL);
+ ewl_object_h_request(EWL_OBJECT(win), 280);
+ ewl_object_fill_policy_set(EWL_OBJECT(win), EWL_FLAG_FILL_FILL);
+ ewl_widget_show(win);
+
+ /* box to contain everything */
+ b = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(win), b);
+ ewl_object_fill_policy_set(EWL_OBJECT(b), EWL_FLAG_FILL_FILL);
+ ewl_widget_show(b);
+
+ /* create the time widget now so we can pass it to the video as data */
+ time = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(time), "00:00:00");
+
+ /* the video */
+ video = ewl_media_new();
+ ewl_container_child_append(EWL_CONTAINER(b), video);
+ ewl_media_module_set(EWL_MEDIA(video), type);
+ ewl_object_fill_policy_set(EWL_OBJECT(video), EWL_FLAG_FILL_ALL);
+ ewl_callback_append(video, EWL_CALLBACK_VALUE_CHANGED, video_change_cb, time);
+ ewl_widget_show(video);
+
+ /* box to contain contols and scrollers */
+ controls = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(controls),
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_container_child_append(EWL_CONTAINER(b), controls);
+ ewl_widget_show(controls);
+
+ /* hold the controls */
+ b = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(controls), b);
+ ewl_widget_show(b);
+
+ {
+ Ewl_Media_Test_Control controls [] = {
+ { EWL_STOCK_PLAY, play_cb },
+ { EWL_STOCK_STOP, stop_cb },
+ { EWL_STOCK_REWIND, rew_cb },
+ { EWL_STOCK_FASTFORWARD, ff_cb },
+ { EWL_STOCK_OPEN, open_cb },
+ { EWL_STOCK_NONE, NULL }
+ };
+ int i;
+
+ for(i = 0; controls[i].name != EWL_STOCK_NONE; i++) {
+ o = ewl_button_new();
+ ewl_stock_type_set(EWL_STOCK(o), controls[i].name);
+ ewl_container_child_append(EWL_CONTAINER(b), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ controls[i].func, NULL);
+ ewl_widget_show(o);
+ }
+ }
+
+ b = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(controls), b);
+ ewl_widget_show(b);
+
+ /* the video seeker */
+ seeker = ewl_hseeker_new();
+ ewl_container_child_append(EWL_CONTAINER(b), seeker);
+ ewl_object_fill_policy_set(EWL_OBJECT(seeker),
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_range_value_set(EWL_RANGE(seeker), 0.0);
+ ewl_range_maximum_value_set(EWL_RANGE(seeker), 0.0);
+ ewl_range_step_set(EWL_RANGE(seeker), 1.0);
+ ewl_callback_append(seeker, EWL_CALLBACK_VALUE_CHANGED, seeker_move_cb, video);
+ ewl_widget_show(seeker);
+
+ /* the time text spot */
+ ewl_container_child_append(EWL_CONTAINER(b), time);
+ ewl_object_insets_set(EWL_OBJECT(time), 0, 3, 0, 0);
+ ewl_object_fill_policy_set(EWL_OBJECT(time), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(time);
}
diff --git a/src/bin/tests/menu/ewl_menu_test.c b/src/bin/tests/menu/ewl_menu_test.c
index 4f5538f..b2011ad 100644
--- a/src/bin/tests/menu/ewl_menu_test.c
+++ b/src/bin/tests/menu/ewl_menu_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_label.h"
@@ -12,131 +12,131 @@ static void cb_menu_clicked(Ewl_Widget * w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Menu";
- test->tip = "Defines the basic menu classes that\n"
- "are extended to an actual menu\n"
- "implementation by inheriting classes\n"
- "such as Ewl_Menu and Ewl_IMenu.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Menu";
+ test->tip = "Defines the basic menu classes that\n"
+ "are extended to an actual menu\n"
+ "implementation by inheriting classes\n"
+ "such as Ewl_Menu and Ewl_IMenu.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *menu1, *menu2, *menu3, *item;
-
- item = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(item), "");
- ewl_widget_name_set(item, "menu_label");
- ewl_container_child_append(EWL_CONTAINER(box), item);
- ewl_widget_show(item);
-
- menu1 = ewl_menu_new();
- ewl_button_image_set(EWL_BUTTON(menu1),
- PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
- ewl_button_label_set(EWL_BUTTON(menu1), "Test Menu");
- ewl_container_child_append(EWL_CONTAINER(box), menu1);
- ewl_object_fill_policy_set(EWL_OBJECT(menu1), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show(menu1);
-
- item = ewl_menu_item_new();
- ewl_button_image_set(EWL_BUTTON(item),
- PACKAGE_DATA_DIR "/ewl/images/Open.png", NULL);
- ewl_button_label_set(EWL_BUTTON(item), "Dia");
- ewl_container_child_append(EWL_CONTAINER(menu1), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- item = ewl_menu_item_new();
- ewl_button_image_set(EWL_BUTTON(item),
- PACKAGE_DATA_DIR "/ewl/images/Package.png", NULL);
- ewl_button_label_set(EWL_BUTTON(item), "Gimp");
- ewl_container_child_append(EWL_CONTAINER(menu1), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- item = ewl_menu_item_new();
- ewl_stock_type_set(EWL_STOCK(item), EWL_STOCK_OK);
- ewl_container_child_append(EWL_CONTAINER(menu1), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Button");
- ewl_container_child_append(EWL_CONTAINER(menu1), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- /* Create a sub-menu */
- menu2 = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(menu2), "Sub Menu");
- ewl_container_child_append(EWL_CONTAINER(menu1), menu2);
- ewl_widget_show(menu2);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Button 1");
- ewl_container_child_append(EWL_CONTAINER(menu2), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Button 2");
- ewl_container_child_append(EWL_CONTAINER(menu2), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- /* create a sub-sub-menu */
- menu3 = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(menu3), "Sub Sub Menu");
- ewl_container_child_append(EWL_CONTAINER(menu2), menu3);
- ewl_widget_show(menu3);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Sub Button 1");
- ewl_container_child_append(EWL_CONTAINER(menu3), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Sub Button 2");
- ewl_container_child_append(EWL_CONTAINER(menu3), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- /* Create a sub-menu */
- menu2 = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(menu2), "Sub Menu2");
- ewl_container_child_append(EWL_CONTAINER(menu1), menu2);
- ewl_widget_show(menu2);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Button 2-1");
- ewl_container_child_append(EWL_CONTAINER(menu2), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- item = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(item), "Button 2-2");
- ewl_container_child_append(EWL_CONTAINER(menu2), item);
- ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
- ewl_widget_show(item);
-
- return 1;
+ Ewl_Widget *menu1, *menu2, *menu3, *item;
+
+ item = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(item), "");
+ ewl_widget_name_set(item, "menu_label");
+ ewl_container_child_append(EWL_CONTAINER(box), item);
+ ewl_widget_show(item);
+
+ menu1 = ewl_menu_new();
+ ewl_button_image_set(EWL_BUTTON(menu1),
+ PACKAGE_DATA_DIR "/ewl/images/Draw.png", NULL);
+ ewl_button_label_set(EWL_BUTTON(menu1), "Test Menu");
+ ewl_container_child_append(EWL_CONTAINER(box), menu1);
+ ewl_object_fill_policy_set(EWL_OBJECT(menu1), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(menu1);
+
+ item = ewl_menu_item_new();
+ ewl_button_image_set(EWL_BUTTON(item),
+ PACKAGE_DATA_DIR "/ewl/images/Open.png", NULL);
+ ewl_button_label_set(EWL_BUTTON(item), "Dia");
+ ewl_container_child_append(EWL_CONTAINER(menu1), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ item = ewl_menu_item_new();
+ ewl_button_image_set(EWL_BUTTON(item),
+ PACKAGE_DATA_DIR "/ewl/images/Package.png", NULL);
+ ewl_button_label_set(EWL_BUTTON(item), "Gimp");
+ ewl_container_child_append(EWL_CONTAINER(menu1), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ item = ewl_menu_item_new();
+ ewl_stock_type_set(EWL_STOCK(item), EWL_STOCK_OK);
+ ewl_container_child_append(EWL_CONTAINER(menu1), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Button");
+ ewl_container_child_append(EWL_CONTAINER(menu1), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ /* Create a sub-menu */
+ menu2 = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(menu2), "Sub Menu");
+ ewl_container_child_append(EWL_CONTAINER(menu1), menu2);
+ ewl_widget_show(menu2);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Button 1");
+ ewl_container_child_append(EWL_CONTAINER(menu2), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Button 2");
+ ewl_container_child_append(EWL_CONTAINER(menu2), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ /* create a sub-sub-menu */
+ menu3 = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(menu3), "Sub Sub Menu");
+ ewl_container_child_append(EWL_CONTAINER(menu2), menu3);
+ ewl_widget_show(menu3);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Sub Button 1");
+ ewl_container_child_append(EWL_CONTAINER(menu3), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Sub Button 2");
+ ewl_container_child_append(EWL_CONTAINER(menu3), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ /* Create a sub-menu */
+ menu2 = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(menu2), "Sub Menu2");
+ ewl_container_child_append(EWL_CONTAINER(menu1), menu2);
+ ewl_widget_show(menu2);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Button 2-1");
+ ewl_container_child_append(EWL_CONTAINER(menu2), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ item = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Button 2-2");
+ ewl_container_child_append(EWL_CONTAINER(menu2), item);
+ ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
+ ewl_widget_show(item);
+
+ return 1;
}
static void
cb_menu_clicked(Ewl_Widget * w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Widget *o;
- const char *text;
- char buf[1024];
+ Ewl_Widget *o;
+ const char *text;
+ char buf[1024];
- o = ewl_widget_name_find("menu_label");
- text = ewl_button_label_get(EWL_BUTTON(w));
+ o = ewl_widget_name_find("menu_label");
+ text = ewl_button_label_get(EWL_BUTTON(w));
- snprintf(buf, 1024, "%s item clicked.", (char *)text);
- ewl_label_text_set(EWL_LABEL(o), buf);
+ snprintf(buf, 1024, "%s item clicked.", (char *)text);
+ ewl_label_text_set(EWL_LABEL(o), buf);
}
diff --git a/src/bin/tests/menubar/ewl_menubar_test.c b/src/bin/tests/menubar/ewl_menubar_test.c
index ae1b62f..673e5e5 100644
--- a/src/bin/tests/menubar/ewl_menubar_test.c
+++ b/src/bin/tests/menubar/ewl_menubar_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_menubar.h"
@@ -12,119 +12,119 @@ static int create_test(Ewl_Container *win);
void
test_info(Ewl_Test *test)
{
- test->name = "Menubar";
- test->tip = "Defines a menubar that can be used to hold menus.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Menubar";
+ test->tip = "Defines a menubar that can be used to hold menus.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *h_menubar = NULL, *v_menubar = NULL;
-
- h_menubar = ewl_hmenubar_new();
- {
- int i;
- Ewl_Widget *item;
- Ewl_Widget *foo;
- char *m_items[] = {"File",
- "Test",
- "About",
- NULL};
- for(i = 0; m_items[i] != NULL; i++) {
-
- if (i != 0) {
- Ewl_Widget *sep;
-
- sep = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(h_menubar), sep);
- ewl_widget_show(sep);
- }
-
- item = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(item), m_items[i]);
- ewl_container_child_append(EWL_CONTAINER(h_menubar), item);
- ewl_widget_show(item);
-
- foo = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(foo), "foo");
- ewl_container_child_append(EWL_CONTAINER(item), foo);
- ewl_widget_show(foo);
-
- foo = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(foo), "foobar");
- ewl_container_child_append(EWL_CONTAINER(item), foo);
- ewl_widget_show(foo);
-
- }
-
- item = ewl_spacer_new();
- ewl_object_fill_policy_set(EWL_OBJECT(item), EWL_FLAG_FILL_ALL);
- ewl_container_child_append(EWL_CONTAINER(h_menubar), item);
- ewl_widget_show(item);
-
- item = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(item), "Help");
- ewl_container_child_append(EWL_CONTAINER(h_menubar), item);
- ewl_widget_show(item);
-
- foo = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(foo), "foo");
- ewl_container_child_append(EWL_CONTAINER(item), foo);
- ewl_widget_show(foo);
-
- foo = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(foo), "foobar");
- ewl_container_child_append(EWL_CONTAINER(item), foo);
- ewl_widget_show(foo);
- }
- ewl_container_child_append(EWL_CONTAINER(box), h_menubar);
- ewl_widget_show(h_menubar);
-
- v_menubar = ewl_vmenubar_new();
- {
- int i;
- Ewl_Widget *item;
- char *m_items[] = {"About",
- "Left",
- "Right",
- "foo",
- NULL};
- for(i = 0; m_items[i] != NULL; i++) {
- Ewl_Widget *foo;
-
- if (i != 0 && (i & 1))
- {
- Ewl_Widget *sep;
-
- sep = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(v_menubar), sep);
- ewl_widget_show(sep);
- }
-
- item = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(item), m_items[i]);
- ewl_container_child_append(EWL_CONTAINER(v_menubar), item);
- ewl_widget_show(item);
-
- foo = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(foo), "foo");
- ewl_container_child_append(EWL_CONTAINER(item), foo);
- ewl_widget_show(foo);
-
- foo = ewl_menu_item_new();
- ewl_button_label_set(EWL_BUTTON(foo), "foobar");
- ewl_container_child_append(EWL_CONTAINER(item), foo);
- ewl_widget_show(foo);
-
- }
- }
- ewl_container_child_append(EWL_CONTAINER(box), v_menubar);
- ewl_object_alignment_set(EWL_OBJECT(v_menubar), EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(v_menubar);
-
- return 1;
+ Ewl_Widget *h_menubar = NULL, *v_menubar = NULL;
+
+ h_menubar = ewl_hmenubar_new();
+ {
+ int i;
+ Ewl_Widget *item;
+ Ewl_Widget *foo;
+ char *m_items[] = {"File",
+ "Test",
+ "About",
+ NULL};
+ for(i = 0; m_items[i] != NULL; i++) {
+
+ if (i != 0) {
+ Ewl_Widget *sep;
+
+ sep = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(h_menubar), sep);
+ ewl_widget_show(sep);
+ }
+
+ item = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(item), m_items[i]);
+ ewl_container_child_append(EWL_CONTAINER(h_menubar), item);
+ ewl_widget_show(item);
+
+ foo = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(foo), "foo");
+ ewl_container_child_append(EWL_CONTAINER(item), foo);
+ ewl_widget_show(foo);
+
+ foo = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(foo), "foobar");
+ ewl_container_child_append(EWL_CONTAINER(item), foo);
+ ewl_widget_show(foo);
+
+ }
+
+ item = ewl_spacer_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(item), EWL_FLAG_FILL_ALL);
+ ewl_container_child_append(EWL_CONTAINER(h_menubar), item);
+ ewl_widget_show(item);
+
+ item = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(item), "Help");
+ ewl_container_child_append(EWL_CONTAINER(h_menubar), item);
+ ewl_widget_show(item);
+
+ foo = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(foo), "foo");
+ ewl_container_child_append(EWL_CONTAINER(item), foo);
+ ewl_widget_show(foo);
+
+ foo = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(foo), "foobar");
+ ewl_container_child_append(EWL_CONTAINER(item), foo);
+ ewl_widget_show(foo);
+ }
+ ewl_container_child_append(EWL_CONTAINER(box), h_menubar);
+ ewl_widget_show(h_menubar);
+
+ v_menubar = ewl_vmenubar_new();
+ {
+ int i;
+ Ewl_Widget *item;
+ char *m_items[] = {"About",
+ "Left",
+ "Right",
+ "foo",
+ NULL};
+ for(i = 0; m_items[i] != NULL; i++) {
+ Ewl_Widget *foo;
+
+ if (i != 0 && (i & 1))
+ {
+ Ewl_Widget *sep;
+
+ sep = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(v_menubar), sep);
+ ewl_widget_show(sep);
+ }
+
+ item = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(item), m_items[i]);
+ ewl_container_child_append(EWL_CONTAINER(v_menubar), item);
+ ewl_widget_show(item);
+
+ foo = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(foo), "foo");
+ ewl_container_child_append(EWL_CONTAINER(item), foo);
+ ewl_widget_show(foo);
+
+ foo = ewl_menu_item_new();
+ ewl_button_label_set(EWL_BUTTON(foo), "foobar");
+ ewl_container_child_append(EWL_CONTAINER(item), foo);
+ ewl_widget_show(foo);
+
+ }
+ }
+ ewl_container_child_append(EWL_CONTAINER(box), v_menubar);
+ ewl_object_alignment_set(EWL_OBJECT(v_menubar), EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(v_menubar);
+
+ return 1;
}
diff --git a/src/bin/tests/modal/ewl_modal_test.c b/src/bin/tests/modal/ewl_modal_test.c
index fca5714..35e0887 100644
--- a/src/bin/tests/modal/ewl_modal_test.c
+++ b/src/bin/tests/modal/ewl_modal_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,80 +15,80 @@ static void ewl_widget_cb_go_modal(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Modal";
- test->tip = "Testing modal windows.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->func = create_test;
+ test->name = "Modal";
+ test->tip = "Testing modal windows.";
+ 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_Widget *vbox, *o;
- 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), "Launch modal window");
- 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), "Launch modal window");
+ ewl_container_child_append(EWL_CONTAINER(vbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_click, NULL);
+ ewl_widget_show(o);
- return 1;
+ return 1;
}
static void
ewl_widget_cb_click(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Embed *emb;
- Ewl_Widget *win, *vbox, *o;
-
- emb = ewl_embed_widget_find(w);
-
- win = ewl_window_new();
- ewl_window_title_set(EWL_WINDOW(win), "MODAL");
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
- ewl_widget_cb_close_click, NULL);
- ewl_widget_show(win);
-
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(win), vbox);
- ewl_widget_show(vbox);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Go modal");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_widget_cb_go_modal, emb);
- ewl_container_child_append(EWL_CONTAINER(vbox), o);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Close");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_widget_cb_close_click, NULL);
- ewl_container_child_append(EWL_CONTAINER(vbox), o);
- ewl_widget_show(o);
+ Ewl_Embed *emb;
+ Ewl_Widget *win, *vbox, *o;
+
+ emb = ewl_embed_widget_find(w);
+
+ win = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(win), "MODAL");
+ ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
+ ewl_widget_cb_close_click, NULL);
+ ewl_widget_show(win);
+
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(win), vbox);
+ ewl_widget_show(vbox);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Go modal");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_widget_cb_go_modal, emb);
+ ewl_container_child_append(EWL_CONTAINER(vbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Close");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_widget_cb_close_click, NULL);
+ ewl_container_child_append(EWL_CONTAINER(vbox), o);
+ ewl_widget_show(o);
}
static void
ewl_widget_cb_close_click(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- ewl_widget_destroy(EWL_WIDGET(emb));
+ emb = ewl_embed_widget_find(w);
+ ewl_widget_destroy(EWL_WIDGET(emb));
}
static void
ewl_widget_cb_go_modal(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Embed *emb;
+ Ewl_Embed *emb;
- emb = ewl_embed_widget_find(w);
- ewl_window_transient_for(EWL_WINDOW(emb), EWL_WINDOW(data));
- ewl_window_modal_set(EWL_WINDOW(emb), TRUE);
+ emb = ewl_embed_widget_find(w);
+ ewl_window_transient_for(EWL_WINDOW(emb), EWL_WINDOW(data));
+ ewl_window_modal_set(EWL_WINDOW(emb), TRUE);
}
diff --git a/src/bin/tests/mvc/ewl_mvc_test.c b/src/bin/tests/mvc/ewl_mvc_test.c
index b8accd7..4a84695 100644
--- a/src/bin/tests/mvc/ewl_mvc_test.c
+++ b/src/bin/tests/mvc/ewl_mvc_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_mvc.h"
@@ -48,400 +48,400 @@ static int insert_range_overlap_new_covers_old(char *buf, int len);
static int insert_range_overlap_old_covers_new(char *buf, int len);
static int ewl_mvc_is_index(char *buf, int len, Ewl_Selection *sel,
- int row, int column);
+ int row, int column);
static int ewl_mvc_is_range(char *buf, int len, Ewl_Selection *sel,
- int srow, int scolumn,
- int erow, int ecolumn);
+ int srow, int scolumn,
+ int erow, int ecolumn);
static Ewl_Unit_Test mvc_unit_tests[] = {
- {"Set selected", selected_set, NULL, -1, 0},
- {"Get selected", selected_get, NULL, -1, 0},
- {"Range (single select) add", selected_range_single_add, NULL, -1, 0},
- {"Range (multi select) add", selected_range_multi_add, NULL, -1, 0},
- {"Count get", selected_count_get, NULL, -1, 0},
- {"Is selected (index)", selected_is_index, NULL, -1, 0},
- {"Is not selected (index)", selected_is_not_index, NULL, -1, 0},
- {"Is selected (range)", selected_is_range, NULL, -1, 0},
- {"Is not selected (range)", selected_is_not_range, NULL, -1, 0},
- {"Selected clear", selected_clear, NULL, -1, 0},
-
- {"Remove index", selected_rm_idx, NULL, -1, 0},
- {"Remove non-selected index", selected_rm_unselected_idx, NULL, -1, 0},
- {"Remove bottom from 2x1", selected_rm_2x1_bottom, NULL, -1, 0},
- {"Remove top from 2x1", selected_rm_2x1_top, NULL, -1, 0},
- {"Remove left from 1x2", selected_rm_1x2_left, NULL, -1, 0},
- {"Remove right from 1x2", selected_rm_1x2_right, NULL, -1, 0},
- {"Remove from range, top left point",
- selected_rm_from_range_top_left_point, NULL, -1, 0},
- {"Remove from range, bottom right point",
- selected_rm_from_range_bottom_right_point, NULL, -1, 0},
- {"Remove from range, middle point",
- selected_rm_from_range_middle_point, NULL, -1, 0},
- {"Remove from range, left edge",
- selected_rm_from_range_left_edge_point, NULL, -1, 0},
- {"Remove from range, right edge",
- selected_rm_from_range_right_edge_point, NULL, -1, 0},
- {"Remove from range, top edge",
- selected_rm_from_range_top_edge_point, NULL, -1, 0},
- {"Remove from range, bottom edge",
- selected_rm_from_range_bottom_edge_point, NULL, -1, 0},
-
- {"Insert range no intersection",
- insert_range_no_intersection, NULL, -1, 0},
- {"Insert range top intersection",
- insert_range_top_intersection, NULL, -1, 0},
- {"Insert range bottom intersection",
- insert_range_bottom_intersection, NULL, -1, 0},
- {"Insert range left intersection",
- insert_range_left_intersection, NULL, -1, 0},
- {"Insert range right intersection",
- insert_range_right_intersection, NULL, -1, 0},
- {"Insert range intersect, top left corner",
- insert_range_top_left_intersection, NULL, -1, 0},
- {"Insert range intersect, top right corner",
- insert_range_top_right_intersection, NULL, -1, 0},
- {"Insert range intersect, bottom left corner",
- insert_range_bottom_left_intersection, NULL, -1, 0},
- {"Insert range intersect, bottom right corner",
- insert_range_bottom_right_intersection, NULL, -1, 0},
- {"Insert range intersect, overlap horizontal",
- insert_range_overlap_horizontal, NULL, -1, 0},
- {"Insert range intersect, overlap vertical",
- insert_range_overlap_vertical, NULL, -1, 0},
- {"Insert range intersect, new covers old",
- insert_range_overlap_new_covers_old, NULL, -1, 0},
- {"Insert range intersect, old covers new",
- insert_range_overlap_old_covers_new, NULL, -1, 0},
-
- {NULL, NULL, NULL, -1, 0}
- };
+ {"Set selected", selected_set, NULL, -1, 0},
+ {"Get selected", selected_get, NULL, -1, 0},
+ {"Range (single select) add", selected_range_single_add, NULL, -1, 0},
+ {"Range (multi select) add", selected_range_multi_add, NULL, -1, 0},
+ {"Count get", selected_count_get, NULL, -1, 0},
+ {"Is selected (index)", selected_is_index, NULL, -1, 0},
+ {"Is not selected (index)", selected_is_not_index, NULL, -1, 0},
+ {"Is selected (range)", selected_is_range, NULL, -1, 0},
+ {"Is not selected (range)", selected_is_not_range, NULL, -1, 0},
+ {"Selected clear", selected_clear, NULL, -1, 0},
+
+ {"Remove index", selected_rm_idx, NULL, -1, 0},
+ {"Remove non-selected index", selected_rm_unselected_idx, NULL, -1, 0},
+ {"Remove bottom from 2x1", selected_rm_2x1_bottom, NULL, -1, 0},
+ {"Remove top from 2x1", selected_rm_2x1_top, NULL, -1, 0},
+ {"Remove left from 1x2", selected_rm_1x2_left, NULL, -1, 0},
+ {"Remove right from 1x2", selected_rm_1x2_right, NULL, -1, 0},
+ {"Remove from range, top left point",
+ selected_rm_from_range_top_left_point, NULL, -1, 0},
+ {"Remove from range, bottom right point",
+ selected_rm_from_range_bottom_right_point, NULL, -1, 0},
+ {"Remove from range, middle point",
+ selected_rm_from_range_middle_point, NULL, -1, 0},
+ {"Remove from range, left edge",
+ selected_rm_from_range_left_edge_point, NULL, -1, 0},
+ {"Remove from range, right edge",
+ selected_rm_from_range_right_edge_point, NULL, -1, 0},
+ {"Remove from range, top edge",
+ selected_rm_from_range_top_edge_point, NULL, -1, 0},
+ {"Remove from range, bottom edge",
+ selected_rm_from_range_bottom_edge_point, NULL, -1, 0},
+
+ {"Insert range no intersection",
+ insert_range_no_intersection, NULL, -1, 0},
+ {"Insert range top intersection",
+ insert_range_top_intersection, NULL, -1, 0},
+ {"Insert range bottom intersection",
+ insert_range_bottom_intersection, NULL, -1, 0},
+ {"Insert range left intersection",
+ insert_range_left_intersection, NULL, -1, 0},
+ {"Insert range right intersection",
+ insert_range_right_intersection, NULL, -1, 0},
+ {"Insert range intersect, top left corner",
+ insert_range_top_left_intersection, NULL, -1, 0},
+ {"Insert range intersect, top right corner",
+ insert_range_top_right_intersection, NULL, -1, 0},
+ {"Insert range intersect, bottom left corner",
+ insert_range_bottom_left_intersection, NULL, -1, 0},
+ {"Insert range intersect, bottom right corner",
+ insert_range_bottom_right_intersection, NULL, -1, 0},
+ {"Insert range intersect, overlap horizontal",
+ insert_range_overlap_horizontal, NULL, -1, 0},
+ {"Insert range intersect, overlap vertical",
+ insert_range_overlap_vertical, NULL, -1, 0},
+ {"Insert range intersect, new covers old",
+ insert_range_overlap_new_covers_old, NULL, -1, 0},
+ {"Insert range intersect, old covers new",
+ insert_range_overlap_old_covers_new, NULL, -1, 0},
+
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "MVC";
- test->tip = "The base mvc type.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_UNIT;
- test->unit_tests = mvc_unit_tests;
+ test->name = "MVC";
+ test->tip = "The base mvc type.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_UNIT;
+ test->unit_tests = mvc_unit_tests;
}
static int
selected_set(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection_Idx *idx;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 1, 2);
- idx = ecore_list_first_goto(m->selected);
-
- if (idx->sel.type != EWL_SELECTION_TYPE_INDEX)
- {
- LOG_FAILURE(buf, len, "Incorrect selection type");
- return FALSE;
- }
-
- if ((idx->row != 1) || (idx->column != 2))
- {
- LOG_FAILURE(buf, len, "Incorrect row/column setting: "
- "(%d %d) vs (1, 2)", idx->row, idx->column);
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection_Idx *idx;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 1, 2);
+ idx = ecore_list_first_goto(m->selected);
+
+ if (idx->sel.type != EWL_SELECTION_TYPE_INDEX)
+ {
+ LOG_FAILURE(buf, len, "Incorrect selection type");
+ return FALSE;
+ }
+
+ if ((idx->row != 1) || (idx->column != 2))
+ {
+ LOG_FAILURE(buf, len, "Incorrect row/column setting: "
+ "(%d %d) vs (1, 2)", idx->row, idx->column);
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
selected_get(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection_Idx *idx;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
- idx = ewl_mvc_selected_get(m);
-
- if (idx->sel.type != EWL_SELECTION_TYPE_INDEX)
- {
- LOG_FAILURE(buf, len, "Incorrect selection type");
- return FALSE;
- }
-
- if ((idx->row != 1) || (idx->column != 2))
- {
- LOG_FAILURE(buf, len, "Incorrect row/column setting "
- "(%d %d) instead of (1, 2)", idx->row, idx->column);
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection_Idx *idx;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
+ idx = ewl_mvc_selected_get(m);
+
+ if (idx->sel.type != EWL_SELECTION_TYPE_INDEX)
+ {
+ LOG_FAILURE(buf, len, "Incorrect selection type");
+ return FALSE;
+ }
+
+ if ((idx->row != 1) || (idx->column != 2))
+ {
+ LOG_FAILURE(buf, len, "Incorrect row/column setting "
+ "(%d %d) instead of (1, 2)", idx->row, idx->column);
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
selected_range_single_add(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection_Idx *idx;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection_Idx *idx;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
- idx = ecore_list_first_goto(m->selected);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+ idx = ecore_list_first_goto(m->selected);
- if (idx->sel.type != EWL_SELECTION_TYPE_INDEX)
- {
- LOG_FAILURE(buf, len, "Incorrect selection type");
- return FALSE;
- }
+ if (idx->sel.type != EWL_SELECTION_TYPE_INDEX)
+ {
+ LOG_FAILURE(buf, len, "Incorrect selection type");
+ return FALSE;
+ }
- if ((idx->row != 1) || (idx->column != 2))
- {
- LOG_FAILURE(buf, len, "Incorrect start row/column setting");
- return FALSE;
- }
+ if ((idx->row != 1) || (idx->column != 2))
+ {
+ LOG_FAILURE(buf, len, "Incorrect start row/column setting");
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
static int
selected_range_multi_add(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection_Range *idx;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, NULL, 6, 8, 1, 2);
- idx = ecore_list_first_goto(m->selected);
-
- if (!idx)
- {
- LOG_FAILURE(buf, len, "Returned idx is NULL");
- return FALSE;
- }
-
- if (idx->sel.type != EWL_SELECTION_TYPE_RANGE)
- {
- LOG_FAILURE(buf, len, "Incorrect selection type");
- return FALSE;
- }
-
- if ((idx->start.row != 1) || (idx->start.column != 2))
- {
- LOG_FAILURE(buf, len, "Incorrect start row/column setting");
- return FALSE;
- }
-
- if ((idx->end.row != 6) || (idx->end.column != 8))
- {
- LOG_FAILURE(buf, len, "Incorrect end row/column setting");
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection_Range *idx;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, NULL, 6, 8, 1, 2);
+ idx = ecore_list_first_goto(m->selected);
+
+ if (!idx)
+ {
+ LOG_FAILURE(buf, len, "Returned idx is NULL");
+ return FALSE;
+ }
+
+ if (idx->sel.type != EWL_SELECTION_TYPE_RANGE)
+ {
+ LOG_FAILURE(buf, len, "Incorrect selection type");
+ return FALSE;
+ }
+
+ if ((idx->start.row != 1) || (idx->start.column != 2))
+ {
+ LOG_FAILURE(buf, len, "Incorrect start row/column setting");
+ return FALSE;
+ }
+
+ if ((idx->end.row != 6) || (idx->end.column != 8))
+ {
+ LOG_FAILURE(buf, len, "Incorrect end row/column setting");
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
selected_count_get(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- int count, expected = 44;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- count = ewl_mvc_selected_count_get(m);
- if (count != expected)
- {
- LOG_FAILURE(buf, len, "Incorrect count (%d instead of %d)",
- count, expected);
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ int count, expected = 44;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ count = ewl_mvc_selected_count_get(m);
+ if (count != expected)
+ {
+ LOG_FAILURE(buf, len, "Incorrect count (%d instead of %d)",
+ count, expected);
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
selected_is_index(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- if (!ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 6, 8))
- {
- LOG_FAILURE(buf, len, "Not selected");
- return FALSE;
- }
+ if (!ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 6, 8))
+ {
+ LOG_FAILURE(buf, len, "Not selected");
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
static int
selected_is_not_index(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 7, 7))
- {
- LOG_FAILURE(buf, len, "Item selected");
- return FALSE;
- }
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 7, 7))
+ {
+ LOG_FAILURE(buf, len, "Item selected");
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
static int
selected_is_range(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
- if (!ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 4, 5))
- {
- LOG_FAILURE(buf, len, "Not selected");
- return FALSE;
- }
+ if (!ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 4, 5))
+ {
+ LOG_FAILURE(buf, len, "Not selected");
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
static int
selected_is_not_range(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 1))
- {
- LOG_FAILURE(buf, len, "Item selected selected");
- return FALSE;
- }
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 1))
+ {
+ LOG_FAILURE(buf, len, "Item selected selected");
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
static int
selected_clear(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
- ewl_mvc_selected_clear(m);
-
- if (ewl_mvc_selected_count_get(m) != 0)
- {
- LOG_FAILURE(buf, len, "Selected list not empty.");
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+ ewl_mvc_selected_clear(m);
+
+ if (ewl_mvc_selected_count_get(m) != 0)
+ {
+ LOG_FAILURE(buf, len, "Selected list not empty.");
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
selected_rm_idx(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 9, 1);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 9, 1))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 9, 1);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 9, 1))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
selected_rm_unselected_idx(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
- ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 10, 2);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 10, 2))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_set(m, NULL, ewl_mvc_data_get(m), 6, 8);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 3, 0);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 9, 1);
+ ewl_mvc_selected_add(m, NULL, ewl_mvc_data_get(m), 1, 2);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 10, 2);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 10, 2))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ return TRUE;
}
/*
@@ -459,37 +459,37 @@ selected_rm_unselected_idx(char *buf, int len)
static int
selected_rm_2x1_bottom(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 2, 1);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 2, 1);
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 2, 1);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 2, 1))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 2, 1);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 2, 1))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
- count = ewl_mvc_selected_count_get(m);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "Selected items is %d instead of 1", count);
- return FALSE;
- }
+ count = ewl_mvc_selected_count_get(m);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "Selected items is %d instead of 1", count);
+ return FALSE;
+ }
- sel = ecore_list_first_goto(m->selected);
+ sel = ecore_list_first_goto(m->selected);
- if (!ewl_mvc_is_index(buf, len, sel, 1, 1))
- return FALSE;
+ if (!ewl_mvc_is_index(buf, len, sel, 1, 1))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
/*
@@ -502,37 +502,37 @@ selected_rm_2x1_bottom(char *buf, int len)
static int
selected_rm_2x1_top(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 2, 1);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 2, 1);
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 1);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 1))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 1);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 1))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
- count = ewl_mvc_selected_count_get(m);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "Selected items is %d instead of 1", count);
- return FALSE;
- }
+ count = ewl_mvc_selected_count_get(m);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "Selected items is %d instead of 1", count);
+ return FALSE;
+ }
- sel = ecore_list_first_goto(m->selected);
+ sel = ecore_list_first_goto(m->selected);
- if (!ewl_mvc_is_index(buf, len, sel, 2, 1))
- return FALSE;
+ if (!ewl_mvc_is_index(buf, len, sel, 2, 1))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
/*
@@ -543,35 +543,35 @@ selected_rm_2x1_top(char *buf, int len)
static int
selected_rm_1x2_left(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 1, 2);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 1, 2);
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 1);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 1))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 1);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 1))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
- if (ewl_mvc_selected_count_get(m) != 1)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items");
- return FALSE;
- }
+ if (ewl_mvc_selected_count_get(m) != 1)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items");
+ return FALSE;
+ }
- sel = ecore_list_first_goto(m->selected);
+ sel = ecore_list_first_goto(m->selected);
- if (!ewl_mvc_is_index(buf, len, sel, 1, 2))
- return FALSE;
+ if (!ewl_mvc_is_index(buf, len, sel, 1, 2))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
/*
@@ -582,35 +582,35 @@ selected_rm_1x2_left(char *buf, int len)
static int
selected_rm_1x2_right(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 1, 2);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 1, 2);
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 2);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 2))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 2);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 2))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
- if (ewl_mvc_selected_count_get(m) != 1)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items");
- return FALSE;
- }
+ if (ewl_mvc_selected_count_get(m) != 1)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items");
+ return FALSE;
+ }
- sel = ecore_list_first_goto(m->selected);
+ sel = ecore_list_first_goto(m->selected);
- if (!ewl_mvc_is_index(buf, len, sel, 1, 1))
- return FALSE;
+ if (!ewl_mvc_is_index(buf, len, sel, 1, 1))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
/*
@@ -622,39 +622,39 @@ selected_rm_1x2_right(char *buf, int len)
static int
selected_rm_from_range_top_left_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 2);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 2))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 2, 2, 6, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 1, 8))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 2);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 2))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 2, 2, 6, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 1, 8))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -666,39 +666,39 @@ selected_rm_from_range_top_left_point(char *buf, int len)
static int
selected_rm_from_range_bottom_right_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 6, 8);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 6, 8))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 5, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 6, 2, 6, 7))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 6, 8);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 6, 8))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 5, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 6, 2, 6, 7))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -711,47 +711,47 @@ selected_rm_from_range_bottom_right_point(char *buf, int len)
static int
selected_rm_from_range_middle_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 4, 5);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 4, 5))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 3, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 4, 2, 6, 4))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 5, 5, 6, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 3);
- if (!ewl_mvc_is_range(buf, len, sel, 4, 6, 4, 8))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 4, 5);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 4, 5))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 3, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 4, 2, 6, 4))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 5, 5, 6, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 3);
+ if (!ewl_mvc_is_range(buf, len, sel, 4, 6, 4, 8))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -764,43 +764,43 @@ selected_rm_from_range_middle_point(char *buf, int len)
static int
selected_rm_from_range_left_edge_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 4, 2);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 4, 2))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 3, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 6, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 4, 3, 4, 8))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 4, 2);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 4, 2))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 3, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 6, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 4, 3, 4, 8))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -813,43 +813,43 @@ selected_rm_from_range_left_edge_point(char *buf, int len)
static int
selected_rm_from_range_right_edge_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 3, 8);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 3, 8))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 2, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 2, 6, 7))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 4, 8, 6, 8))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 3, 8);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 3, 8))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 2, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 2, 6, 7))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 4, 8, 6, 8))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -862,43 +862,43 @@ selected_rm_from_range_right_edge_point(char *buf, int len)
static int
selected_rm_from_range_top_edge_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 5);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 5))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 6, 4))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 2, 5, 6, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 6, 1, 8))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 1, 5);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 1, 5))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 6, 4))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 2, 5, 6, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 6, 1, 8))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -911,46 +911,46 @@ selected_rm_from_range_top_edge_point(char *buf, int len)
static int
selected_rm_from_range_bottom_edge_point(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
-
- ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 6, 3);
- if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 6, 3))
- {
- LOG_FAILURE(buf, len, "Index still selected");
- return FALSE;
- }
-
- if (ewl_mvc_selected_count_get(m) != 41)
- {
- LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
- ewl_mvc_selected_count_get(m));
- return FALSE;
- }
-
- /* should have 3 ranges: [(1,2)(5,8)]
- [(2,6)]
- [(6,4)(6,8)] */
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 5, 8))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_index(buf, len, sel, 6, 2))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 6, 4, 6, 8))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2);
+
+ ewl_mvc_selected_rm(m, ewl_mvc_data_get(m), 6, 3);
+ if (ewl_mvc_selected_is(m, ewl_mvc_data_get(m), 6, 3))
+ {
+ LOG_FAILURE(buf, len, "Index still selected");
+ return FALSE;
+ }
+
+ if (ewl_mvc_selected_count_get(m) != 41)
+ {
+ LOG_FAILURE(buf, len, "Incorrect number of selected items: %d",
+ ewl_mvc_selected_count_get(m));
+ return FALSE;
+ }
+
+ /* should have 3 ranges: [(1,2)(5,8)]
+ [(2,6)]
+ [(6,4)(6,8)] */
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 5, 8))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_index(buf, len, sel, 6, 2))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 6, 4, 6, 8))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -967,26 +967,26 @@ selected_rm_from_range_bottom_edge_point(char *buf, int len)
static int
insert_range_no_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
- t = ewl_tree_new();
- m = EWL_MVC(t);
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 4, 4, 6, 6);
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 4, 4, 6, 6);
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 3))
- return FALSE;
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 3))
+ return FALSE;
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 4, 4, 6, 6))
- return FALSE;
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 4, 4, 6, 6))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
/*
@@ -999,30 +999,30 @@ insert_range_no_intersection(char *buf, int len)
static int
insert_range_top_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 7, 3);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
-
- count = ecore_list_count(m->selected);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 7, 3))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 7, 3);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
+
+ count = ecore_list_count(m->selected);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 7, 3))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1035,30 +1035,30 @@ insert_range_top_intersection(char *buf, int len)
static int
insert_range_bottom_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 7, 3);
-
- count = ecore_list_count(m->selected);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 7, 3))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 7, 3);
+
+ count = ecore_list_count(m->selected);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 7, 3))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1069,30 +1069,30 @@ insert_range_bottom_intersection(char *buf, int len)
static int
insert_range_left_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 3, 5);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
-
- count = ecore_list_count(m->selected);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 5))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 3, 5);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
+
+ count = ecore_list_count(m->selected);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 5))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1103,30 +1103,30 @@ insert_range_left_intersection(char *buf, int len)
static int
insert_range_right_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 3, 5);
-
- count = ecore_list_count(m->selected);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 5))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 3, 5);
+
+ count = ecore_list_count(m->selected);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 5))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1140,38 +1140,38 @@ insert_range_right_intersection(char *buf, int len)
static int
insert_range_top_left_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 7, 7);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 5, 5);
-
- count = ecore_list_count(m->selected);
- if (count != 3)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 6, 3, 7, 7))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 6, 5, 7))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 5, 5))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 7, 7);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 5, 5);
+
+ count = ecore_list_count(m->selected);
+ if (count != 3)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 6, 3, 7, 7))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 6, 5, 7))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 5, 5))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1185,38 +1185,38 @@ insert_range_top_left_intersection(char *buf, int len)
static int
insert_range_top_right_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 3);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 2, 4, 5);
-
- count = ecore_list_count(m->selected);
- if (count != 3)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 1))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 5, 3))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 4, 5))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 3);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 2, 4, 5);
+
+ count = ecore_list_count(m->selected);
+ if (count != 3)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 1))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 5, 3))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 4, 5))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1230,38 +1230,38 @@ insert_range_top_right_intersection(char *buf, int len)
static int
insert_range_bottom_left_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 2, 4, 5);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 3);
-
- count = ecore_list_count(m->selected);
- if (count != 3)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 2, 5))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 4, 4, 5))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 3))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 2, 4, 5);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 3);
+
+ count = ecore_list_count(m->selected);
+ if (count != 3)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 2, 5))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 4, 4, 5))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 3))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1275,38 +1275,38 @@ insert_range_bottom_left_intersection(char *buf, int len)
static int
insert_range_bottom_right_intersection(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 5, 5);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 7, 7);
-
- count = ecore_list_count(m->selected);
- if (count != 3)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 2, 5))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 2))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 3, 7, 7))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 5, 5);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 7, 7);
+
+ count = ecore_list_count(m->selected);
+ if (count != 3)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 2, 5))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 2))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 3, 7, 7))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1322,38 +1322,38 @@ insert_range_bottom_right_intersection(char *buf, int len)
static int
insert_range_overlap_horizontal(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 9);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 7, 5);
-
- count = ecore_list_count(m->selected);
- if (count != 3)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 2))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 6, 5, 9))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 7, 5))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 9);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 7, 5);
+
+ count = ecore_list_count(m->selected);
+ if (count != 3)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 2))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 6, 5, 9))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 7, 5))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1369,38 +1369,38 @@ insert_range_overlap_horizontal(char *buf, int len)
static int
insert_range_overlap_vertical(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 7, 5);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 9);
-
- count = ecore_list_count(m->selected);
- if (count != 3)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 2, 5))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 1);
- if (!ewl_mvc_is_range(buf, len, sel, 6, 3, 7, 5))
- return FALSE;
-
- sel = ecore_list_index_goto(m->selected, 2);
- if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 9))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 7, 5);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 9);
+
+ count = ecore_list_count(m->selected);
+ if (count != 3)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 3", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 2, 5))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 1);
+ if (!ewl_mvc_is_range(buf, len, sel, 6, 3, 7, 5))
+ return FALSE;
+
+ sel = ecore_list_index_goto(m->selected, 2);
+ if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 9))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1414,30 +1414,30 @@ insert_range_overlap_vertical(char *buf, int len)
static int
insert_range_overlap_new_covers_old(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 5, 5);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 9, 9);
-
- count = ecore_list_count(m->selected);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 9, 9))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 5, 5);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 9, 9);
+
+ count = ecore_list_count(m->selected);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 9, 9))
+ return FALSE;
+
+ return TRUE;
}
/*
@@ -1451,90 +1451,90 @@ insert_range_overlap_new_covers_old(char *buf, int len)
static int
insert_range_overlap_old_covers_new(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_MVC *m;
- Ewl_Selection *sel;
- int count;
-
- t = ewl_tree_new();
- m = EWL_MVC(t);
-
- ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 9, 9);
- ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 5, 5);
-
- count = ecore_list_count(m->selected);
- if (count != 1)
- {
- LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
- return FALSE;
- }
-
- sel = ecore_list_index_goto(m->selected, 0);
- if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 9, 9))
- return FALSE;
-
- return TRUE;
+ Ewl_Widget *t;
+ Ewl_MVC *m;
+ Ewl_Selection *sel;
+ int count;
+
+ t = ewl_tree_new();
+ m = EWL_MVC(t);
+
+ ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 9, 9);
+ ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 5, 5);
+
+ count = ecore_list_count(m->selected);
+ if (count != 1)
+ {
+ LOG_FAILURE(buf, len, "%d items in list instead of 1", count);
+ return FALSE;
+ }
+
+ sel = ecore_list_index_goto(m->selected, 0);
+ if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 9, 9))
+ return FALSE;
+
+ return TRUE;
}
static int
ewl_mvc_is_index(char *buf, int len, Ewl_Selection *sel,
- int row, int column)
+ int row, int column)
{
- Ewl_Selection_Idx *idx;
-
- if (sel->type != EWL_SELECTION_TYPE_INDEX)
- {
- LOG_FAILURE(buf, len, "Incorrect selection type");
- return FALSE;
- }
-
- idx = EWL_SELECTION_IDX(sel);
- if (((int)idx->row != row) || ((int)idx->column != column))
- {
- LOG_FAILURE(buf, len, "Incorrect indices in index "
- "([%d %d] vs [%d %d])",
- idx->row, idx->column,
- row, column);
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Selection_Idx *idx;
+
+ if (sel->type != EWL_SELECTION_TYPE_INDEX)
+ {
+ LOG_FAILURE(buf, len, "Incorrect selection type");
+ return FALSE;
+ }
+
+ idx = EWL_SELECTION_IDX(sel);
+ if (((int)idx->row != row) || ((int)idx->column != column))
+ {
+ LOG_FAILURE(buf, len, "Incorrect indices in index "
+ "([%d %d] vs [%d %d])",
+ idx->row, idx->column,
+ row, column);
+ return FALSE;
+ }
+
+ return TRUE;
}
static int
ewl_mvc_is_range(char *buf, int len, Ewl_Selection *sel,
- int srow, int scolumn,
- int erow, int ecolumn)
+ int srow, int scolumn,
+ int erow, int ecolumn)
{
- Ewl_Selection_Range *rng;
-
- if (sel->type != EWL_SELECTION_TYPE_RANGE)
- {
- LOG_FAILURE(buf, len, "Incorrect selection type");
- return FALSE;
- }
-
- rng = EWL_SELECTION_RANGE(sel);
- if (((int)rng->start.row != srow) || ((int)rng->start.column != scolumn))
- {
- LOG_FAILURE(buf, len, "Start row/column incorrect "
- "([%d %d] vs [%d %d])",
- rng->start.row, rng->start.column,
- srow, scolumn);
- return FALSE;
- }
-
- if (((int)rng->end.row != erow) || ((int)rng->end.column != ecolumn))
- {
- LOG_FAILURE(buf, len, "End row/column incorrect "
- "([%d %d] vs [%d %d])",
- rng->end.row, rng->end.column,
- erow, ecolumn);
- return FALSE;
- }
-
- return TRUE;
+ Ewl_Selection_Range *rng;
+
+ if (sel->type != EWL_SELECTION_TYPE_RANGE)
+ {
+ LOG_FAILURE(buf, len, "Incorrect selection type");
+ return FALSE;
+ }
+
+ rng = EWL_SELECTION_RANGE(sel);
+ if (((int)rng->start.row != srow) || ((int)rng->start.column != scolumn))
+ {
+ LOG_FAILURE(buf, len, "Start row/column incorrect "
+ "([%d %d] vs [%d %d])",
+ rng->start.row, rng->start.column,
+ srow, scolumn);
+ return FALSE;
+ }
+
+ if (((int)rng->end.row != erow) || ((int)rng->end.column != ecolumn))
+ {
+ LOG_FAILURE(buf, len, "End row/column incorrect "
+ "([%d %d] vs [%d %d])",
+ rng->end.row, rng->end.column,
+ erow, ecolumn);
+ return FALSE;
+ }
+
+ return TRUE;
}
diff --git a/src/bin/tests/notebook/ewl_notebook_test.c b/src/bin/tests/notebook/ewl_notebook_test.c
index 73ebc83..0551dc6 100644
--- a/src/bin/tests/notebook/ewl_notebook_test.c
+++ b/src/bin/tests/notebook/ewl_notebook_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,328 +24,328 @@ static int count = 1;
void
test_info(Ewl_Test *test)
{
- test->name = "Notebook";
- test->tip = "Provides a container whose children\n"
- "are pages that can be switched\n"
- "between using tab labels along one\nedge";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Notebook";
+ test->tip = "Provides a container whose children\n"
+ "are pages that can be switched\n"
+ "between using tab labels along one\nedge";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *n, *o, *o2;
- char buf[10];
-
- n = ewl_notebook_new();
- ewl_container_child_append(EWL_CONTAINER(box), n);
- ewl_widget_name_set(n, "notebook");
- ewl_widget_show(n);
-
- /* append 3 pages */
- for (count = 1; count < 4; count++)
- {
- o2 = ewl_label_new();
- snprintf(buf, sizeof(buf), "Page %d", count);
- ewl_label_text_set(EWL_LABEL(o2), buf);
- ewl_widget_show(o2);
-
- o = create_page(buf);
- ewl_container_child_append(EWL_CONTAINER(n), o);
- ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
- ewl_widget_show(o);
- }
-
- /* insert a page after the first */
- o2 = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o2), "Page 1.5");
- ewl_widget_show(o2);
-
- o = create_page("Page 1.5");
- ewl_container_child_insert(EWL_CONTAINER(n), o, 1);
- ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
- ewl_widget_show(o);
-
- /* prepend the main page */
- o = create_main_page();
- ewl_container_child_prepend(EWL_CONTAINER(n), o);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), o, "Main");
- ewl_widget_show(o);
-
- ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), o);
-
- return 1;
+ Ewl_Widget *n, *o, *o2;
+ char buf[10];
+
+ n = ewl_notebook_new();
+ ewl_container_child_append(EWL_CONTAINER(box), n);
+ ewl_widget_name_set(n, "notebook");
+ ewl_widget_show(n);
+
+ /* append 3 pages */
+ for (count = 1; count < 4; count++)
+ {
+ o2 = ewl_label_new();
+ snprintf(buf, sizeof(buf), "Page %d", count);
+ ewl_label_text_set(EWL_LABEL(o2), buf);
+ ewl_widget_show(o2);
+
+ o = create_page(buf);
+ ewl_container_child_append(EWL_CONTAINER(n), o);
+ ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
+ ewl_widget_show(o);
+ }
+
+ /* insert a page after the first */
+ o2 = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o2), "Page 1.5");
+ ewl_widget_show(o2);
+
+ o = create_page("Page 1.5");
+ ewl_container_child_insert(EWL_CONTAINER(n), o, 1);
+ ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
+ ewl_widget_show(o);
+
+ /* prepend the main page */
+ o = create_main_page();
+ ewl_container_child_prepend(EWL_CONTAINER(n), o);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(n), o, "Main");
+ ewl_widget_show(o);
+
+ ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), o);
+
+ return 1;
}
static void
notebook_cb_toggle_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *n;
+ Ewl_Widget *n;
- n = ewl_widget_name_find("notebook");
- ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(n),
- !ewl_notebook_tabbar_visible_get(EWL_NOTEBOOK(n)));
+ n = ewl_widget_name_find("notebook");
+ ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(n),
+ !ewl_notebook_tabbar_visible_get(EWL_NOTEBOOK(n)));
}
static void
notebook_cb_homogeneous_toggle_clicked(Ewl_Widget *w __UNUSED__,
- void *ev __UNUSED__, void *data __UNUSED__)
+ void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Widget *n;
+ Ewl_Widget *n;
- n = ewl_widget_name_find("notebook");
- ewl_notebook_tabbar_homogeneous_set(EWL_NOTEBOOK(n),
- !ewl_notebook_tabbar_homogeneous_get(EWL_NOTEBOOK(n)));
+ n = ewl_widget_name_find("notebook");
+ ewl_notebook_tabbar_homogeneous_set(EWL_NOTEBOOK(n),
+ !ewl_notebook_tabbar_homogeneous_get(EWL_NOTEBOOK(n)));
}
static void
notebook_change_align(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Widget *n;
- unsigned int align = EWL_FLAG_ALIGN_CENTER;
- char *pos;
-
- pos = data;
- if (!strcmp(pos, "Top"))
- align = EWL_FLAG_ALIGN_TOP;
- else if (!strcmp(pos, "Bottom"))
- align = EWL_FLAG_ALIGN_BOTTOM;
- else if (!strcmp(pos, "Left"))
- align = EWL_FLAG_ALIGN_LEFT;
- else if (!strcmp(pos, "Right"))
- align = EWL_FLAG_ALIGN_RIGHT;
- else if (!strcmp(pos, "Center"))
- align = EWL_FLAG_ALIGN_CENTER;
-
- n = ewl_widget_name_find("notebook");
- ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(n), align);
+ Ewl_Widget *n;
+ unsigned int align = EWL_FLAG_ALIGN_CENTER;
+ char *pos;
+
+ pos = data;
+ if (!strcmp(pos, "Top"))
+ align = EWL_FLAG_ALIGN_TOP;
+ else if (!strcmp(pos, "Bottom"))
+ align = EWL_FLAG_ALIGN_BOTTOM;
+ else if (!strcmp(pos, "Left"))
+ align = EWL_FLAG_ALIGN_LEFT;
+ else if (!strcmp(pos, "Right"))
+ align = EWL_FLAG_ALIGN_RIGHT;
+ else if (!strcmp(pos, "Center"))
+ align = EWL_FLAG_ALIGN_CENTER;
+
+ n = ewl_widget_name_find("notebook");
+ ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(n), align);
}
static void
notebook_change_position(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Widget *n;
- unsigned int align = EWL_POSITION_TOP;
- char *pos;
-
- pos = data;
- if (!strcmp(pos, "Top"))
- align = EWL_POSITION_TOP;
- else if (!strcmp(pos, "Bottom"))
- align = EWL_POSITION_BOTTOM;
- else if (!strcmp(pos, "Left"))
- align = EWL_POSITION_LEFT;
- else if (!strcmp(pos, "Right"))
- align = EWL_POSITION_RIGHT;
-
- n = ewl_widget_name_find("notebook");
- ewl_notebook_tabbar_position_set(EWL_NOTEBOOK(n), align);
+ Ewl_Widget *n;
+ unsigned int align = EWL_POSITION_TOP;
+ char *pos;
+
+ pos = data;
+ if (!strcmp(pos, "Top"))
+ align = EWL_POSITION_TOP;
+ else if (!strcmp(pos, "Bottom"))
+ align = EWL_POSITION_BOTTOM;
+ else if (!strcmp(pos, "Left"))
+ align = EWL_POSITION_LEFT;
+ else if (!strcmp(pos, "Right"))
+ align = EWL_POSITION_RIGHT;
+
+ n = ewl_widget_name_find("notebook");
+ ewl_notebook_tabbar_position_set(EWL_NOTEBOOK(n), align);
}
static void
notebook_append_page(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *o2, *o, *vis, *n;
- char buf[10];
- int idx;
+ Ewl_Widget *o2, *o, *vis, *n;
+ char buf[10];
+ int idx;
- n = ewl_widget_name_find("notebook");
+ n = ewl_widget_name_find("notebook");
- vis = ewl_notebook_visible_page_get(EWL_NOTEBOOK(n));
- idx = ewl_container_child_index_get(EWL_CONTAINER(n), vis);
+ vis = ewl_notebook_visible_page_get(EWL_NOTEBOOK(n));
+ idx = ewl_container_child_index_get(EWL_CONTAINER(n), vis);
- o2 = ewl_label_new();
- snprintf(buf, sizeof(buf), "Page %d", count++);
- ewl_label_text_set(EWL_LABEL(o2), buf);
- ewl_widget_show(o2);
+ o2 = ewl_label_new();
+ snprintf(buf, sizeof(buf), "Page %d", count++);
+ ewl_label_text_set(EWL_LABEL(o2), buf);
+ ewl_widget_show(o2);
- o = create_page(buf);
- ewl_container_child_insert(EWL_CONTAINER(n), o, idx + 1);
- ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
- ewl_widget_show(o);
+ o = create_page(buf);
+ ewl_container_child_insert(EWL_CONTAINER(n), o, idx + 1);
+ ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
+ ewl_widget_show(o);
}
static void
notebook_prepend_page(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *n, *o2, *o, *vis;
- char buf[10];
- int idx;
+ Ewl_Widget *n, *o2, *o, *vis;
+ char buf[10];
+ int idx;
- n = ewl_widget_name_find("notebook");
+ n = ewl_widget_name_find("notebook");
- vis = ewl_notebook_visible_page_get(EWL_NOTEBOOK(n));
- idx = ewl_container_child_index_get(EWL_CONTAINER(n), vis);
+ vis = ewl_notebook_visible_page_get(EWL_NOTEBOOK(n));
+ idx = ewl_container_child_index_get(EWL_CONTAINER(n), vis);
- o2 = ewl_label_new();
- snprintf(buf, sizeof(buf), "Page %d", count++);
- ewl_label_text_set(EWL_LABEL(o2), buf);
- ewl_widget_show(o2);
+ o2 = ewl_label_new();
+ snprintf(buf, sizeof(buf), "Page %d", count++);
+ ewl_label_text_set(EWL_LABEL(o2), buf);
+ ewl_widget_show(o2);
- o = create_page(buf);
- ewl_container_child_insert(EWL_CONTAINER(n), o, idx);
- ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
- ewl_widget_show(o);
+ o = create_page(buf);
+ ewl_container_child_insert(EWL_CONTAINER(n), o, idx);
+ ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(n), o, o2);
+ ewl_widget_show(o);
}
static void
notebook_delete_page(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Widget *n;
+ Ewl_Widget *n;
- n = ewl_widget_name_find("notebook");
- ewl_container_child_remove(EWL_CONTAINER(n), EWL_WIDGET(data));
+ n = ewl_widget_name_find("notebook");
+ ewl_container_child_remove(EWL_CONTAINER(n), EWL_WIDGET(data));
}
static Ewl_Widget *
create_main_page(void)
{
- Ewl_Widget *box2, *o, *o2 = NULL, *body, *border;
- unsigned int i;
- char *alignment[] = {"Top", "Left", "Center", "Right", "Bottom"};
- char *position[] = {"Top", "Left", "Right", "Bottom"};
-
- /* box to hold everything */
- body = ewl_vbox_new();
-
- /* title label */
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), "Main");
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(body), o);
- ewl_widget_show(o);
-
- /* box to hold alignment and position lists */
- box2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(body), box2);
- ewl_widget_show(box2);
-
- /* box to hold alignment list */
- border = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(border), "Tabbar Alignment");
- ewl_container_child_append(EWL_CONTAINER(box2), border);
- ewl_widget_show(border);
-
- for (i = 0; i < (sizeof(alignment) / sizeof(char *)); i++)
- {
- o = ewl_radiobutton_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(o), alignment[i]);
- ewl_container_child_append(EWL_CONTAINER(border), o);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- notebook_change_align, alignment[i]);
-
- if (o2) ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o),
- EWL_RADIOBUTTON(o2));
-
- if (!strcmp(alignment[i], "Center"))
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
-
- ewl_widget_show(o);
-
- o2 = o;
- }
-
- /* box to hold position list */
- border = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(border), "Tabbar Position");
- ewl_container_child_append(EWL_CONTAINER(box2), border);
- ewl_widget_show(border);
-
- o2 = NULL;
- for (i = 0; i < (sizeof(position) / sizeof(char *)); i++)
- {
- o = ewl_radiobutton_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(o), position[i]);
- ewl_container_child_append(EWL_CONTAINER(border), o);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- notebook_change_position, position[i]);
-
- if (o2) ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o),
- EWL_RADIOBUTTON(o2));
-
- if (!strcmp(alignment[i], "Top"))
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
-
- ewl_widget_show(o);
-
- o2 = o;
- }
-
- o = ewl_checkbutton_new();
- ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
- ewl_button_label_set(EWL_BUTTON(o), "Show tabbar");
- ewl_container_child_append(EWL_CONTAINER(body), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- notebook_cb_toggle_clicked, NULL);
- ewl_widget_show(o);
-
- o = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(o), "Homogeneous tabbar");
- ewl_container_child_append(EWL_CONTAINER(body), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- notebook_cb_homogeneous_toggle_clicked, NULL);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_widget_show(o);
-
- return body;
+ Ewl_Widget *box2, *o, *o2 = NULL, *body, *border;
+ unsigned int i;
+ char *alignment[] = {"Top", "Left", "Center", "Right", "Bottom"};
+ char *position[] = {"Top", "Left", "Right", "Bottom"};
+
+ /* box to hold everything */
+ body = ewl_vbox_new();
+
+ /* title label */
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), "Main");
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(body), o);
+ ewl_widget_show(o);
+
+ /* box to hold alignment and position lists */
+ box2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(body), box2);
+ ewl_widget_show(box2);
+
+ /* box to hold alignment list */
+ border = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(border), "Tabbar Alignment");
+ ewl_container_child_append(EWL_CONTAINER(box2), border);
+ ewl_widget_show(border);
+
+ for (i = 0; i < (sizeof(alignment) / sizeof(char *)); i++)
+ {
+ o = ewl_radiobutton_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(o), alignment[i]);
+ ewl_container_child_append(EWL_CONTAINER(border), o);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ notebook_change_align, alignment[i]);
+
+ if (o2) ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o),
+ EWL_RADIOBUTTON(o2));
+
+ if (!strcmp(alignment[i], "Center"))
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
+
+ ewl_widget_show(o);
+
+ o2 = o;
+ }
+
+ /* box to hold position list */
+ border = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(border), "Tabbar Position");
+ ewl_container_child_append(EWL_CONTAINER(box2), border);
+ ewl_widget_show(border);
+
+ o2 = NULL;
+ for (i = 0; i < (sizeof(position) / sizeof(char *)); i++)
+ {
+ o = ewl_radiobutton_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(o), position[i]);
+ ewl_container_child_append(EWL_CONTAINER(border), o);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ notebook_change_position, position[i]);
+
+ if (o2) ewl_radiobutton_chain_set(EWL_RADIOBUTTON(o),
+ EWL_RADIOBUTTON(o2));
+
+ if (!strcmp(alignment[i], "Top"))
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
+
+ ewl_widget_show(o);
+
+ o2 = o;
+ }
+
+ o = ewl_checkbutton_new();
+ ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), TRUE);
+ ewl_button_label_set(EWL_BUTTON(o), "Show tabbar");
+ ewl_container_child_append(EWL_CONTAINER(body), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ notebook_cb_toggle_clicked, NULL);
+ ewl_widget_show(o);
+
+ o = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Homogeneous tabbar");
+ ewl_container_child_append(EWL_CONTAINER(body), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ notebook_cb_homogeneous_toggle_clicked, NULL);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_widget_show(o);
+
+ return body;
}
static Ewl_Widget *
create_page(const char *name)
{
- Ewl_Widget *box, *box2, *o;
-
- box = ewl_vbox_new();
- ewl_box_spacing_set(EWL_BOX(box), 10);
- ewl_widget_show(box);
-
- o = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(o), name);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- box2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), box2);
- ewl_object_alignment_set(EWL_OBJECT(box2), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(box2);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Prepend Page");
- ewl_container_child_append(EWL_CONTAINER(box2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- notebook_prepend_page, box);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Append Page");
- ewl_container_child_append(EWL_CONTAINER(box2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- notebook_append_page, box);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Remove This Page");
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- notebook_delete_page, box);
- ewl_widget_show(o);
-
- return box;
+ Ewl_Widget *box, *box2, *o;
+
+ box = ewl_vbox_new();
+ ewl_box_spacing_set(EWL_BOX(box), 10);
+ ewl_widget_show(box);
+
+ o = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(o), name);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ box2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), box2);
+ ewl_object_alignment_set(EWL_OBJECT(box2), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(box2);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Prepend Page");
+ ewl_container_child_append(EWL_CONTAINER(box2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ notebook_prepend_page, box);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Append Page");
+ ewl_container_child_append(EWL_CONTAINER(box2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ notebook_append_page, box);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Remove This Page");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ notebook_delete_page, box);
+ ewl_widget_show(o);
+
+ return box;
}
diff --git a/src/bin/tests/object/ewl_object_test.c b/src/bin/tests/object/ewl_object_test.c
index ee04db7..60b9c38 100644
--- a/src/bin/tests/object/ewl_object_test.c
+++ b/src/bin/tests/object/ewl_object_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"
@@ -40,38 +40,38 @@ static int fill_policy_test_set_get(char *buf, int len);
static int alignment_test_set_get(char *buf, int len);
static Ewl_Unit_Test object_unit_tests[] = {
- {"default properties", default_property_test, NULL, -1, 0},
- {"place center/get", place_test_center_get, NULL, -1, 0},
- {"place top/get", place_test_top_get, NULL, -1, 0},
- {"place bottom/get", place_test_bottom_get, NULL, -1, 0},
- {"place left/get", place_test_left_get, NULL, -1, 0},
- {"place right/get", place_test_right_get, NULL, -1, 0},
- {"position set/get", position_test_set_get, NULL, -1, 0},
- {"position size set/get", position_size_test_set_get, NULL, -1, 0},
- {"preferred inner size set/get", preferred_inner_size_test_set_get, NULL, -1, 0},
- {"preferred size set/get", preferred_size_test_set_get, NULL, -1, 0},
- {"minimum size set/get", minimum_size_test_set_get, NULL, -1, 0},
- {"maximum size set/get", maximum_size_test_set_get, NULL, -1, 0},
- {"minimum size set/request", minimum_size_test_set_request, NULL, -1, 0},
- {"maximum size set/request", maximum_size_test_set_request, NULL, -1, 0},
- {"padding set/get", padding_test_set_get, NULL, -1, 0},
- {"insets set/get", insets_test_set_get, NULL, -1, 0},
- {"padding set/size get", padding_test_set_size_get, NULL, -1, 0},
- {"insets set/size get", insets_test_set_size_get, NULL, -1, 0},
- {"insets padding set/size get", insets_padding_test_set_size_get, NULL, -1, 0},
- {"fill policy set/get", fill_policy_test_set_get, NULL, -1, 0},
- {"alignment set/get", alignment_test_set_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"default properties", default_property_test, NULL, -1, 0},
+ {"place center/get", place_test_center_get, NULL, -1, 0},
+ {"place top/get", place_test_top_get, NULL, -1, 0},
+ {"place bottom/get", place_test_bottom_get, NULL, -1, 0},
+ {"place left/get", place_test_left_get, NULL, -1, 0},
+ {"place right/get", place_test_right_get, NULL, -1, 0},
+ {"position set/get", position_test_set_get, NULL, -1, 0},
+ {"position size set/get", position_size_test_set_get, NULL, -1, 0},
+ {"preferred inner size set/get", preferred_inner_size_test_set_get, NULL, -1, 0},
+ {"preferred size set/get", preferred_size_test_set_get, NULL, -1, 0},
+ {"minimum size set/get", minimum_size_test_set_get, NULL, -1, 0},
+ {"maximum size set/get", maximum_size_test_set_get, NULL, -1, 0},
+ {"minimum size set/request", minimum_size_test_set_request, NULL, -1, 0},
+ {"maximum size set/request", maximum_size_test_set_request, NULL, -1, 0},
+ {"padding set/get", padding_test_set_get, NULL, -1, 0},
+ {"insets set/get", insets_test_set_get, NULL, -1, 0},
+ {"padding set/size get", padding_test_set_size_get, NULL, -1, 0},
+ {"insets set/size get", insets_test_set_size_get, NULL, -1, 0},
+ {"insets padding set/size get", insets_padding_test_set_size_get, NULL, -1, 0},
+ {"fill policy set/get", fill_policy_test_set_get, NULL, -1, 0},
+ {"alignment set/get", alignment_test_set_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Object";
- test->tip = "The base object type.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->unit_tests = object_unit_tests;
+ test->name = "Object";
+ test->tip = "The base object type.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->unit_tests = object_unit_tests;
}
/*
@@ -80,98 +80,98 @@ test_info(Ewl_Test *test)
static int
default_property_test(char *buf, int len)
{
- Ewl_Widget *w;
- int l, r, t, b;
- int ret = 0;
-
- w = ewl_widget_new();
-
- if (ewl_object_current_x_get(EWL_OBJECT(w))) {
- LOG_FAILURE(buf, len, "x coordinate incorrect");
- goto DONE;
- }
-
- if (ewl_object_current_y_get(EWL_OBJECT(w))) {
- LOG_FAILURE(buf, len, "y coordinate incorrect");
- goto DONE;
- }
-
- if (ewl_object_current_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
- LOG_FAILURE(buf, len, "current width incorrect");
- goto DONE;
- }
-
- if (ewl_object_current_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
- LOG_FAILURE(buf, len, "current height incorrect");
- goto DONE;
- }
-
- if (ewl_object_minimum_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
- LOG_FAILURE(buf, len, "minimum width incorrect");
- goto DONE;
- }
-
- if (ewl_object_minimum_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
- LOG_FAILURE(buf, len, "minimum height incorrect");
- goto DONE;
- }
-
- if (ewl_object_maximum_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MAX_SIZE) {
- LOG_FAILURE(buf, len, "maximum width incorrect");
- goto DONE;
- }
-
- if (ewl_object_maximum_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MAX_SIZE) {
- LOG_FAILURE(buf, len, "maximum height incorrect");
- goto DONE;
- }
-
- if (ewl_object_preferred_inner_w_get(EWL_OBJECT(w))) {
- LOG_FAILURE(buf, len, "preferred inner width incorrect");
- goto DONE;
- }
-
- if (ewl_object_preferred_inner_h_get(EWL_OBJECT(w))) {
- LOG_FAILURE(buf, len, "preferred inner height incorrect");
- goto DONE;
- }
-
- if (ewl_object_preferred_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
- LOG_FAILURE(buf, len, "preferred width incorrect");
- goto DONE;
- }
-
- if (ewl_object_preferred_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
- LOG_FAILURE(buf, len, "preferred height incorrect");
- goto DONE;
- }
-
- ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
- if (l || r || t || b) {
- LOG_FAILURE(buf, len, "insets incorrect");
- goto DONE;
- }
-
- ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
- if (l || r || t || b) {
- LOG_FAILURE(buf, len, "padding incorrect");
- goto DONE;
- }
-
- if (ewl_object_fill_policy_get(EWL_OBJECT(w)) != EWL_FLAG_FILL_NORMAL) {
- LOG_FAILURE(buf, len, "fill policy incorrect");
- goto DONE;
- }
-
- if (ewl_object_alignment_get(EWL_OBJECT(w)) != EWL_FLAG_ALIGN_CENTER) {
- LOG_FAILURE(buf, len, "alignment incorrect");
- goto DONE;
- }
-
- ret = 1;
+ Ewl_Widget *w;
+ int l, r, t, b;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ if (ewl_object_current_x_get(EWL_OBJECT(w))) {
+ LOG_FAILURE(buf, len, "x coordinate incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_current_y_get(EWL_OBJECT(w))) {
+ LOG_FAILURE(buf, len, "y coordinate incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_current_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
+ LOG_FAILURE(buf, len, "current width incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_current_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
+ LOG_FAILURE(buf, len, "current height incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_minimum_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
+ LOG_FAILURE(buf, len, "minimum width incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_minimum_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
+ LOG_FAILURE(buf, len, "minimum height incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_maximum_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MAX_SIZE) {
+ LOG_FAILURE(buf, len, "maximum width incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_maximum_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MAX_SIZE) {
+ LOG_FAILURE(buf, len, "maximum height incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_preferred_inner_w_get(EWL_OBJECT(w))) {
+ LOG_FAILURE(buf, len, "preferred inner width incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_preferred_inner_h_get(EWL_OBJECT(w))) {
+ LOG_FAILURE(buf, len, "preferred inner height incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_preferred_w_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
+ LOG_FAILURE(buf, len, "preferred width incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_preferred_h_get(EWL_OBJECT(w)) != EWL_OBJECT_MIN_SIZE) {
+ LOG_FAILURE(buf, len, "preferred height incorrect");
+ goto DONE;
+ }
+
+ ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+ if (l || r || t || b) {
+ LOG_FAILURE(buf, len, "insets incorrect");
+ goto DONE;
+ }
+
+ ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
+ if (l || r || t || b) {
+ LOG_FAILURE(buf, len, "padding incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_fill_policy_get(EWL_OBJECT(w)) != EWL_FLAG_FILL_NORMAL) {
+ LOG_FAILURE(buf, len, "fill policy incorrect");
+ goto DONE;
+ }
+
+ if (ewl_object_alignment_get(EWL_OBJECT(w)) != EWL_FLAG_ALIGN_CENTER) {
+ LOG_FAILURE(buf, len, "alignment incorrect");
+ goto DONE;
+ }
+
+ ret = 1;
DONE:
- ewl_widget_destroy(w);
- return ret;
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -180,28 +180,28 @@ DONE:
static int
place_test_center_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y, width, height;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y, width, height;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_CENTER);
- ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
- if (x == 5 && y == 10 && width == 10 && height == 20)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect center align placement");
+ if (x == 5 && y == 10 && width == 10 && height == 20)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect center align placement");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -210,28 +210,28 @@ place_test_center_get(char *buf, int len)
static int
place_test_top_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y, width, height;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y, width, height;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_TOP);
- ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_TOP);
+ ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
- if (x == 5 && y == 0 && width == 10 && height == 20)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect top align placement");
+ if (x == 5 && y == 0 && width == 10 && height == 20)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect top align placement");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -240,28 +240,28 @@ place_test_top_get(char *buf, int len)
static int
place_test_bottom_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y, width, height;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y, width, height;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_BOTTOM);
- ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_BOTTOM);
+ ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
- if (x == 5 && y == 20 && width == 10 && height == 20)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect bottom align placement");
+ if (x == 5 && y == 20 && width == 10 && height == 20)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect bottom align placement");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -270,28 +270,28 @@ place_test_bottom_get(char *buf, int len)
static int
place_test_left_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y, width, height;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y, width, height;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
- ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT);
+ ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
- if (x == 0 && y == 10 && width == 10 && height == 20)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect left align placement");
+ if (x == 0 && y == 10 && width == 10 && height == 20)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect left align placement");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -300,28 +300,28 @@ place_test_left_get(char *buf, int len)
static int
place_test_right_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y, width, height;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y, width, height;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), 10, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_RIGHT);
- ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_RIGHT);
+ ewl_object_place(EWL_OBJECT(w), 0, 0, 20, 40);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
- if (x == 10 && y == 10 && width == 10 && height == 20)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect right align placement");
+ if (x == 10 && y == 10 && width == 10 && height == 20)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect right align placement");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -330,25 +330,25 @@ place_test_right_get(char *buf, int len)
static int
position_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_position_request(EWL_OBJECT(w), 11, 23);
+ ewl_object_position_request(EWL_OBJECT(w), 11, 23);
- x = ewl_object_current_x_get(EWL_OBJECT(w));
- y = ewl_object_current_y_get(EWL_OBJECT(w));
+ x = ewl_object_current_x_get(EWL_OBJECT(w));
+ y = ewl_object_current_y_get(EWL_OBJECT(w));
- if (x == 11 && y == 23)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect positions returned");
+ if (x == 11 && y == 23)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect positions returned");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -357,24 +357,24 @@ position_test_set_get(char *buf, int len)
static int
position_size_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int x, y, width, height;
- int ret = 0;
+ Ewl_Widget *w;
+ int x, y, width, height;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_geometry_request(EWL_OBJECT(w), 11, 23, 58, 13);
+ ewl_object_geometry_request(EWL_OBJECT(w), 11, 23, 58, 13);
- ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
+ ewl_object_current_geometry_get(EWL_OBJECT(w), &x, &y, &width, &height);
- if (x == 11 && y == 23 && width == 58 && height == 13)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect position or size returned");
+ if (x == 11 && y == 23 && width == 58 && height == 13)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect position or size returned");
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -384,40 +384,40 @@ position_size_test_set_get(char *buf, int len)
static int
preferred_inner_size_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
-
- w = ewl_widget_new();
-
- ewl_object_preferred_inner_size_get(EWL_OBJECT(w), &width, &height);
- if (width == 0 && height == 0) {
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), MATCH_SIZE,
- MATCH_SIZE);
- ewl_object_preferred_inner_size_get(EWL_OBJECT(w), &width,
- &height);
- if (width == MATCH_SIZE && height == MATCH_SIZE) {
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w),
- DIFFER_WIDTH,
- DIFFER_HEIGHT);
- ewl_object_preferred_inner_size_get(EWL_OBJECT(w),
- &width,
- &height);
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "preferred inner sizes match");
- }
- else
- LOG_FAILURE(buf, len, "preferred inner sizes differ");
- }
- else
- LOG_FAILURE(buf, len, "default preferred inner size %dx%d",
- width, height);
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == 0 && height == 0) {
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), MATCH_SIZE,
+ MATCH_SIZE);
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(w), &width,
+ &height);
+ if (width == MATCH_SIZE && height == MATCH_SIZE) {
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w),
+ DIFFER_WIDTH,
+ DIFFER_HEIGHT);
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(w),
+ &width,
+ &height);
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "preferred inner sizes match");
+ }
+ else
+ LOG_FAILURE(buf, len, "preferred inner sizes differ");
+ }
+ else
+ LOG_FAILURE(buf, len, "default preferred inner size %dx%d",
+ width, height);
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -427,40 +427,40 @@ preferred_inner_size_test_set_get(char *buf, int len)
static int
preferred_size_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
-
- w = ewl_widget_new();
-
- ewl_object_preferred_size_get(EWL_OBJECT(w), &width, &height);
- if (width == EWL_OBJECT_MIN_SIZE && height == EWL_OBJECT_MIN_SIZE) {
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w), MATCH_SIZE,
- MATCH_SIZE);
- ewl_object_preferred_inner_size_get(EWL_OBJECT(w), &width,
- &height);
- if (width == MATCH_SIZE && height == MATCH_SIZE) {
- ewl_object_preferred_inner_size_set(EWL_OBJECT(w),
- DIFFER_WIDTH,
- DIFFER_HEIGHT);
- ewl_object_preferred_inner_size_get(EWL_OBJECT(w),
- &width,
- &height);
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "preferred sizes match");
- }
- else
- LOG_FAILURE(buf, len, "preferred sizes differ");
- }
- else
- LOG_FAILURE(buf, len, "default preferred size %dx%d",
- width, height);
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ ewl_object_preferred_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == EWL_OBJECT_MIN_SIZE && height == EWL_OBJECT_MIN_SIZE) {
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w), MATCH_SIZE,
+ MATCH_SIZE);
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(w), &width,
+ &height);
+ if (width == MATCH_SIZE && height == MATCH_SIZE) {
+ ewl_object_preferred_inner_size_set(EWL_OBJECT(w),
+ DIFFER_WIDTH,
+ DIFFER_HEIGHT);
+ ewl_object_preferred_inner_size_get(EWL_OBJECT(w),
+ &width,
+ &height);
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "preferred sizes match");
+ }
+ else
+ LOG_FAILURE(buf, len, "preferred sizes differ");
+ }
+ else
+ LOG_FAILURE(buf, len, "default preferred size %dx%d",
+ width, height);
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -470,47 +470,47 @@ preferred_size_test_set_get(char *buf, int len)
static int
minimum_size_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_object_size_request(EWL_OBJECT(w), MATCH_SIZE - 1,
- MATCH_SIZE - 1);
-
- ewl_object_minimum_size_get(EWL_OBJECT(w), &width, &height);
- if (width == EWL_OBJECT_MIN_SIZE && height == EWL_OBJECT_MIN_SIZE) {
- ewl_object_minimum_size_set(EWL_OBJECT(w), DIFFER_WIDTH,
- DIFFER_HEIGHT);
- ewl_object_minimum_size_get(EWL_OBJECT(w), &width, &height);
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
- ewl_object_minimum_size_set(EWL_OBJECT(w),
- MATCH_SIZE,
- MATCH_SIZE);
- ewl_object_minimum_size_get(EWL_OBJECT(w), &width,
- &height);
- if (width == MATCH_SIZE && height == MATCH_SIZE) {
- ewl_object_current_size_get(EWL_OBJECT(w),
- &width, &height);
- if (width == MATCH_SIZE && height == MATCH_SIZE)
- ret = 1;
- else
- LOG_FAILURE(buf, len,
- "current size wrong");
- }
- else
- LOG_FAILURE(buf, len, "minimum sizes match");
- }
- else
- LOG_FAILURE(buf, len, "minimum sizes differ");
- }
- else
- LOG_FAILURE(buf, len, "default minimum size %dx%d",
- width, height);
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_object_size_request(EWL_OBJECT(w), MATCH_SIZE - 1,
+ MATCH_SIZE - 1);
+
+ ewl_object_minimum_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == EWL_OBJECT_MIN_SIZE && height == EWL_OBJECT_MIN_SIZE) {
+ ewl_object_minimum_size_set(EWL_OBJECT(w), DIFFER_WIDTH,
+ DIFFER_HEIGHT);
+ ewl_object_minimum_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
+ ewl_object_minimum_size_set(EWL_OBJECT(w),
+ MATCH_SIZE,
+ MATCH_SIZE);
+ ewl_object_minimum_size_get(EWL_OBJECT(w), &width,
+ &height);
+ if (width == MATCH_SIZE && height == MATCH_SIZE) {
+ ewl_object_current_size_get(EWL_OBJECT(w),
+ &width, &height);
+ if (width == MATCH_SIZE && height == MATCH_SIZE)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len,
+ "current size wrong");
+ }
+ else
+ LOG_FAILURE(buf, len, "minimum sizes match");
+ }
+ else
+ LOG_FAILURE(buf, len, "minimum sizes differ");
+ }
+ else
+ LOG_FAILURE(buf, len, "default minimum size %dx%d",
+ width, height);
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -520,48 +520,48 @@ minimum_size_test_set_get(char *buf, int len)
static int
maximum_size_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH + 1,
- DIFFER_HEIGHT + 1);
-
- ewl_object_maximum_size_get(EWL_OBJECT(w), &width, &height);
- if (width == EWL_OBJECT_MAX_SIZE && height == EWL_OBJECT_MAX_SIZE) {
- ewl_object_maximum_size_set(EWL_OBJECT(w), MATCH_SIZE,
- MATCH_SIZE);
- ewl_object_maximum_size_get(EWL_OBJECT(w), &width, &height);
- if (width == MATCH_SIZE && height == MATCH_SIZE) {
- ewl_object_maximum_size_set(EWL_OBJECT(w),
- DIFFER_WIDTH,
- DIFFER_HEIGHT);
- ewl_object_maximum_size_get(EWL_OBJECT(w), &width,
- &height);
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
- ewl_object_current_size_get(EWL_OBJECT(w),
- &width, &height);
- if (width == DIFFER_WIDTH &&
- height == DIFFER_HEIGHT)
- ret = 1;
- else
- LOG_FAILURE(buf, len,
- "current size wrong");
- }
- else
- LOG_FAILURE(buf, len, "maximum sizes match");
- }
- else
- LOG_FAILURE(buf, len, "maximum sizes differ");
- }
- else
- LOG_FAILURE(buf, len, "default maximum size %dx%d",
- width, height);
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH + 1,
+ DIFFER_HEIGHT + 1);
+
+ ewl_object_maximum_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == EWL_OBJECT_MAX_SIZE && height == EWL_OBJECT_MAX_SIZE) {
+ ewl_object_maximum_size_set(EWL_OBJECT(w), MATCH_SIZE,
+ MATCH_SIZE);
+ ewl_object_maximum_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == MATCH_SIZE && height == MATCH_SIZE) {
+ ewl_object_maximum_size_set(EWL_OBJECT(w),
+ DIFFER_WIDTH,
+ DIFFER_HEIGHT);
+ ewl_object_maximum_size_get(EWL_OBJECT(w), &width,
+ &height);
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
+ ewl_object_current_size_get(EWL_OBJECT(w),
+ &width, &height);
+ if (width == DIFFER_WIDTH &&
+ height == DIFFER_HEIGHT)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len,
+ "current size wrong");
+ }
+ else
+ LOG_FAILURE(buf, len, "maximum sizes match");
+ }
+ else
+ LOG_FAILURE(buf, len, "maximum sizes differ");
+ }
+ else
+ LOG_FAILURE(buf, len, "default maximum size %dx%d",
+ width, height);
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -571,54 +571,54 @@ maximum_size_test_set_get(char *buf, int len)
static int
minimum_size_test_set_request(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
-
- w = ewl_widget_new();
-
- /*
- * Test the base case of the requested size equal to the minimum.
- */
- ewl_object_minimum_size_set(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
- ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
-
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
-
- /*
- * Verify a valid size not equal to the boundary.
- */
- ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH + 1,
- DIFFER_HEIGHT + 1);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
-
- if (width == DIFFER_WIDTH + 1 && height == DIFFER_HEIGHT + 1) {
-
- /*
- * Verify an invalid size is forced to the boundary.
- */
- ewl_object_size_request(EWL_OBJECT(w),
- DIFFER_WIDTH - 1,
- DIFFER_HEIGHT - 1);
- ewl_object_current_size_get(EWL_OBJECT(w), &width,
- &height);
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "min size ignored %dx%d",
- width, height);
- }
- else
- LOG_FAILURE(buf, len, "differing sizes wrong %dx%d",
- width, height);
- }
- else
- LOG_FAILURE(buf, len, "same sizes wrong %dx%d", width, height);
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ /*
+ * Test the base case of the requested size equal to the minimum.
+ */
+ ewl_object_minimum_size_set(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
+ ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
+
+ /*
+ * Verify a valid size not equal to the boundary.
+ */
+ ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH + 1,
+ DIFFER_HEIGHT + 1);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+
+ if (width == DIFFER_WIDTH + 1 && height == DIFFER_HEIGHT + 1) {
+
+ /*
+ * Verify an invalid size is forced to the boundary.
+ */
+ ewl_object_size_request(EWL_OBJECT(w),
+ DIFFER_WIDTH - 1,
+ DIFFER_HEIGHT - 1);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width,
+ &height);
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "min size ignored %dx%d",
+ width, height);
+ }
+ else
+ LOG_FAILURE(buf, len, "differing sizes wrong %dx%d",
+ width, height);
+ }
+ else
+ LOG_FAILURE(buf, len, "same sizes wrong %dx%d", width, height);
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -628,54 +628,54 @@ minimum_size_test_set_request(char *buf, int len)
static int
maximum_size_test_set_request(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
-
- w = ewl_widget_new();
-
- /*
- * Test the base case of the requested size equal to the maximum.
- */
- ewl_object_maximum_size_set(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
- ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
-
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
-
- /*
- * Verify a valid size not equal to the boundary.
- */
- ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH - 1,
- DIFFER_HEIGHT - 1);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
-
- if (width == DIFFER_WIDTH - 1 && height == DIFFER_HEIGHT - 1) {
-
- /*
- * Verify an invalid size is forced to the boundary.
- */
- ewl_object_size_request(EWL_OBJECT(w),
- DIFFER_WIDTH + 1,
- DIFFER_HEIGHT + 1);
- ewl_object_current_size_get(EWL_OBJECT(w), &width,
- &height);
- if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "max size ignored %dx%d",
- width, height);
- }
- else
- LOG_FAILURE(buf, len, "differing sizes wrong %dx%d",
- width, height);
- }
- else
- LOG_FAILURE(buf, len, "same sizes wrong %dx%d", width, height);
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ /*
+ * Test the base case of the requested size equal to the maximum.
+ */
+ ewl_object_maximum_size_set(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
+ ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH, DIFFER_HEIGHT);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT) {
+
+ /*
+ * Verify a valid size not equal to the boundary.
+ */
+ ewl_object_size_request(EWL_OBJECT(w), DIFFER_WIDTH - 1,
+ DIFFER_HEIGHT - 1);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+
+ if (width == DIFFER_WIDTH - 1 && height == DIFFER_HEIGHT - 1) {
+
+ /*
+ * Verify an invalid size is forced to the boundary.
+ */
+ ewl_object_size_request(EWL_OBJECT(w),
+ DIFFER_WIDTH + 1,
+ DIFFER_HEIGHT + 1);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width,
+ &height);
+ if (width == DIFFER_WIDTH && height == DIFFER_HEIGHT)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "max size ignored %dx%d",
+ width, height);
+ }
+ else
+ LOG_FAILURE(buf, len, "differing sizes wrong %dx%d",
+ width, height);
+ }
+ else
+ LOG_FAILURE(buf, len, "same sizes wrong %dx%d", width, height);
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -684,35 +684,35 @@ maximum_size_test_set_request(char *buf, int len)
static int
padding_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int l, r, t, b;
- int ret = 0;
-
- w = ewl_widget_new();
-
- ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
- if (l || r || t || b)
- LOG_FAILURE(buf, len, "initial padding not 0");
- else {
- ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
- ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
- if (l == 1 && r == 2 && t == 3 && b == 4) {
- l = ewl_object_padding_left_get(EWL_OBJECT(w));
- r = ewl_object_padding_right_get(EWL_OBJECT(w));
- t = ewl_object_padding_top_get(EWL_OBJECT(w));
- b = ewl_object_padding_bottom_get(EWL_OBJECT(w));
- if (l == 1 && r == 2 && t == 3 && b == 4)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect individual");
- }
- else
- LOG_FAILURE(buf, len, "incorrect returned padding");
- }
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int l, r, t, b;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
+ if (l || r || t || b)
+ LOG_FAILURE(buf, len, "initial padding not 0");
+ else {
+ ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
+ ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
+ if (l == 1 && r == 2 && t == 3 && b == 4) {
+ l = ewl_object_padding_left_get(EWL_OBJECT(w));
+ r = ewl_object_padding_right_get(EWL_OBJECT(w));
+ t = ewl_object_padding_top_get(EWL_OBJECT(w));
+ b = ewl_object_padding_bottom_get(EWL_OBJECT(w));
+ if (l == 1 && r == 2 && t == 3 && b == 4)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect individual");
+ }
+ else
+ LOG_FAILURE(buf, len, "incorrect returned padding");
+ }
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -721,35 +721,35 @@ padding_test_set_get(char *buf, int len)
static int
insets_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int l, r, t, b;
- int ret = 0;
-
- w = ewl_widget_new();
-
- ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
- if (l || r || t || b)
- LOG_FAILURE(buf, len, "initial insets not 0");
- else {
- ewl_object_insets_set(EWL_OBJECT(w), 1, 2, 3, 4);
- ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
- if (l == 1 && r == 2 && t == 3 && b == 4) {
- l = ewl_object_insets_left_get(EWL_OBJECT(w));
- r = ewl_object_insets_right_get(EWL_OBJECT(w));
- t = ewl_object_insets_top_get(EWL_OBJECT(w));
- b = ewl_object_insets_bottom_get(EWL_OBJECT(w));
- if (l == 1 && r == 2 && t == 3 && b == 4)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect individual");
- }
- else
- LOG_FAILURE(buf, len, "incorrect returned insets");
- }
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int l, r, t, b;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+ if (l || r || t || b)
+ LOG_FAILURE(buf, len, "initial insets not 0");
+ else {
+ ewl_object_insets_set(EWL_OBJECT(w), 1, 2, 3, 4);
+ ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+ if (l == 1 && r == 2 && t == 3 && b == 4) {
+ l = ewl_object_insets_left_get(EWL_OBJECT(w));
+ r = ewl_object_insets_right_get(EWL_OBJECT(w));
+ t = ewl_object_insets_top_get(EWL_OBJECT(w));
+ b = ewl_object_insets_bottom_get(EWL_OBJECT(w));
+ if (l == 1 && r == 2 && t == 3 && b == 4)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect individual");
+ }
+ else
+ LOG_FAILURE(buf, len, "incorrect returned insets");
+ }
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -759,25 +759,25 @@ insets_test_set_get(char *buf, int len)
static int
padding_test_set_size_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
+ ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
- if (width == (3 + EWL_OBJECT_MIN_SIZE) &&
- height == (7 + EWL_OBJECT_MIN_SIZE))
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect returned size %dx%d", width,
- height);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == (3 + EWL_OBJECT_MIN_SIZE) &&
+ height == (7 + EWL_OBJECT_MIN_SIZE))
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect returned size %dx%d", width,
+ height);
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -787,24 +787,24 @@ padding_test_set_size_get(char *buf, int len)
static int
insets_test_set_size_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_insets_set(EWL_OBJECT(w), 1, 2, 3, 4);
+ ewl_object_insets_set(EWL_OBJECT(w), 1, 2, 3, 4);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
- if (width == 4 && height == 8)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect returned size %dx%d", width,
- height);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == 4 && height == 8)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect returned size %dx%d", width,
+ height);
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -814,26 +814,26 @@ insets_test_set_size_get(char *buf, int len)
static int
insets_padding_test_set_size_get(char *buf, int len)
{
- Ewl_Widget *w;
- int width = 0, height = 0;
- int ret = 0;
+ Ewl_Widget *w;
+ int width = 0, height = 0;
+ int ret = 0;
- w = ewl_widget_new();
+ w = ewl_widget_new();
- ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
- ewl_object_insets_set(EWL_OBJECT(w), 4, 3, 2, 1);
+ ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
+ ewl_object_insets_set(EWL_OBJECT(w), 4, 3, 2, 1);
- ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
- if (width == (10 + EWL_OBJECT_MIN_SIZE) &&
- height == (10 + EWL_OBJECT_MIN_SIZE))
- ret = 1;
- else
- LOG_FAILURE(buf, len, "incorrect returned size %dx%d", width,
- height);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+ if (width == (10 + EWL_OBJECT_MIN_SIZE) &&
+ height == (10 + EWL_OBJECT_MIN_SIZE))
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "incorrect returned size %dx%d", width,
+ height);
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
- return ret;
+ return ret;
}
/*
@@ -843,34 +843,34 @@ insets_padding_test_set_size_get(char *buf, int len)
static int
fill_policy_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- unsigned int fill;
- int ret = 0;
-
- w = ewl_widget_new();
-
- /*
- * Since fill all should simply be a mask of all other values, this
- * tests each bit being set.
- */
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_ALL);
- fill = ewl_object_fill_policy_get(EWL_OBJECT(w));
-
- if ((fill & EWL_FLAG_FILL_HSHRINK) && (fill & EWL_FLAG_FILL_VSHRINK) &&
- (fill & EWL_FLAG_FILL_HFILL) && (fill & EWL_FLAG_FILL_VFILL)) {
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
- fill = ewl_object_fill_policy_get(EWL_OBJECT(w));
- if (!fill)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "fill none incorrect");
- }
- else
- LOG_FAILURE(buf, len, "fill all missing flags");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ unsigned int fill;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ /*
+ * Since fill all should simply be a mask of all other values, this
+ * tests each bit being set.
+ */
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_ALL);
+ fill = ewl_object_fill_policy_get(EWL_OBJECT(w));
+
+ if ((fill & EWL_FLAG_FILL_HSHRINK) && (fill & EWL_FLAG_FILL_VSHRINK) &&
+ (fill & EWL_FLAG_FILL_HFILL) && (fill & EWL_FLAG_FILL_VFILL)) {
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
+ fill = ewl_object_fill_policy_get(EWL_OBJECT(w));
+ if (!fill)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "fill none incorrect");
+ }
+ else
+ LOG_FAILURE(buf, len, "fill all missing flags");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -880,30 +880,30 @@ fill_policy_test_set_get(char *buf, int len)
static int
alignment_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- unsigned int align;
- int ret = 0;
-
- w = ewl_widget_new();
-
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT |
- EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_TOP |
- EWL_FLAG_ALIGN_BOTTOM);
- align = ewl_object_alignment_get(EWL_OBJECT(w));
-
- if ((align & EWL_FLAG_ALIGN_LEFT) && (align & EWL_FLAG_ALIGN_RIGHT) &&
- (align & EWL_FLAG_ALIGN_TOP) && (align & EWL_FLAG_ALIGN_BOTTOM)) {
- ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_CENTER);
- align = ewl_object_alignment_get(EWL_OBJECT(w));
- if (!align)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "align none incorrect");
- }
- else
- LOG_FAILURE(buf, len, "alignment missing flags");
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ unsigned int align;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_LEFT |
+ EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_TOP |
+ EWL_FLAG_ALIGN_BOTTOM);
+ align = ewl_object_alignment_get(EWL_OBJECT(w));
+
+ if ((align & EWL_FLAG_ALIGN_LEFT) && (align & EWL_FLAG_ALIGN_RIGHT) &&
+ (align & EWL_FLAG_ALIGN_TOP) && (align & EWL_FLAG_ALIGN_BOTTOM)) {
+ ewl_object_alignment_set(EWL_OBJECT(w), EWL_FLAG_ALIGN_CENTER);
+ align = ewl_object_alignment_get(EWL_OBJECT(w));
+ if (!align)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "align none incorrect");
+ }
+ else
+ LOG_FAILURE(buf, len, "alignment missing flags");
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
diff --git a/src/bin/tests/paned/ewl_paned_test.c b/src/bin/tests/paned/ewl_paned_test.c
index a793542..c8eb645 100644
--- a/src/bin/tests/paned/ewl_paned_test.c
+++ b/src/bin/tests/paned/ewl_paned_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,7 +8,7 @@
static int create_test(Ewl_Container *box);
static void ewl_paned_test_cb_clicked_destroy(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static void ewl_paned_test_cb_clicked(Ewl_Widget *w, void *ev, void *data);
static void ewl_paned_test_cb_add(Ewl_Widget *w, void *ev, void *data);
@@ -21,317 +21,317 @@ static int fixed_size_get(char *buf, int len);
static int fixed_size_unset_get(char *buf, int len);
static Ewl_Unit_Test paned_unit_tests[] = {
- {"get initial size", initial_size_get, NULL, -1, 0},
- {"get unset initial size", initial_size_unset_get, NULL, -1, 0},
- {"get initial size after remove", initial_size_after_remove_get, NULL, -1, 0},
- {"get initial size for many widgets", initial_size_many_get, NULL, -1, 0},
- {"get the fixed size flag", fixed_size_get, NULL, -1, 0},
- {"get the unset fixed size flag", fixed_size_unset_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"get initial size", initial_size_get, NULL, -1, 0},
+ {"get unset initial size", initial_size_unset_get, NULL, -1, 0},
+ {"get initial size after remove", initial_size_after_remove_get, NULL, -1, 0},
+ {"get initial size for many widgets", initial_size_many_get, NULL, -1, 0},
+ {"get the fixed size flag", fixed_size_get, NULL, -1, 0},
+ {"get the unset fixed size flag", fixed_size_unset_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Paned";
- test->tip = "Defines the Ewl_Paned to hold resizable panes.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
- test->unit_tests = paned_unit_tests;
+ test->name = "Paned";
+ test->tip = "Defines the Ewl_Paned to hold resizable panes.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
+ test->unit_tests = paned_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *pane1, *pane2, *pane3, *o, *pbox;
-
- pane1 = ewl_vpaned_new();
- ewl_container_child_append(EWL_CONTAINER(box), pane1);
- ewl_widget_show(pane1);
-
- pane2 = ewl_hpaned_new();
- ewl_container_child_append(EWL_CONTAINER(pane1), pane2);
- ewl_widget_show(pane2);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Fill");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(pane2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "Fill");
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "HFill | VShrink");
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_container_child_append(EWL_CONTAINER(pane2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "HFill | VShrink");
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "HShrink | VFill");
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
- ewl_container_child_append(EWL_CONTAINER(pane2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "HShrink | VFill");
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "shrink");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(pane2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "Shrink");
- ewl_widget_show(o);
-
- pane3 = ewl_hpaned_new();
- ewl_container_child_append(EWL_CONTAINER(pane1), pane3);
- ewl_widget_show(pane3);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Left Top");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(o),
- EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
- ewl_container_child_append(EWL_CONTAINER(pane3), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "Left Top");
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Center");
- 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(pane3), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "Center");
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Right Bottom");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(o),
- EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_BOTTOM);
- ewl_container_child_append(EWL_CONTAINER(pane3), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked, "Right Bottom");
- ewl_widget_show(o);
-
- pbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(pane1), pbox);
- ewl_object_fill_policy_set(EWL_OBJECT(pbox),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_NONE);
- ewl_widget_show(pbox);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Add to top pane");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_paned_test_cb_add, pane2);
- ewl_container_child_append(EWL_CONTAINER(pbox), o);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Add to bottom pane");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_paned_test_cb_add, pane3);
- ewl_container_child_append(EWL_CONTAINER(pbox), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *pane1, *pane2, *pane3, *o, *pbox;
+
+ pane1 = ewl_vpaned_new();
+ ewl_container_child_append(EWL_CONTAINER(box), pane1);
+ ewl_widget_show(pane1);
+
+ pane2 = ewl_hpaned_new();
+ ewl_container_child_append(EWL_CONTAINER(pane1), pane2);
+ ewl_widget_show(pane2);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Fill");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(pane2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "Fill");
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "HFill | VShrink");
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_container_child_append(EWL_CONTAINER(pane2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "HFill | VShrink");
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "HShrink | VFill");
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
+ ewl_container_child_append(EWL_CONTAINER(pane2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "HShrink | VFill");
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "shrink");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(pane2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "Shrink");
+ ewl_widget_show(o);
+
+ pane3 = ewl_hpaned_new();
+ ewl_container_child_append(EWL_CONTAINER(pane1), pane3);
+ ewl_widget_show(pane3);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Left Top");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(o),
+ EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
+ ewl_container_child_append(EWL_CONTAINER(pane3), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "Left Top");
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Center");
+ 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(pane3), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "Center");
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Right Bottom");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(o),
+ EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_BOTTOM);
+ ewl_container_child_append(EWL_CONTAINER(pane3), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked, "Right Bottom");
+ ewl_widget_show(o);
+
+ pbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(pane1), pbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(pbox),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_NONE);
+ ewl_widget_show(pbox);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Add to top pane");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_paned_test_cb_add, pane2);
+ ewl_container_child_append(EWL_CONTAINER(pbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Add to bottom pane");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_paned_test_cb_add, pane3);
+ ewl_container_child_append(EWL_CONTAINER(pbox), o);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
ewl_paned_test_cb_clicked(Ewl_Widget *w, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- printf("Clicked %s\n", (char *)data);
- ewl_widget_hide(w);
+ printf("Clicked %s\n", (char *)data);
+ ewl_widget_hide(w);
}
static void
ewl_paned_test_cb_clicked_destroy(Ewl_Widget *w, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- printf("Destroy Clicked %s\n", (char *)data);
- ewl_widget_destroy(w);
+ printf("Destroy Clicked %s\n", (char *)data);
+ ewl_widget_destroy(w);
}
static void
ewl_paned_test_cb_add(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Widget *o;
- Ewl_Paned *p;
-
- p = data;
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "New Button");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(p), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_paned_test_cb_clicked_destroy, "New Button");
- ewl_widget_show(o);
+ Ewl_Widget *o;
+ Ewl_Paned *p;
+
+ p = data;
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "New Button");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(p), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_paned_test_cb_clicked_destroy, "New Button");
+ ewl_widget_show(o);
}
static int
initial_size_get(char *buf, int len)
{
- Ewl_Widget *paned;
- Ewl_Widget *child;
- int ret = 1;
- int val;
+ Ewl_Widget *paned;
+ Ewl_Widget *child;
+ int ret = 1;
+ int val;
- paned = ewl_paned_new();
- child = ewl_cell_new();
+ paned = ewl_paned_new();
+ child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(paned), child);
- ewl_paned_initial_size_set(EWL_PANED(paned), child, 240);
- val = ewl_paned_initial_size_get(EWL_PANED(paned), child);
+ ewl_container_child_append(EWL_CONTAINER(paned), child);
+ ewl_paned_initial_size_set(EWL_PANED(paned), child, 240);
+ val = ewl_paned_initial_size_get(EWL_PANED(paned), child);
- if (val != 240) {
- LOG_FAILURE(buf, len, "get value is different from the set one");
- ret = 0;
- }
+ if (val != 240) {
+ LOG_FAILURE(buf, len, "get value is different from the set one");
+ ret = 0;
+ }
- ewl_widget_destroy(paned);
+ ewl_widget_destroy(paned);
- return ret;
+ return ret;
}
static int
initial_size_unset_get(char *buf, int len)
{
- Ewl_Widget *paned;
- Ewl_Widget *child;
- int ret = 1;
- int val;
+ Ewl_Widget *paned;
+ Ewl_Widget *child;
+ int ret = 1;
+ int val;
- paned = ewl_paned_new();
- child = ewl_cell_new();
+ paned = ewl_paned_new();
+ child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(paned), child);
- val = ewl_paned_initial_size_get(EWL_PANED(paned), child);
+ ewl_container_child_append(EWL_CONTAINER(paned), child);
+ val = ewl_paned_initial_size_get(EWL_PANED(paned), child);
- if (val != 0) {
- LOG_FAILURE(buf, len, "get value is not 0");
- ret = 0;
- }
+ if (val != 0) {
+ LOG_FAILURE(buf, len, "get value is not 0");
+ ret = 0;
+ }
- ewl_widget_destroy(paned);
+ ewl_widget_destroy(paned);
- return ret;
+ return ret;
}
static int
initial_size_after_remove_get(char *buf, int len)
{
- Ewl_Widget *paned;
- Ewl_Widget *child;
- int ret = 1;
- int val;
+ Ewl_Widget *paned;
+ Ewl_Widget *child;
+ int ret = 1;
+ int val;
- /* use a hpaned here to cover this up */
- paned = ewl_hpaned_new();
- child = ewl_cell_new();
+ /* use a hpaned here to cover this up */
+ paned = ewl_hpaned_new();
+ child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(paned), child);
- ewl_paned_initial_size_set(EWL_PANED(paned), child, 240);
- ewl_container_child_remove(EWL_CONTAINER(paned), child);
- val = ewl_paned_initial_size_get(EWL_PANED(paned), child);
+ ewl_container_child_append(EWL_CONTAINER(paned), child);
+ ewl_paned_initial_size_set(EWL_PANED(paned), child, 240);
+ ewl_container_child_remove(EWL_CONTAINER(paned), child);
+ val = ewl_paned_initial_size_get(EWL_PANED(paned), child);
- if (val != 0) {
- LOG_FAILURE(buf, len, "get value is not zero");
- ret = 0;
- }
+ if (val != 0) {
+ LOG_FAILURE(buf, len, "get value is not zero");
+ ret = 0;
+ }
- ewl_widget_destroy(child);
- ewl_widget_destroy(paned);
+ ewl_widget_destroy(child);
+ ewl_widget_destroy(paned);
- return ret;
+ return ret;
}
static int
initial_size_many_get(char *buf, int len)
{
- Ewl_Widget *paned;
- Ewl_Widget *w[4];
- int ret = 1, i;
-
- /* use a vpaned here to cover this up */
- paned = ewl_vpaned_new();
-
- /* build the children and set the initial size for them */
- for (i = 0; i < 4; i++) {
- w[i] = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(paned), w[i]);
- ewl_paned_initial_size_set(EWL_PANED(paned), w[i], 240 + i);
- }
-
- /* now check the set values */
- for (i = 0; i < 4; i++) {
- int val = ewl_paned_initial_size_get(EWL_PANED(paned), w[i]);
-
- if (val != 240 + i) {
- LOG_FAILURE(buf, len, "get value is not zero");
- ret = 0;
- break;
- }
- }
-
- ewl_widget_destroy(paned);
-
- return ret;
+ Ewl_Widget *paned;
+ Ewl_Widget *w[4];
+ int ret = 1, i;
+
+ /* use a vpaned here to cover this up */
+ paned = ewl_vpaned_new();
+
+ /* build the children and set the initial size for them */
+ for (i = 0; i < 4; i++) {
+ w[i] = ewl_cell_new();
+ ewl_container_child_append(EWL_CONTAINER(paned), w[i]);
+ ewl_paned_initial_size_set(EWL_PANED(paned), w[i], 240 + i);
+ }
+
+ /* now check the set values */
+ for (i = 0; i < 4; i++) {
+ int val = ewl_paned_initial_size_get(EWL_PANED(paned), w[i]);
+
+ if (val != 240 + i) {
+ LOG_FAILURE(buf, len, "get value is not zero");
+ ret = 0;
+ break;
+ }
+ }
+
+ ewl_widget_destroy(paned);
+
+ return ret;
}
static int
fixed_size_get(char *buf, int len)
{
- Ewl_Widget *paned;
- Ewl_Widget *child;
- int ret = 1;
- unsigned int val;
+ Ewl_Widget *paned;
+ Ewl_Widget *child;
+ int ret = 1;
+ unsigned int val;
- paned = ewl_paned_new();
- child = ewl_cell_new();
+ paned = ewl_paned_new();
+ child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(paned), child);
- ewl_paned_fixed_size_set(EWL_PANED(paned), child, TRUE);
- val = ewl_paned_fixed_size_get(EWL_PANED(paned), child);
+ ewl_container_child_append(EWL_CONTAINER(paned), child);
+ ewl_paned_fixed_size_set(EWL_PANED(paned), child, TRUE);
+ val = ewl_paned_fixed_size_get(EWL_PANED(paned), child);
- if (!val) {
- LOG_FAILURE(buf, len, "get value is different from the set one");
- ret = 0;
- }
+ if (!val) {
+ LOG_FAILURE(buf, len, "get value is different from the set one");
+ ret = 0;
+ }
- ewl_widget_destroy(paned);
+ ewl_widget_destroy(paned);
- return ret;
+ return ret;
}
static int
fixed_size_unset_get(char *buf, int len)
{
- Ewl_Widget *paned;
- Ewl_Widget *child;
- int ret = 1;
- unsigned int val;
+ Ewl_Widget *paned;
+ Ewl_Widget *child;
+ int ret = 1;
+ unsigned int val;
- paned = ewl_paned_new();
- child = ewl_cell_new();
+ paned = ewl_paned_new();
+ child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(paned), child);
- val = ewl_paned_fixed_size_get(EWL_PANED(paned), child);
+ ewl_container_child_append(EWL_CONTAINER(paned), child);
+ val = ewl_paned_fixed_size_get(EWL_PANED(paned), child);
- if (val) {
- LOG_FAILURE(buf, len, "get value is not FALSE");
- ret = 0;
- }
+ if (val) {
+ LOG_FAILURE(buf, len, "get value is not FALSE");
+ ret = 0;
+ }
- ewl_widget_destroy(paned);
+ ewl_widget_destroy(paned);
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/password/ewl_password_test.c b/src/bin/tests/password/ewl_password_test.c
index 0333493..9007ff2 100644
--- a/src/bin/tests/password/ewl_password_test.c
+++ b/src/bin/tests/password/ewl_password_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,105 +16,105 @@ static void cb_set_password_text(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Password";
- test->tip = "Defines the Ewl_Password class to allow\n"
- "for single line obscured text.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Password";
+ test->tip = "Defines the Ewl_Password class to allow\n"
+ "for single line obscured text.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *button_hbox, *button[3];
-
- password[0] = ewl_password_new();
- ewl_text_text_set(EWL_TEXT(password[0]), "Play with me ?");
- ewl_object_padding_set(EWL_OBJECT(password[0]), 5, 5, 5, 0);
- ewl_container_child_append(box, password[0]);
- ewl_callback_append(password[0], EWL_CALLBACK_VALUE_CHANGED,
- cb_fetch_password_text, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(password[0]),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_widget_show(password[0]);
-
- password[1] = ewl_password_new();
- ewl_text_obscure_set(EWL_TEXT(password[1]), "•");
- ewl_text_color_set(EWL_TEXT(password[1]), 255, 0, 0, 255);
- ewl_text_text_append(EWL_TEXT(password[1]), "E W L ! ! !");
- ewl_object_padding_set(EWL_OBJECT(password[1]), 5, 5, 0, 0);
- ewl_container_child_append(box, password[1]);
- ewl_callback_append(password[1], EWL_CALLBACK_VALUE_CHANGED,
- cb_fetch_password_text, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(password[1]),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_widget_show(password[1]);
-
- password[2] = ewl_password_new();
- ewl_text_obscure_set(EWL_TEXT(password[2]), "");
- ewl_text_text_append(EWL_TEXT(password[2]), "hidden text");
- ewl_object_padding_set(EWL_OBJECT(password[2]), 5, 5, 0, 0);
- ewl_container_child_append(box, password[2]);
- ewl_callback_append(password[2], EWL_CALLBACK_VALUE_CHANGED,
- cb_fetch_password_text, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(password[2]),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
- ewl_widget_show(password[2]);
-
- button_hbox = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(button_hbox), EWL_FLAG_FILL_VFILL);
- ewl_object_alignment_set(EWL_OBJECT(button_hbox), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(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,
- cb_fetch_password_text, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(button[0]), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_CENTER);
- 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,
- cb_set_password_text, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(button[1]), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_CENTER);
- ewl_widget_show(button[1]);
-
- return 1;
+ Ewl_Widget *button_hbox, *button[3];
+
+ password[0] = ewl_password_new();
+ ewl_text_text_set(EWL_TEXT(password[0]), "Play with me ?");
+ ewl_object_padding_set(EWL_OBJECT(password[0]), 5, 5, 5, 0);
+ ewl_container_child_append(box, password[0]);
+ ewl_callback_append(password[0], EWL_CALLBACK_VALUE_CHANGED,
+ cb_fetch_password_text, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(password[0]),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_widget_show(password[0]);
+
+ password[1] = ewl_password_new();
+ ewl_text_obscure_set(EWL_TEXT(password[1]), "•");
+ ewl_text_color_set(EWL_TEXT(password[1]), 255, 0, 0, 255);
+ ewl_text_text_append(EWL_TEXT(password[1]), "E W L ! ! !");
+ ewl_object_padding_set(EWL_OBJECT(password[1]), 5, 5, 0, 0);
+ ewl_container_child_append(box, password[1]);
+ ewl_callback_append(password[1], EWL_CALLBACK_VALUE_CHANGED,
+ cb_fetch_password_text, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(password[1]),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_widget_show(password[1]);
+
+ password[2] = ewl_password_new();
+ ewl_text_obscure_set(EWL_TEXT(password[2]), "");
+ ewl_text_text_append(EWL_TEXT(password[2]), "hidden text");
+ ewl_object_padding_set(EWL_OBJECT(password[2]), 5, 5, 0, 0);
+ ewl_container_child_append(box, password[2]);
+ ewl_callback_append(password[2], EWL_CALLBACK_VALUE_CHANGED,
+ cb_fetch_password_text, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(password[2]),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINK);
+ ewl_widget_show(password[2]);
+
+ button_hbox = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(button_hbox), EWL_FLAG_FILL_VFILL);
+ ewl_object_alignment_set(EWL_OBJECT(button_hbox), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(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,
+ cb_fetch_password_text, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[0]), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_CENTER);
+ 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,
+ cb_set_password_text, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[1]), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_CENTER);
+ ewl_widget_show(button[1]);
+
+ return 1;
}
static void
cb_fetch_password_text(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- char *s;
-
- s = ewl_text_text_get(EWL_TEXT(password[0]));
- printf("First password covers: %s\n", s);
- free(s);
-
- s = ewl_text_text_get(EWL_TEXT(password[1]));
- printf("Second password covers: %s\n", s);
- free(s);
-
- s = ewl_text_text_get(EWL_TEXT(password[2]));
- printf("Third password covers: %s\n", s);
- free(s);
+ char *s;
+
+ s = ewl_text_text_get(EWL_TEXT(password[0]));
+ printf("First password covers: %s\n", s);
+ free(s);
+
+ s = ewl_text_text_get(EWL_TEXT(password[1]));
+ printf("Second password covers: %s\n", s);
+ free(s);
+
+ s = ewl_text_text_get(EWL_TEXT(password[2]));
+ printf("Third password covers: %s\n", s);
+ free(s);
}
static void
cb_set_password_text(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_text_text_set(EWL_TEXT(password[0]), "Play with me ?");
- ewl_text_text_set(EWL_TEXT(password[1]), "E W L ! ! !");
- ewl_text_text_set(EWL_TEXT(password[2]), "hidden text");
+ ewl_text_text_set(EWL_TEXT(password[0]), "Play with me ?");
+ ewl_text_text_set(EWL_TEXT(password[1]), "E W L ! ! !");
+ ewl_text_text_set(EWL_TEXT(password[2]), "hidden text");
}
diff --git a/src/bin/tests/pointer/ewl_pointer_test.c b/src/bin/tests/pointer/ewl_pointer_test.c
index a7495d5..0396348 100644
--- a/src/bin/tests/pointer/ewl_pointer_test.c
+++ b/src/bin/tests/pointer/ewl_pointer_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"
@@ -12,42 +12,42 @@ static int create_test(Ewl_Container *win);
void
test_info(Ewl_Test *test)
{
- test->name = "Pointer";
- test->tip = "Creates a custom cursor from a buffer engine window.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Pointer";
+ test->tip = "Creates a custom cursor from a buffer engine window.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *pointer_win;
- Ewl_Widget *o;
- int pos = 0;
-
- pointer_win = ewl_cursor_new();
- ewl_widget_appearance_set(pointer_win, "dndcursor");
- ewl_widget_show(pointer_win);
-
- o = ewl_entry_new();
- ewl_attach_mouse_argb_cursor_set(o, pointer_win);
- ewl_text_text_set(EWL_TEXT(o), "Expect to see a button cursor\n"
- "over this entry and a normal cursor\n"
- "over other parts of the window");
- ewl_entry_editable_set(EWL_ENTRY(o), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- pos = EWL_MOUSE_CURSOR_SB_UP_ARROW;
-
- o = ewl_button_new();
- ewl_attach_mouse_cursor_set(o, pos);
- ewl_button_label_set(EWL_BUTTON(o), "Something different here");
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *pointer_win;
+ Ewl_Widget *o;
+ int pos = 0;
+
+ pointer_win = ewl_cursor_new();
+ ewl_widget_appearance_set(pointer_win, "dndcursor");
+ ewl_widget_show(pointer_win);
+
+ o = ewl_entry_new();
+ ewl_attach_mouse_argb_cursor_set(o, pointer_win);
+ ewl_text_text_set(EWL_TEXT(o), "Expect to see a button cursor\n"
+ "over this entry and a normal cursor\n"
+ "over other parts of the window");
+ ewl_entry_editable_set(EWL_ENTRY(o), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ pos = EWL_MOUSE_CURSOR_SB_UP_ARROW;
+
+ o = ewl_button_new();
+ ewl_attach_mouse_cursor_set(o, pos);
+ ewl_button_label_set(EWL_BUTTON(o), "Something different here");
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ return 1;
}
diff --git a/src/bin/tests/progressbar/ewl_progressbar_test.c b/src/bin/tests/progressbar/ewl_progressbar_test.c
index db19121..562a1e5 100644
--- a/src/bin/tests/progressbar/ewl_progressbar_test.c
+++ b/src/bin/tests/progressbar/ewl_progressbar_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"
@@ -11,7 +11,7 @@ static int create_test(Ewl_Container *box);
static void cb_rerun_progressbars(Ewl_Widget *w, void *ev, void *data);
static void cb_set_new_range(Ewl_Widget *w, void *ev, void *data);
static void cb_destroy_progressbar_test(Ewl_Widget *w, void *ev,
- void *data);
+ void *data);
static int cb_increment_progress(void *data);
static Ecore_Timer *progress_timer[3];
@@ -20,199 +20,199 @@ static Ewl_Widget *progressbar[4];
void
test_info(Ewl_Test *test)
{
- test->name = "Progressbar";
- test->tip = "Provides a progress bar from a given value.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Progressbar";
+ test->tip = "Provides a progress bar from a given value.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *progressbar_vbox, *button, *progressbar_box;
- int i;
-
- progressbar_vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), progressbar_vbox);
- ewl_box_spacing_set(EWL_BOX(progressbar_vbox), 0);
- ewl_callback_prepend(EWL_WIDGET(progressbar_vbox), EWL_CALLBACK_DESTROY,
- cb_destroy_progressbar_test, NULL);
- ewl_widget_show(progressbar_vbox);
-
-
- progressbar_box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(progressbar_vbox),
- progressbar_box);
- ewl_box_spacing_set(EWL_BOX(progressbar_box), 0);
- ewl_widget_show(progressbar_box);
-
- /*
- * First and second progressbar
- */
- for (i = 0; i < 2; i++) {
- progressbar[i] = ewl_progressbar_new();
- if (i == 0)
- ewl_range_invert_set(EWL_RANGE(progressbar[0]), TRUE);
- ewl_range_value_set(EWL_RANGE(progressbar[i]), 0);
- ewl_widget_show(progressbar[i]);
-
- progress_timer[i] = ecore_timer_add(0.1, cb_increment_progress,
- (Ewl_Progressbar *) progressbar[i]);
-
- ewl_container_child_append(EWL_CONTAINER(progressbar_box),
- progressbar[i]);
- }
-
- /*
- * Third big progressbar
- */
- progressbar[2] = ewl_progressbar_new();
- ewl_range_value_set(EWL_RANGE(progressbar[2]), 0);
- ewl_widget_show(progressbar[2]);
-
- progress_timer[2] = ecore_timer_add(0.1, cb_increment_progress,
- (Ewl_Progressbar *) progressbar[2]);
-
- ewl_container_child_append(EWL_CONTAINER(progressbar_vbox), progressbar[2]);
-
- /*
- * A bouncy progressbar
- */
- progressbar[3] = ewl_progressbar_new();
- ewl_range_unknown_set(EWL_RANGE(progressbar[3]), TRUE);
- ewl_container_child_append(EWL_CONTAINER(progressbar_vbox), progressbar[3]);
- ewl_widget_show(progressbar[3]);
-
- /*
- * Add buttons at the bottom
- */
- progressbar_box = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(progressbar_vbox),
- progressbar_box);
- ewl_box_spacing_set(EWL_BOX(progressbar_box), 0);
- ewl_widget_show(progressbar_box);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Rerun");
- ewl_container_child_append(EWL_CONTAINER(progressbar_box), button);
- ewl_callback_prepend(button, EWL_CALLBACK_CLICKED,
- cb_rerun_progressbars, NULL);
-
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show (button);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Set a random range from 0-500");
- ewl_container_child_append(EWL_CONTAINER(progressbar_box), button);
- ewl_callback_prepend(button, EWL_CALLBACK_CLICKED,
- cb_set_new_range, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
- ewl_widget_show (button);
-
- return 1;
+ Ewl_Widget *progressbar_vbox, *button, *progressbar_box;
+ int i;
+
+ progressbar_vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), progressbar_vbox);
+ ewl_box_spacing_set(EWL_BOX(progressbar_vbox), 0);
+ ewl_callback_prepend(EWL_WIDGET(progressbar_vbox), EWL_CALLBACK_DESTROY,
+ cb_destroy_progressbar_test, NULL);
+ ewl_widget_show(progressbar_vbox);
+
+
+ progressbar_box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(progressbar_vbox),
+ progressbar_box);
+ ewl_box_spacing_set(EWL_BOX(progressbar_box), 0);
+ ewl_widget_show(progressbar_box);
+
+ /*
+ * First and second progressbar
+ */
+ for (i = 0; i < 2; i++) {
+ progressbar[i] = ewl_progressbar_new();
+ if (i == 0)
+ ewl_range_invert_set(EWL_RANGE(progressbar[0]), TRUE);
+ ewl_range_value_set(EWL_RANGE(progressbar[i]), 0);
+ ewl_widget_show(progressbar[i]);
+
+ progress_timer[i] = ecore_timer_add(0.1, cb_increment_progress,
+ (Ewl_Progressbar *) progressbar[i]);
+
+ ewl_container_child_append(EWL_CONTAINER(progressbar_box),
+ progressbar[i]);
+ }
+
+ /*
+ * Third big progressbar
+ */
+ progressbar[2] = ewl_progressbar_new();
+ ewl_range_value_set(EWL_RANGE(progressbar[2]), 0);
+ ewl_widget_show(progressbar[2]);
+
+ progress_timer[2] = ecore_timer_add(0.1, cb_increment_progress,
+ (Ewl_Progressbar *) progressbar[2]);
+
+ ewl_container_child_append(EWL_CONTAINER(progressbar_vbox), progressbar[2]);
+
+ /*
+ * A bouncy progressbar
+ */
+ progressbar[3] = ewl_progressbar_new();
+ ewl_range_unknown_set(EWL_RANGE(progressbar[3]), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(progressbar_vbox), progressbar[3]);
+ ewl_widget_show(progressbar[3]);
+
+ /*
+ * Add buttons at the bottom
+ */
+ progressbar_box = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(progressbar_vbox),
+ progressbar_box);
+ ewl_box_spacing_set(EWL_BOX(progressbar_box), 0);
+ ewl_widget_show(progressbar_box);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Rerun");
+ ewl_container_child_append(EWL_CONTAINER(progressbar_box), button);
+ ewl_callback_prepend(button, EWL_CALLBACK_CLICKED,
+ cb_rerun_progressbars, NULL);
+
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show (button);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Set a random range from 0-500");
+ ewl_container_child_append(EWL_CONTAINER(progressbar_box), button);
+ ewl_callback_prepend(button, EWL_CALLBACK_CLICKED,
+ cb_set_new_range, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show (button);
+
+ return 1;
}
static int
cb_increment_progress(void *data)
{
- double val, value, range;
- char c[30];
- int i;
- Ewl_Range *r;
-
- r = EWL_RANGE(data);
- val = ewl_range_value_get(r);
-
- if (val >= r->max_val) {
- for (i = 0; i < 3; i++) {
- if (progress_timer[i]) {
- ecore_timer_del(progress_timer[i]);
- progress_timer[i] = NULL;
- }
- }
- return 0;
- }
-
- val += 1;
- ewl_range_value_set(r, val);
-
- if (val >= 20 && val < 35 ) {
- ewl_progressbar_custom_label_set(EWL_PROGRESSBAR(r),
- "%.0lf / %.0lf kbytes");
- }
-
- if (val >= 35 && val < 60) {
- value = ewl_range_value_get(r);
- range = ewl_range_maximum_value_get(r);
-
- snprintf(c, sizeof (c), "%.0lf of %.0lf beers", value, range);
- ewl_progressbar_label_set(EWL_PROGRESSBAR(r), c);
- }
-
- if (val == 60)
- ewl_progressbar_label_hide(EWL_PROGRESSBAR(r));
-
- if (val == 70)
- ewl_progressbar_label_show(EWL_PROGRESSBAR(r));
-
- return 1;
+ double val, value, range;
+ char c[30];
+ int i;
+ Ewl_Range *r;
+
+ r = EWL_RANGE(data);
+ val = ewl_range_value_get(r);
+
+ if (val >= r->max_val) {
+ for (i = 0; i < 3; i++) {
+ if (progress_timer[i]) {
+ ecore_timer_del(progress_timer[i]);
+ progress_timer[i] = NULL;
+ }
+ }
+ return 0;
+ }
+
+ val += 1;
+ ewl_range_value_set(r, val);
+
+ if (val >= 20 && val < 35 ) {
+ ewl_progressbar_custom_label_set(EWL_PROGRESSBAR(r),
+ "%.0lf / %.0lf kbytes");
+ }
+
+ if (val >= 35 && val < 60) {
+ value = ewl_range_value_get(r);
+ range = ewl_range_maximum_value_get(r);
+
+ snprintf(c, sizeof (c), "%.0lf of %.0lf beers", value, range);
+ ewl_progressbar_label_set(EWL_PROGRESSBAR(r), c);
+ }
+
+ if (val == 60)
+ ewl_progressbar_label_hide(EWL_PROGRESSBAR(r));
+
+ if (val == 70)
+ ewl_progressbar_label_show(EWL_PROGRESSBAR(r));
+
+ return 1;
}
static void
cb_destroy_progressbar_test(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- int i;
-
- for (i = 0; i < 3; i++) {
- if (progress_timer[i]) {
- ecore_timer_del(progress_timer[i]);
- progress_timer[i] = NULL;
- }
- }
+ int i;
+
+ for (i = 0; i < 3; i++) {
+ if (progress_timer[i]) {
+ ecore_timer_del(progress_timer[i]);
+ progress_timer[i] = NULL;
+ }
+ }
}
static void
cb_set_new_range(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- int i, j;
+ int i, j;
- j = rand() % 500;
- printf ("New random value: %d\n", j);
+ j = rand() % 500;
+ printf ("New random value: %d\n", j);
- for (i = 0; i < 3; i++) {
- ewl_range_maximum_value_set(EWL_RANGE(progressbar[i]), j);
+ for (i = 0; i < 3; i++) {
+ ewl_range_maximum_value_set(EWL_RANGE(progressbar[i]), j);
- if (ewl_range_value_get(EWL_RANGE(progressbar[i])) >= j)
- cb_rerun_progressbars(EWL_WIDGET (progressbar[i]),
- NULL, NULL);
- }
+ if (ewl_range_value_get(EWL_RANGE(progressbar[i])) >= j)
+ cb_rerun_progressbars(EWL_WIDGET (progressbar[i]),
+ NULL, NULL);
+ }
}
static void
cb_rerun_progressbars (Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- int i;
-
- for (i = 0; i < 3; i++) {
- /*
- * Make sure to autolabel the bar on start again,
- * if we stop a place where it labels manually.
- * (since the auto label is turned off when you label manually)
- */
- ewl_progressbar_label_show (EWL_PROGRESSBAR (progressbar[i]));
- ewl_range_value_set(EWL_RANGE(progressbar[i]), 0);
-
- if (progress_timer[i]) {
- ecore_timer_del(progress_timer[i]);
- progress_timer[i] = NULL;
- }
-
- progress_timer[i] = ecore_timer_add(0.1, cb_increment_progress,
- progressbar[i]);
- }
+ int i;
+
+ for (i = 0; i < 3; i++) {
+ /*
+ * Make sure to autolabel the bar on start again,
+ * if we stop a place where it labels manually.
+ * (since the auto label is turned off when you label manually)
+ */
+ ewl_progressbar_label_show (EWL_PROGRESSBAR (progressbar[i]));
+ ewl_range_value_set(EWL_RANGE(progressbar[i]), 0);
+
+ if (progress_timer[i]) {
+ ecore_timer_del(progress_timer[i]);
+ progress_timer[i] = NULL;
+ }
+
+ progress_timer[i] = ecore_timer_add(0.1, cb_increment_progress,
+ progressbar[i]);
+ }
}
diff --git a/src/bin/tests/puzzle/ewl_puzzle_test.c b/src/bin/tests/puzzle/ewl_puzzle_test.c
index bd60512..a4ebac0 100644
--- a/src/bin/tests/puzzle/ewl_puzzle_test.c
+++ b/src/bin/tests/puzzle/ewl_puzzle_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"
@@ -23,222 +23,222 @@ static int free_col, free_row;
void
test_info(Ewl_Test *test)
{
- test->name = "Puzzle";
- test->tip = "Play with the grid";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->func = create_test;
+ test->name = "Puzzle";
+ test->tip = "Play with the grid";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->func = create_test;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *w;
- Ewl_Widget *grid;
- Ewl_Widget *hbox;
- Ewl_Widget *c;
-
- /*
- * set up the outer grid
- */
- c = ewl_grid_new();
- ewl_container_child_append(box, c);
- ewl_grid_dimensions_set(EWL_GRID(c), 1, 2);
- ewl_grid_row_preferred_h_use(EWL_GRID(c), 1);
- ewl_widget_show(c);
-
- /*
- * the first hbox
- */
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(c), hbox);
- ewl_widget_show(hbox);
-
-
- /*
- * set up the grid
- */
- grid = ewl_grid_new();
- ewl_grid_dimensions_set(EWL_GRID(grid), 4, 4);
- ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
- ewl_container_child_append(EWL_CONTAINER(hbox), grid);
- ewl_widget_show(grid);
-
- puzzle_grid_fill(EWL_GRID(grid));
-
- /* the seperator */
- w = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), w);
- ewl_widget_show(w);
-
- /*
- * the real image
- */
- w = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(w), PACKAGE_DATA_DIR
- "/ewl/images/e-logo.png");
- ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(hbox), w);
- ewl_widget_show(w);
-
- /*
- * the hbox
- */
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(c), hbox);
- ewl_widget_show(hbox);
-
- /*
- * some text
- */
- w = ewl_text_new();
- ewl_object_insets_set(EWL_OBJECT(w), 10, 10, 10, 10);
- ewl_text_wrap_set(EWL_TEXT(w), TRUE);
- ewl_object_w_request(EWL_OBJECT(w), 400);
- ewl_text_text_append(EWL_TEXT(w),
- "The rules are really simple. Just try "
- "to have the same image on your left "
- "like you have on your right hand.");
- ewl_container_child_append(EWL_CONTAINER(hbox), w);
- ewl_widget_show(w);
-
- /*
- * the shuffle button
- */
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), "shuffle");
- ewl_callback_append(w, EWL_CALLBACK_CLICKED, puzzle_clicked_cb, grid);
- ewl_container_child_append(EWL_CONTAINER(hbox), w);
- ewl_widget_show(w);
-
- return 1;
+ Ewl_Widget *w;
+ Ewl_Widget *grid;
+ Ewl_Widget *hbox;
+ Ewl_Widget *c;
+
+ /*
+ * set up the outer grid
+ */
+ c = ewl_grid_new();
+ ewl_container_child_append(box, c);
+ ewl_grid_dimensions_set(EWL_GRID(c), 1, 2);
+ ewl_grid_row_preferred_h_use(EWL_GRID(c), 1);
+ ewl_widget_show(c);
+
+ /*
+ * the first hbox
+ */
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(c), hbox);
+ ewl_widget_show(hbox);
+
+
+ /*
+ * set up the grid
+ */
+ grid = ewl_grid_new();
+ ewl_grid_dimensions_set(EWL_GRID(grid), 4, 4);
+ ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(hbox), grid);
+ ewl_widget_show(grid);
+
+ puzzle_grid_fill(EWL_GRID(grid));
+
+ /* the seperator */
+ w = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), w);
+ ewl_widget_show(w);
+
+ /*
+ * the real image
+ */
+ w = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(w), PACKAGE_DATA_DIR
+ "/ewl/images/e-logo.png");
+ ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(hbox), w);
+ ewl_widget_show(w);
+
+ /*
+ * the hbox
+ */
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(c), hbox);
+ ewl_widget_show(hbox);
+
+ /*
+ * some text
+ */
+ w = ewl_text_new();
+ ewl_object_insets_set(EWL_OBJECT(w), 10, 10, 10, 10);
+ ewl_text_wrap_set(EWL_TEXT(w), TRUE);
+ ewl_object_w_request(EWL_OBJECT(w), 400);
+ ewl_text_text_append(EWL_TEXT(w),
+ "The rules are really simple. Just try "
+ "to have the same image on your left "
+ "like you have on your right hand.");
+ ewl_container_child_append(EWL_CONTAINER(hbox), w);
+ ewl_widget_show(w);
+
+ /*
+ * the shuffle button
+ */
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), "shuffle");
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED, puzzle_clicked_cb, grid);
+ ewl_container_child_append(EWL_CONTAINER(hbox), w);
+ ewl_widget_show(w);
+
+ return 1;
}
static void
puzzle_grid_fill(Ewl_Grid *grid)
{
- Ewl_Widget *w;
- int i, random;
- int unsort[6][15] =
- {{4, 2, 5, 14, 0, 11, 6, 13, 10, 12, 1, 9, 8, 7, 3},
- {0, 2, 3, 7, 8, 4, 1, 6, 12, 5, 10, 11, 9, 13, 14},
- {1, 2, 6, 3, 13, 7, 10, 11, 0, 5, 12, 14, 4, 8, 9},
- {1, 10, 2, 3, 7, 9, 11, 6, 0, 8, 12, 5, 14, 4, 13},
- {0, 5, 1, 2, 9, 3, 7, 10, 4, 6, 11, 14, 8, 12, 13},
- {1, 3, 11, 14, 0, 7, 2, 13, 8, 12, 6, 10, 4, 9, 5}};
-
- /* a really stupid randomizer */
- random = time(NULL) % 6;
-
- /*
- * fill the grid with content
- */
- for (i = 0; i < 15; i++)
- {
- char buf[PATH_MAX];
-
- snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR
- "/ewl/images/e-logo-%i.png", unsort[random][i]);
-
- w = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(w), buf);
- ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(grid), w);
- ewl_grid_child_position_set(EWL_GRID(grid), w,
- i % 4, i % 4, i / 4, i / 4);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
- puzzle_mouse_up_cb, grid);
- ewl_widget_show(w);
-
- childs[i % 4][i / 4] = w;
- }
- free_col = free_row = 3;
+ Ewl_Widget *w;
+ int i, random;
+ int unsort[6][15] =
+ {{4, 2, 5, 14, 0, 11, 6, 13, 10, 12, 1, 9, 8, 7, 3},
+ {0, 2, 3, 7, 8, 4, 1, 6, 12, 5, 10, 11, 9, 13, 14},
+ {1, 2, 6, 3, 13, 7, 10, 11, 0, 5, 12, 14, 4, 8, 9},
+ {1, 10, 2, 3, 7, 9, 11, 6, 0, 8, 12, 5, 14, 4, 13},
+ {0, 5, 1, 2, 9, 3, 7, 10, 4, 6, 11, 14, 8, 12, 13},
+ {1, 3, 11, 14, 0, 7, 2, 13, 8, 12, 6, 10, 4, 9, 5}};
+
+ /* a really stupid randomizer */
+ random = time(NULL) % 6;
+
+ /*
+ * fill the grid with content
+ */
+ for (i = 0; i < 15; i++)
+ {
+ char buf[PATH_MAX];
+
+ snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR
+ "/ewl/images/e-logo-%i.png", unsort[random][i]);
+
+ w = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(w), buf);
+ ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(grid), w);
+ ewl_grid_child_position_set(EWL_GRID(grid), w,
+ i % 4, i % 4, i / 4, i / 4);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
+ puzzle_mouse_up_cb, grid);
+ ewl_widget_show(w);
+
+ childs[i % 4][i / 4] = w;
+ }
+ free_col = free_row = 3;
}
static void
puzzle_clicked_cb(Ewl_Widget *w __UNUSED__, void *e __UNUSED__, void *data)
{
- ewl_container_reset(EWL_CONTAINER(data));
- puzzle_grid_fill(EWL_GRID(data));
+ ewl_container_reset(EWL_CONTAINER(data));
+ puzzle_grid_fill(EWL_GRID(data));
}
static void
puzzle_mouse_up_cb(Ewl_Widget *w, void *e, void *data)
{
- int cx, cy, cw, ch;
- int col, row;
- Ewl_Event_Mouse *ev;
- Ewl_Widget *g;
-
- g = data;
- ev = e;
- /*
- * get the current geometry of the widget
- */
- cx = ewl_object_current_x_get(EWL_OBJECT(w));
- cy = ewl_object_current_y_get(EWL_OBJECT(w));
- cw = ewl_object_current_w_get(EWL_OBJECT(w));
- ch = ewl_object_current_h_get(EWL_OBJECT(w));
-
- if (ev->x > cx && ev->y > cy && ev->x < cx + cw && ev->y < cy + ch)
- return;
-
- ewl_grid_child_position_get(EWL_GRID(g), w, &col, NULL, &row, NULL);
-
- if (col == free_col && ev->x > cx && ev->x < cx + cw) {
- int direction, i;
-
- if (ev->y < cy)
- direction = -1;
- else
- direction = 1;
-
- if (sign(free_row - row) != direction)
- return;
-
- for (i = free_row; i != row; i -= direction) {
- Ewl_Widget *move;
-
- move = childs[col][i - direction];
- ewl_grid_child_position_set(EWL_GRID(g),
- move, col, col, i, i);
- childs[col][i] = move;
- }
- free_row = row;
- }
- else if (row == free_row && ev->y > cy && ev->y < cy + ch) {
- int direction, i;
-
- if (ev->x < cx)
- direction = -1;
- else
- direction = 1;
-
- if (sign(free_col - col) != direction)
- return;
-
- for (i = free_col; i != col; i -= direction) {
- Ewl_Widget *move;
-
- move = childs[i - direction][row];
- ewl_grid_child_position_set(EWL_GRID(g),
- move, i, i, row, row);
- childs[i][row] = move;
- }
- free_col = col;
- }
+ int cx, cy, cw, ch;
+ int col, row;
+ Ewl_Event_Mouse *ev;
+ Ewl_Widget *g;
+
+ g = data;
+ ev = e;
+ /*
+ * get the current geometry of the widget
+ */
+ cx = ewl_object_current_x_get(EWL_OBJECT(w));
+ cy = ewl_object_current_y_get(EWL_OBJECT(w));
+ cw = ewl_object_current_w_get(EWL_OBJECT(w));
+ ch = ewl_object_current_h_get(EWL_OBJECT(w));
+
+ if (ev->x > cx && ev->y > cy && ev->x < cx + cw && ev->y < cy + ch)
+ return;
+
+ ewl_grid_child_position_get(EWL_GRID(g), w, &col, NULL, &row, NULL);
+
+ if (col == free_col && ev->x > cx && ev->x < cx + cw) {
+ int direction, i;
+
+ if (ev->y < cy)
+ direction = -1;
+ else
+ direction = 1;
+
+ if (sign(free_row - row) != direction)
+ return;
+
+ for (i = free_row; i != row; i -= direction) {
+ Ewl_Widget *move;
+
+ move = childs[col][i - direction];
+ ewl_grid_child_position_set(EWL_GRID(g),
+ move, col, col, i, i);
+ childs[col][i] = move;
+ }
+ free_row = row;
+ }
+ else if (row == free_row && ev->y > cy && ev->y < cy + ch) {
+ int direction, i;
+
+ if (ev->x < cx)
+ direction = -1;
+ else
+ direction = 1;
+
+ if (sign(free_col - col) != direction)
+ return;
+
+ for (i = free_col; i != col; i -= direction) {
+ Ewl_Widget *move;
+
+ move = childs[i - direction][row];
+ ewl_grid_child_position_set(EWL_GRID(g),
+ move, i, i, row, row);
+ childs[i][row] = move;
+ }
+ free_col = col;
+ }
}
static int
sign(int x)
{
- if (x > 0)
- return 1;
- if (x < 0)
- return -1;
+ if (x > 0)
+ return 1;
+ if (x < 0)
+ return -1;
- return 0;
+ return 0;
}
diff --git a/src/bin/tests/range/ewl_range_test.c b/src/bin/tests/range/ewl_range_test.c
index cf573d5..945dd11 100644
--- a/src/bin/tests/range/ewl_range_test.c
+++ b/src/bin/tests/range/ewl_range_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_range.h"
@@ -15,18 +15,18 @@
static int range_new(char *buf, int len);
static Ewl_Unit_Test range_unit_tests[] = {
- {"range new", range_new, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"range new", range_new, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Range";
- test->tip = "The abstract range class";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_SIMPLE;
- test->unit_tests = range_unit_tests;
+ test->name = "Range";
+ test->tip = "The abstract range class";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_SIMPLE;
+ test->unit_tests = range_unit_tests;
}
/*
@@ -35,31 +35,31 @@ test_info(Ewl_Test *test)
static int
range_new(char *buf, int len)
{
- Ewl_Widget *range;
- int ret = 0;
+ Ewl_Widget *range;
+ int ret = 0;
- range = calloc(1, sizeof(Ewl_Range));
- /* if we don't get a valid pointer we are out of space or something
- * went wrong */
- if (!ewl_range_init(EWL_RANGE(range)))
- LOG_FAILURE(buf, len, "Fail to init a new range widget");
- else if (ewl_range_value_get(EWL_RANGE(range)) != 0.0)
- LOG_FAILURE(buf, len, "Range value != 0.0");
- else if (ewl_range_minimum_value_get(EWL_RANGE(range)) != 0.0)
- LOG_FAILURE(buf, len, "Range minimum != 0.0");
- else if (ewl_range_maximum_value_get(EWL_RANGE(range)) != 100.0)
- LOG_FAILURE(buf, len, "Range maximum != 100.0");
- else if (ewl_range_step_get(EWL_RANGE(range)) != 10.0)
- LOG_FAILURE(buf, len, "Range step != 10.0");
- else if (ewl_range_invert_get(EWL_RANGE(range)))
- LOG_FAILURE(buf, len, "Range is inverted by default");
- else if (ewl_range_unknown_get(EWL_RANGE(range)))
- LOG_FAILURE(buf, len, "Range's range is unknown by default");
- else
- ret = 1;
+ range = calloc(1, sizeof(Ewl_Range));
+ /* if we don't get a valid pointer we are out of space or something
+ * went wrong */
+ if (!ewl_range_init(EWL_RANGE(range)))
+ LOG_FAILURE(buf, len, "Fail to init a new range widget");
+ else if (ewl_range_value_get(EWL_RANGE(range)) != 0.0)
+ LOG_FAILURE(buf, len, "Range value != 0.0");
+ else if (ewl_range_minimum_value_get(EWL_RANGE(range)) != 0.0)
+ LOG_FAILURE(buf, len, "Range minimum != 0.0");
+ else if (ewl_range_maximum_value_get(EWL_RANGE(range)) != 100.0)
+ LOG_FAILURE(buf, len, "Range maximum != 100.0");
+ else if (ewl_range_step_get(EWL_RANGE(range)) != 10.0)
+ LOG_FAILURE(buf, len, "Range step != 10.0");
+ else if (ewl_range_invert_get(EWL_RANGE(range)))
+ LOG_FAILURE(buf, len, "Range is inverted by default");
+ else if (ewl_range_unknown_get(EWL_RANGE(range)))
+ LOG_FAILURE(buf, len, "Range's range is unknown by default");
+ else
+ ret = 1;
- ewl_widget_destroy(range);
+ ewl_widget_destroy(range);
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/scrollbar/ewl_scrollbar_test.c b/src/bin/tests/scrollbar/ewl_scrollbar_test.c
index 4e57b2d..1ae3e14 100644
--- a/src/bin/tests/scrollbar/ewl_scrollbar_test.c
+++ b/src/bin/tests/scrollbar/ewl_scrollbar_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_scrollbar.h"
@@ -10,28 +10,28 @@ static int create_test(Ewl_Container *win);
void
test_info(Ewl_Test *test)
{
- test->name = "Scrollbar";
- test->tip = "A scrollbar.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Scrollbar";
+ test->tip = "A scrollbar.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *hscrollbar, *vscrollbar;
+ Ewl_Widget *hscrollbar, *vscrollbar;
- hscrollbar = ewl_hscrollbar_new();
- ewl_object_padding_set(EWL_OBJECT(hscrollbar), 10, 10, 10, 0);
- ewl_container_child_append(box, hscrollbar);
- ewl_widget_show(hscrollbar);
+ hscrollbar = ewl_hscrollbar_new();
+ ewl_object_padding_set(EWL_OBJECT(hscrollbar), 10, 10, 10, 0);
+ ewl_container_child_append(box, hscrollbar);
+ ewl_widget_show(hscrollbar);
- vscrollbar = ewl_vscrollbar_new();
- ewl_object_padding_set(EWL_OBJECT(vscrollbar), 10, 10, 10, 10);
- ewl_container_child_append(box, vscrollbar);
- ewl_widget_show(vscrollbar);
+ vscrollbar = ewl_vscrollbar_new();
+ ewl_object_padding_set(EWL_OBJECT(vscrollbar), 10, 10, 10, 10);
+ ewl_container_child_append(box, vscrollbar);
+ ewl_widget_show(vscrollbar);
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/scrollpane/ewl_scrollpane_test.c b/src/bin/tests/scrollpane/ewl_scrollpane_test.c
index 958e452..6612326 100644
--- a/src/bin/tests/scrollpane/ewl_scrollpane_test.c
+++ b/src/bin/tests/scrollpane/ewl_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_button.h"
@@ -11,30 +11,30 @@ static int create_test(Ewl_Container *box);
void
test_info(Ewl_Test *test)
{
- test->name = "Scrollpane";
- test->tip = "A scrollpane.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Scrollpane";
+ test->tip = "A scrollpane.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *scrollpane;
- Ewl_Widget *button;
+ Ewl_Widget *scrollpane;
+ Ewl_Widget *button;
- scrollpane = ewl_scrollpane_new();
- ewl_container_child_append(box, scrollpane);
- ewl_widget_show(scrollpane);
+ scrollpane = ewl_scrollpane_new();
+ ewl_container_child_append(box, scrollpane);
+ ewl_widget_show(scrollpane);
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Scroll!");
- ewl_object_minimum_size_set(EWL_OBJECT(button), 500, 500);
- ewl_object_padding_set(EWL_OBJECT(button), 20, 20, 20, 20);
- ewl_container_child_append(EWL_CONTAINER(scrollpane), button);
- ewl_widget_show(button);
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Scroll!");
+ ewl_object_minimum_size_set(EWL_OBJECT(button), 500, 500);
+ ewl_object_padding_set(EWL_OBJECT(button), 20, 20, 20, 20);
+ ewl_container_child_append(EWL_CONTAINER(scrollpane), button);
+ ewl_widget_show(button);
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/seeker/ewl_seeker_test.c b/src/bin/tests/seeker/ewl_seeker_test.c
index 99284f8..48f2d98 100644
--- a/src/bin/tests/seeker/ewl_seeker_test.c
+++ b/src/bin/tests/seeker/ewl_seeker_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_seeker.h"
@@ -11,42 +11,42 @@ static void cb_print_value(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Seeker";
- test->tip = "A seeker widget.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Seeker";
+ test->tip = "A seeker widget.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *hseeker, *vseeker;
-
- hseeker = ewl_hseeker_new();
- ewl_object_position_request(EWL_OBJECT(hseeker), 30, 0);
- ewl_callback_append(hseeker, EWL_CALLBACK_VALUE_CHANGED,
- cb_print_value, NULL);
- ewl_container_child_append(box, hseeker);
- ewl_widget_show(hseeker);
-
- vseeker = ewl_vseeker_new();
- ewl_object_position_request(EWL_OBJECT(vseeker), 0, 30);
- ewl_callback_append(vseeker, EWL_CALLBACK_VALUE_CHANGED,
- cb_print_value, NULL);
- ewl_container_child_append(box, vseeker);
- ewl_widget_show(vseeker);
-
- return 1;
+ Ewl_Widget *hseeker, *vseeker;
+
+ hseeker = ewl_hseeker_new();
+ ewl_object_position_request(EWL_OBJECT(hseeker), 30, 0);
+ ewl_callback_append(hseeker, EWL_CALLBACK_VALUE_CHANGED,
+ cb_print_value, NULL);
+ ewl_container_child_append(box, hseeker);
+ ewl_widget_show(hseeker);
+
+ vseeker = ewl_vseeker_new();
+ ewl_object_position_request(EWL_OBJECT(vseeker), 0, 30);
+ ewl_callback_append(vseeker, EWL_CALLBACK_VALUE_CHANGED,
+ cb_print_value, NULL);
+ ewl_container_child_append(box, vseeker);
+ ewl_widget_show(vseeker);
+
+ return 1;
}
static void
cb_print_value(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
{
- Ewl_Range *r;
+ Ewl_Range *r;
- r = EWL_RANGE(w);
- printf("Seeker set to %g\n", ewl_range_value_get(r));
+ r = EWL_RANGE(w);
+ printf("Seeker set to %g\n", ewl_range_value_get(r));
}
diff --git a/src/bin/tests/shadow/ewl_shadow_test.c b/src/bin/tests/shadow/ewl_shadow_test.c
index e97ae50..ec8fb37 100644
--- a/src/bin/tests/shadow/ewl_shadow_test.c
+++ b/src/bin/tests/shadow/ewl_shadow_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"
@@ -10,34 +10,34 @@ static int create_test(Ewl_Container *box);
void test_info(Ewl_Test *test)
{
- test->name = "Shadow";
- test->tip = "Defines the Ewl_Shadow class for displaying\n"
- "a container that will shadow other widgets.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Shadow";
+ test->tip = "Defines the Ewl_Shadow class for displaying\n"
+ "a container that will shadow other widgets.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *shadow;
- Ewl_Widget *image;
-
- shadow = ewl_shadow_new();
- ewl_object_minimum_size_set(EWL_OBJECT(shadow), 280, 250);
- ewl_object_alignment_set(EWL_OBJECT(shadow), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(box), shadow);
- ewl_widget_show(shadow);
-
- image = ewl_image_new();
- ewl_image_file_set(EWL_IMAGE(image),
- PACKAGE_DATA_DIR "/ewl/images/elicit.png", NULL);
- ewl_image_size_set(EWL_IMAGE(image), 220, 210);
- ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(shadow), image);
- ewl_widget_show(image);
-
- return 1;
+ Ewl_Widget *shadow;
+ Ewl_Widget *image;
+
+ shadow = ewl_shadow_new();
+ ewl_object_minimum_size_set(EWL_OBJECT(shadow), 280, 250);
+ ewl_object_alignment_set(EWL_OBJECT(shadow), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(box), shadow);
+ ewl_widget_show(shadow);
+
+ image = ewl_image_new();
+ ewl_image_file_set(EWL_IMAGE(image),
+ PACKAGE_DATA_DIR "/ewl/images/elicit.png", NULL);
+ ewl_image_size_set(EWL_IMAGE(image), 220, 210);
+ ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(shadow), image);
+ ewl_widget_show(image);
+
+ return 1;
}
diff --git a/src/bin/tests/spinner/ewl_spinner_test.c b/src/bin/tests/spinner/ewl_spinner_test.c
index 8b28bbf..bdd4d27 100644
--- a/src/bin/tests/spinner/ewl_spinner_test.c
+++ b/src/bin/tests/spinner/ewl_spinner_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,131 +16,131 @@ static Ewl_Widget *spinner[4];
void
test_info(Ewl_Test *test)
{
- test->name = "Spinner";
- test->tip = "Provides a field for entering numerical\n"
- "values, along with buttons to increment\n"
- "and decrement the value.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Spinner";
+ test->tip = "Provides a field for entering numerical\n"
+ "values, along with buttons to increment\n"
+ "and decrement the value.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *spinner_row, *text, *separator;
-
- spinner_row = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
- ewl_widget_show(spinner_row);
-
- text = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(text), "X");
- ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
- ewl_widget_show(text);
-
- spinner[0] = ewl_spinner_new();
- ewl_spinner_digits_set(EWL_SPINNER(spinner[0]), 0);
- ewl_range_minimum_value_set(EWL_RANGE(spinner[0]), 0);
- ewl_range_maximum_value_set(EWL_RANGE(spinner[0]), 1280);
- ewl_range_value_set(EWL_RANGE(spinner[0]), 0.0);
- ewl_range_step_set(EWL_RANGE(spinner[0]), 1.0);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[0]);
- ewl_widget_show(spinner[0]);
-
- separator = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), separator);
- ewl_widget_show(separator);
-
- spinner_row = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
- ewl_widget_show(spinner_row);
-
- text = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(text), "Y");
- ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
- ewl_widget_show(text);
-
- spinner[1] = ewl_spinner_new();
- ewl_spinner_digits_set(EWL_SPINNER(spinner[1]), 0);
- ewl_range_minimum_value_set(EWL_RANGE(spinner[1]), 0);
- ewl_range_maximum_value_set(EWL_RANGE(spinner[1]), 1024);
- ewl_range_value_set(EWL_RANGE(spinner[1]), 0.0);
- ewl_range_step_set(EWL_RANGE(spinner[1]), 1.0);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[1]);
- ewl_widget_show(spinner[1]);
-
- separator = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), separator);
- ewl_widget_show(separator);
-
- spinner_row = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
- ewl_widget_show(spinner_row);
-
- text = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(text), "W");
- ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
- ewl_widget_show(text);
-
- spinner[2] = ewl_spinner_new();
- ewl_spinner_digits_set(EWL_SPINNER(spinner[2]), 0);
- ewl_range_minimum_value_set(EWL_RANGE(spinner[2]), 0.0);
- ewl_range_maximum_value_set(EWL_RANGE(spinner[2]), 1280);
- ewl_range_value_set(EWL_RANGE(spinner[2]), 0.0);
- ewl_range_step_set(EWL_RANGE(spinner[2]), 1.0);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[2]);
- ewl_widget_show(spinner[2]);
-
- separator = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(box), separator);
- ewl_widget_show(separator);
-
- spinner_row = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
- ewl_widget_show(spinner_row);
-
- text = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(text), "H");
- ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
- ewl_widget_show(text);
-
- spinner[3] = ewl_spinner_new();
- ewl_spinner_digits_set(EWL_SPINNER(spinner[3]), 0);
- ewl_range_minimum_value_set(EWL_RANGE(spinner[3]), 0.0);
- ewl_range_maximum_value_set(EWL_RANGE(spinner[3]), 1024);
- ewl_range_value_set(EWL_RANGE(spinner[3]), 0.0);
- ewl_range_step_set(EWL_RANGE(spinner[3]), 1.0);
- ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[3]);
- ewl_widget_show(spinner[3]);
-
- separator = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(separator), "Get Values");
- ewl_container_child_append(EWL_CONTAINER(box), separator);
- ewl_callback_append(separator, EWL_CALLBACK_CLICKED,
- cb_value_show, NULL);
- ewl_widget_show(separator);
-
- return 1;
+ Ewl_Widget *spinner_row, *text, *separator;
+
+ spinner_row = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
+ ewl_widget_show(spinner_row);
+
+ text = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(text), "X");
+ ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
+ ewl_widget_show(text);
+
+ spinner[0] = ewl_spinner_new();
+ ewl_spinner_digits_set(EWL_SPINNER(spinner[0]), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(spinner[0]), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(spinner[0]), 1280);
+ ewl_range_value_set(EWL_RANGE(spinner[0]), 0.0);
+ ewl_range_step_set(EWL_RANGE(spinner[0]), 1.0);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[0]);
+ ewl_widget_show(spinner[0]);
+
+ separator = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), separator);
+ ewl_widget_show(separator);
+
+ spinner_row = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
+ ewl_widget_show(spinner_row);
+
+ text = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(text), "Y");
+ ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
+ ewl_widget_show(text);
+
+ spinner[1] = ewl_spinner_new();
+ ewl_spinner_digits_set(EWL_SPINNER(spinner[1]), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(spinner[1]), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(spinner[1]), 1024);
+ ewl_range_value_set(EWL_RANGE(spinner[1]), 0.0);
+ ewl_range_step_set(EWL_RANGE(spinner[1]), 1.0);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[1]);
+ ewl_widget_show(spinner[1]);
+
+ separator = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), separator);
+ ewl_widget_show(separator);
+
+ spinner_row = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
+ ewl_widget_show(spinner_row);
+
+ text = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(text), "W");
+ ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
+ ewl_widget_show(text);
+
+ spinner[2] = ewl_spinner_new();
+ ewl_spinner_digits_set(EWL_SPINNER(spinner[2]), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(spinner[2]), 0.0);
+ ewl_range_maximum_value_set(EWL_RANGE(spinner[2]), 1280);
+ ewl_range_value_set(EWL_RANGE(spinner[2]), 0.0);
+ ewl_range_step_set(EWL_RANGE(spinner[2]), 1.0);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[2]);
+ ewl_widget_show(spinner[2]);
+
+ separator = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(box), separator);
+ ewl_widget_show(separator);
+
+ spinner_row = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), spinner_row);
+ ewl_widget_show(spinner_row);
+
+ text = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(text), "H");
+ ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), text);
+ ewl_widget_show(text);
+
+ spinner[3] = ewl_spinner_new();
+ ewl_spinner_digits_set(EWL_SPINNER(spinner[3]), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(spinner[3]), 0.0);
+ ewl_range_maximum_value_set(EWL_RANGE(spinner[3]), 1024);
+ ewl_range_value_set(EWL_RANGE(spinner[3]), 0.0);
+ ewl_range_step_set(EWL_RANGE(spinner[3]), 1.0);
+ ewl_container_child_append(EWL_CONTAINER(spinner_row), spinner[3]);
+ ewl_widget_show(spinner[3]);
+
+ separator = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(separator), "Get Values");
+ ewl_container_child_append(EWL_CONTAINER(box), separator);
+ ewl_callback_append(separator, EWL_CALLBACK_CLICKED,
+ cb_value_show, NULL);
+ ewl_widget_show(separator);
+
+ return 1;
}
static void
cb_value_show(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- printf("X %d, Y %d, W %d, H %d\n",
- (int)ewl_range_value_get(EWL_RANGE(spinner[0])),
- (int)ewl_range_value_get(EWL_RANGE(spinner[1])),
- (int)ewl_range_value_get(EWL_RANGE(spinner[2])),
- (int)ewl_range_value_get(EWL_RANGE(spinner[3])));
+ printf("X %d, Y %d, W %d, H %d\n",
+ (int)ewl_range_value_get(EWL_RANGE(spinner[0])),
+ (int)ewl_range_value_get(EWL_RANGE(spinner[1])),
+ (int)ewl_range_value_get(EWL_RANGE(spinner[2])),
+ (int)ewl_range_value_get(EWL_RANGE(spinner[3])));
}
diff --git a/src/bin/tests/statusbar/ewl_statusbar_test.c b/src/bin/tests/statusbar/ewl_statusbar_test.c
index d056cbc..fad391b 100644
--- a/src/bin/tests/statusbar/ewl_statusbar_test.c
+++ b/src/bin/tests/statusbar/ewl_statusbar_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,69 +15,69 @@ static void button_pop_cb(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Statusbar";
- test->tip = "Provides a status bar.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Statusbar";
+ test->tip = "Provides a status bar.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *statusbar = NULL, *button = NULL, *hbox = NULL;
-
- statusbar = ewl_statusbar_new();
- ewl_container_child_append(EWL_CONTAINER(box), statusbar);
- ewl_statusbar_left_hide(EWL_STATUSBAR(statusbar));
- ewl_widget_show(statusbar);
-
- button_push_cb(NULL, NULL, statusbar);
-
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_widget_show(hbox);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "push");
- ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_push_cb,
- statusbar);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(hbox), button);
- ewl_widget_show(button);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "pop");
- ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_pop_cb,
- statusbar);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
- ewl_container_child_append(EWL_CONTAINER(hbox), button);
- ewl_widget_show(button);
-
- return 1;
+ Ewl_Widget *statusbar = NULL, *button = NULL, *hbox = NULL;
+
+ statusbar = ewl_statusbar_new();
+ ewl_container_child_append(EWL_CONTAINER(box), statusbar);
+ ewl_statusbar_left_hide(EWL_STATUSBAR(statusbar));
+ ewl_widget_show(statusbar);
+
+ button_push_cb(NULL, NULL, statusbar);
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox);
+ ewl_widget_show(hbox);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "push");
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_push_cb,
+ statusbar);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(hbox), button);
+ ewl_widget_show(button);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "pop");
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_pop_cb,
+ statusbar);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
+ ewl_container_child_append(EWL_CONTAINER(hbox), button);
+ ewl_widget_show(button);
+
+ return 1;
}
static void
button_push_cb(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Statusbar *sb;
- char msg[20];
+ Ewl_Statusbar *sb;
+ char msg[20];
- sb = data;
+ sb = data;
- snprintf(msg, 20, "at %d", current_num++);
- ewl_statusbar_push(sb, msg);
+ snprintf(msg, 20, "at %d", current_num++);
+ ewl_statusbar_push(sb, msg);
}
static void
button_pop_cb(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data)
+ void *data)
{
- Ewl_Statusbar *sb;
+ Ewl_Statusbar *sb;
- sb = data;
- ewl_statusbar_pop(sb);
+ sb = data;
+ ewl_statusbar_pop(sb);
}
diff --git a/src/bin/tests/table/ewl_table_test.c b/src/bin/tests/table/ewl_table_test.c
index 46825a4..50b7523 100644
--- a/src/bin/tests/table/ewl_table_test.c
+++ b/src/bin/tests/table/ewl_table_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"
@@ -11,111 +11,111 @@ static int create_test(Ewl_Container *box);
void
test_info(Ewl_Test *test)
{
- test->name = "Table";
- test->tip = "Defines the Ewl_Table class used for\n"
- "laying out Ewl_Widget's in an array.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Table";
+ test->tip = "Defines the Ewl_Table class used for\n"
+ "laying out Ewl_Widget's in an array.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *table, *button[10];
- char *headers[] = { "One", "Two", "Three", "Four" };
+ Ewl_Widget *table, *button[10];
+ char *headers[] = { "One", "Two", "Three", "Four" };
- table = ewl_table_new(4, 5, headers);
- ewl_container_child_append(box, table);
- ewl_widget_show(table);
+ table = ewl_table_new(4, 5, headers);
+ ewl_container_child_append(box, table);
+ ewl_widget_show(table);
- button[0] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[0]), "FIRST");
- ewl_table_add(EWL_TABLE(table), button[0], 3, 4, 2, 3);
- ewl_widget_show(button[0]);
+ button[0] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[0]), "FIRST");
+ ewl_table_add(EWL_TABLE(table), button[0], 3, 4, 2, 3);
+ ewl_widget_show(button[0]);
#if 0
- button[1] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[1]), NULL);
- ewl_table_attach(EWL_TABLE(table), button[1], 1, 1, 2, 2);
- ewl_object_set_custom_size(EWL_OBJECT(button[1]), 100, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(button[1]),
- EWL_FLAG_FILL_NORMAL);
- ewl_widget_realize(button[1]);
-
- button[2] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[2]), NULL);
- ewl_table_attach(EWL_TABLE(table), button[2], 1, 1, 3, 3);
- ewl_object_set_custom_size(EWL_OBJECT(button[2]), 100, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(button[2]),
- EWL_FLAG_FILL_NORMAL);
- ewl_widget_show(button[2]);
-
-
- button[3] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[3]), NULL);
- ewl_object_set_custom_height(EWL_OBJECT(button[3]), 20);
- ewl_table_attach(EWL_TABLE(table), button[3], 2, 2, 1, 1);
- ewl_widget_show(button[3]);
-
- button[4] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[4]), NULL);
- ewl_object_set_custom_height(EWL_OBJECT(button[4]), 20);
- ewl_table_attach(EWL_TABLE(table), button[4], 2, 2, 2, 2);
- ewl_widget_show(button[4]);
-
- button[5] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[5]), NULL);
- ewl_object_set_custom_height(EWL_OBJECT(button[5]), 20);
- ewl_table_attach(EWL_TABLE(table), button[5], 2, 2, 3, 3);
- ewl_widget_realize(button[5]);
-
- button[6] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[6]), NULL);
- ewl_table_attach(EWL_TABLE(table), button[6], 2, 2, 4, 4);
- ewl_object_set_custom_size(EWL_OBJECT(button[6]), 100, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(button[6]),
- EWL_FLAG_FILL_NORMAL);
- ewl_widget_realize(button[6]);
-
- button[7] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[7]), NULL);
- ewl_table_attach(EWL_TABLE(table), button[7], 3, 3, 4, 4);
- ewl_object_set_custom_size(EWL_OBJECT(button[7]), 100, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(button[7]),
- EWL_FLAG_FILL_NORMAL);
- ewl_widget_realize(button[7]);
-
- button[8] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[8]), NULL);
- ewl_object_set_custom_height(EWL_OBJECT(button[8]), 20);
- ewl_table_attach(EWL_TABLE(table), button[8], 3, 3, 2, 2);
- ewl_widget_realize(button[8]);
-
- button[9] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[9]), NULL);
- ewl_object_set_custom_height(EWL_OBJECT(button[9]), 20);
- ewl_table_attach(EWL_TABLE(table), button[9], 2, 3, 5, 5);
- ewl_widget_realize(button[9]);
-
- button[10] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[10]), NULL);
- ewl_object_set_custom_size(EWL_OBJECT(button[10]), 100, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(button[10]),
- EWL_FLAG_FILL_NORMAL);
- ewl_table_attach(EWL_TABLE(table), button[10], 4, 4, 4, 4);
- ewl_widget_realize(button[10]);
-
- button[11] = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button[11]), NULL);
- ewl_object_set_custom_size(EWL_OBJECT(button[11]), 100, 20);
- ewl_object_fill_policy_set(EWL_OBJECT(button[11]),
- EWL_FLAG_FILL_NORMAL);
-
- ewl_table_attach(EWL_TABLE(table), button[11], 4, 4, 5, 5);
- ewl_widget_realize(button[11]);
+ button[1] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[1]), NULL);
+ ewl_table_attach(EWL_TABLE(table), button[1], 1, 1, 2, 2);
+ ewl_object_set_custom_size(EWL_OBJECT(button[1]), 100, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[1]),
+ EWL_FLAG_FILL_NORMAL);
+ ewl_widget_realize(button[1]);
+
+ button[2] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[2]), NULL);
+ ewl_table_attach(EWL_TABLE(table), button[2], 1, 1, 3, 3);
+ ewl_object_set_custom_size(EWL_OBJECT(button[2]), 100, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[2]),
+ EWL_FLAG_FILL_NORMAL);
+ ewl_widget_show(button[2]);
+
+
+ button[3] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[3]), NULL);
+ ewl_object_set_custom_height(EWL_OBJECT(button[3]), 20);
+ ewl_table_attach(EWL_TABLE(table), button[3], 2, 2, 1, 1);
+ ewl_widget_show(button[3]);
+
+ button[4] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[4]), NULL);
+ ewl_object_set_custom_height(EWL_OBJECT(button[4]), 20);
+ ewl_table_attach(EWL_TABLE(table), button[4], 2, 2, 2, 2);
+ ewl_widget_show(button[4]);
+
+ button[5] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[5]), NULL);
+ ewl_object_set_custom_height(EWL_OBJECT(button[5]), 20);
+ ewl_table_attach(EWL_TABLE(table), button[5], 2, 2, 3, 3);
+ ewl_widget_realize(button[5]);
+
+ button[6] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[6]), NULL);
+ ewl_table_attach(EWL_TABLE(table), button[6], 2, 2, 4, 4);
+ ewl_object_set_custom_size(EWL_OBJECT(button[6]), 100, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[6]),
+ EWL_FLAG_FILL_NORMAL);
+ ewl_widget_realize(button[6]);
+
+ button[7] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[7]), NULL);
+ ewl_table_attach(EWL_TABLE(table), button[7], 3, 3, 4, 4);
+ ewl_object_set_custom_size(EWL_OBJECT(button[7]), 100, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[7]),
+ EWL_FLAG_FILL_NORMAL);
+ ewl_widget_realize(button[7]);
+
+ button[8] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[8]), NULL);
+ ewl_object_set_custom_height(EWL_OBJECT(button[8]), 20);
+ ewl_table_attach(EWL_TABLE(table), button[8], 3, 3, 2, 2);
+ ewl_widget_realize(button[8]);
+
+ button[9] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[9]), NULL);
+ ewl_object_set_custom_height(EWL_OBJECT(button[9]), 20);
+ ewl_table_attach(EWL_TABLE(table), button[9], 2, 3, 5, 5);
+ ewl_widget_realize(button[9]);
+
+ button[10] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[10]), NULL);
+ ewl_object_set_custom_size(EWL_OBJECT(button[10]), 100, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[10]),
+ EWL_FLAG_FILL_NORMAL);
+ ewl_table_attach(EWL_TABLE(table), button[10], 4, 4, 4, 4);
+ ewl_widget_realize(button[10]);
+
+ button[11] = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button[11]), NULL);
+ ewl_object_set_custom_size(EWL_OBJECT(button[11]), 100, 20);
+ ewl_object_fill_policy_set(EWL_OBJECT(button[11]),
+ EWL_FLAG_FILL_NORMAL);
+
+ ewl_table_attach(EWL_TABLE(table), button[11], 4, 4, 5, 5);
+ ewl_widget_realize(button[11]);
#endif
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/text/ewl_text_test.c b/src/bin/tests/text/ewl_text_test.c
index fc4acba..1ee16df 100644
--- a/src/bin/tests/text/ewl_text_test.c
+++ b/src/bin/tests/text/ewl_text_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_text_fmt.h"
#include "ewl_text_trigger.h"
@@ -18,328 +18,328 @@ static int text_valid_utf8_set_get(char *buf, int len);
static int text_invalid_utf8_set_get(char *buf, int len);
static Ewl_Unit_Test text_unit_tests[] = {
- {"text set/get", text_test_set_get, NULL, -1, 0},
- {"valid UTF-8 text set/get", text_valid_utf8_set_get, NULL, -1, 0},
- {"invalid UTF-8 text set/get", text_invalid_utf8_set_get, NULL, -1, 0},
- {"null text set/get", text_test_set_get_null, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"text set/get", text_test_set_get, NULL, -1, 0},
+ {"valid UTF-8 text set/get", text_valid_utf8_set_get, NULL, -1, 0},
+ {"invalid UTF-8 text set/get", text_invalid_utf8_set_get, NULL, -1, 0},
+ {"null text set/get", text_test_set_get_null, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Text";
- test->tip = "Defines a class for multi-line text layout\n"
- "and formatting.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
- test->unit_tests = text_unit_tests;
+ test->name = "Text";
+ test->tip = "Defines a class for multi-line text layout\n"
+ "and formatting.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
+ test->unit_tests = text_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o;
- Ewl_Text_Trigger *trigger;
- int len;
+ Ewl_Widget *o;
+ Ewl_Text_Trigger *trigger;
+ int len;
- o = ewl_text_new();
- ewl_widget_name_set(o, "text");
- ewl_text_selectable_set(EWL_TEXT(o), TRUE);
- ewl_container_child_append(EWL_CONTAINER(box), o);
- ewl_widget_show(o);
+ o = ewl_text_new();
+ ewl_widget_name_set(o, "text");
+ ewl_text_selectable_set(EWL_TEXT(o), TRUE);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
- printf("Insert 'The first bunch of text\\n' [24]\n");
- ewl_text_text_insert(EWL_TEXT(o), "The first bunch of text\n", 0); /* 24 */
+ printf("Insert 'The first bunch of text\\n' [24]\n");
+ ewl_text_text_insert(EWL_TEXT(o), "The first bunch of text\n", 0); /* 24 */
- printf("Cursor position\n");
- ewl_text_cursor_position_set(EWL_TEXT(o), 10);
+ printf("Cursor position\n");
+ ewl_text_cursor_position_set(EWL_TEXT(o), 10);
- printf("Colour apply\n");
- ewl_text_color_apply(EWL_TEXT(o), 0, 0, 255, 255, 5);
+ printf("Colour apply\n");
+ ewl_text_color_apply(EWL_TEXT(o), 0, 0, 255, 255, 5);
- printf("Appending 'The second bunch of text\\n' [49]\n");
- ewl_text_text_append(EWL_TEXT(o), "The second bunch of text\n"); /* 25 */
+ printf("Appending 'The second bunch of text\\n' [49]\n");
+ ewl_text_text_append(EWL_TEXT(o), "The second bunch of text\n"); /* 25 */
- printf("Font size set\n");
- ewl_text_font_size_set(EWL_TEXT(o), 20);
+ printf("Font size set\n");
+ ewl_text_font_size_set(EWL_TEXT(o), 20);
- printf("Styles set\n");
- ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_DOUBLE_UNDERLINE
- | EWL_TEXT_STYLE_OUTLINE
- | EWL_TEXT_STYLE_SOFT_SHADOW);
- printf("Double underline colour set\n");
- ewl_text_double_underline_color_set(EWL_TEXT(o), 50, 50, 50, 255);
+ printf("Styles set\n");
+ ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_DOUBLE_UNDERLINE
+ | EWL_TEXT_STYLE_OUTLINE
+ | EWL_TEXT_STYLE_SOFT_SHADOW);
+ printf("Double underline colour set\n");
+ ewl_text_double_underline_color_set(EWL_TEXT(o), 50, 50, 50, 255);
- printf("Shadow colour set\n");
- ewl_text_shadow_color_set(EWL_TEXT(o), 128, 128, 128, 128);
+ printf("Shadow colour set\n");
+ ewl_text_shadow_color_set(EWL_TEXT(o), 128, 128, 128, 128);
- printf("Outline colour set\n");
- ewl_text_outline_color_set(EWL_TEXT(o), 200, 200, 200, 200);
+ printf("Outline colour set\n");
+ ewl_text_outline_color_set(EWL_TEXT(o), 200, 200, 200, 200);
- printf("Appending 'The third bunch of text\\n' [73]\n");
- ewl_text_text_append(EWL_TEXT(o), "The third bunch of text\n"); /* 24 */
+ printf("Appending 'The third bunch of text\\n' [73]\n");
+ ewl_text_text_append(EWL_TEXT(o), "The third bunch of text\n"); /* 24 */
- printf("Inserting 'The fourth bunch of text\\n' [98]\n");
- ewl_text_text_insert(EWL_TEXT(o), "The fourth bunch of text\n", 31); /* 25 */
+ printf("Inserting 'The fourth bunch of text\\n' [98]\n");
+ ewl_text_text_insert(EWL_TEXT(o), "The fourth bunch of text\n", 31); /* 25 */
- printf("Creating trigger [115]\n");
- trigger = EWL_TEXT_TRIGGER(ewl_text_trigger_new(EWL_TEXT_TRIGGER_TYPE_TRIGGER));
- ewl_text_trigger_start_pos_set(trigger, ewl_text_length_get(EWL_TEXT(o)));
- ewl_text_cursor_position_set(EWL_TEXT(o), ewl_text_length_get(EWL_TEXT(o)));
- ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_NONE);
- ewl_text_text_append(EWL_TEXT(o), "This is the link."); /* 17 */
+ printf("Creating trigger [115]\n");
+ trigger = EWL_TEXT_TRIGGER(ewl_text_trigger_new(EWL_TEXT_TRIGGER_TYPE_TRIGGER));
+ ewl_text_trigger_start_pos_set(trigger, ewl_text_length_get(EWL_TEXT(o)));
+ ewl_text_cursor_position_set(EWL_TEXT(o), ewl_text_length_get(EWL_TEXT(o)));
+ ewl_text_styles_set(EWL_TEXT(o), EWL_TEXT_STYLE_NONE);
+ ewl_text_text_append(EWL_TEXT(o), "This is the link."); /* 17 */
- len = ewl_text_cursor_position_get(EWL_TEXT(o)) -
- ewl_text_trigger_start_pos_get(trigger);
- ewl_text_trigger_length_set(trigger, len);
+ len = ewl_text_cursor_position_get(EWL_TEXT(o)) -
+ ewl_text_trigger_start_pos_get(trigger);
+ ewl_text_trigger_length_set(trigger, len);
- ewl_container_child_append(EWL_CONTAINER(o), EWL_WIDGET(trigger));
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_UP,
- trigger_cb, "You clicked the trigger, have a cookie.");
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_IN,
- trigger_cb_mouse_in, NULL);
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_OUT,
- trigger_cb_mouse_out, NULL);
+ ewl_container_child_append(EWL_CONTAINER(o), EWL_WIDGET(trigger));
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_UP,
+ trigger_cb, "You clicked the trigger, have a cookie.");
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_IN,
+ trigger_cb_mouse_in, NULL);
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_OUT,
+ trigger_cb_mouse_out, NULL);
- printf("Inserting 'The fifth bunch of text\\n' [139]\n");
- ewl_text_text_insert(EWL_TEXT(o), "The fifth bunch of text\n", 0); /* 24 */
+ printf("Inserting 'The fifth bunch of text\\n' [139]\n");
+ ewl_text_text_insert(EWL_TEXT(o), "The fifth bunch of text\n", 0); /* 24 */
- printf("Cursor position\n");
- ewl_text_cursor_position_set(EWL_TEXT(o), 0);
+ printf("Cursor position\n");
+ ewl_text_cursor_position_set(EWL_TEXT(o), 0);
- printf("Colour apply\n");
- ewl_text_color_apply(EWL_TEXT(o), 255, 0, 0, 255, 24);
+ printf("Colour apply\n");
+ ewl_text_color_apply(EWL_TEXT(o), 255, 0, 0, 255, 24);
- printf("Inserting 'The sixth bunch of text\\n' [163]\n");
- ewl_text_text_insert(EWL_TEXT(o), "The sixth bunch of text\n", 24); /* 24 */
+ printf("Inserting 'The sixth bunch of text\\n' [163]\n");
+ ewl_text_text_insert(EWL_TEXT(o), "The sixth bunch of text\n", 24); /* 24 */
- printf("Cursor position\n");
- ewl_text_cursor_position_set(EWL_TEXT(o), 43);
+ printf("Cursor position\n");
+ ewl_text_cursor_position_set(EWL_TEXT(o), 43);
- printf("Colour apply\n");
- ewl_text_color_apply(EWL_TEXT(o), 0, 255, 0, 255, 14);
+ printf("Colour apply\n");
+ ewl_text_color_apply(EWL_TEXT(o), 0, 255, 0, 255, 14);
- printf("Cursor position\n");
- ewl_text_cursor_position_set(EWL_TEXT(o), ewl_text_length_get(EWL_TEXT(o)));
+ printf("Cursor position\n");
+ ewl_text_cursor_position_set(EWL_TEXT(o), ewl_text_length_get(EWL_TEXT(o)));
- printf("Colour set\n");
- ewl_text_color_set(EWL_TEXT(o), 255, 0, 0, 255);
+ printf("Colour set\n");
+ ewl_text_color_set(EWL_TEXT(o), 255, 0, 0, 255);
- printf("Appending 'And in red\\n' [174]\n");
- ewl_text_text_append(EWL_TEXT(o), "And in red\n"); /* 11 */
+ printf("Appending 'And in red\\n' [174]\n");
+ ewl_text_text_append(EWL_TEXT(o), "And in red\n"); /* 11 */
- printf("Colour set\n");
- ewl_text_color_set(EWL_TEXT(o), 0, 0, 0, 255);
+ printf("Colour set\n");
+ ewl_text_color_set(EWL_TEXT(o), 0, 0, 0, 255);
- printf("Appending 'Once more with feeling. ' [198]\n");
- ewl_text_text_append(EWL_TEXT(o), "Once more with feeling. "); /* 24 */
+ printf("Appending 'Once more with feeling. ' [198]\n");
+ ewl_text_text_append(EWL_TEXT(o), "Once more with feeling. "); /* 24 */
- printf("Trigger\n");
- trigger = EWL_TEXT_TRIGGER(ewl_text_trigger_new(EWL_TEXT_TRIGGER_TYPE_TRIGGER));
- ewl_text_trigger_start_pos_set(trigger, ewl_text_length_get(EWL_TEXT(o)));
+ printf("Trigger\n");
+ trigger = EWL_TEXT_TRIGGER(ewl_text_trigger_new(EWL_TEXT_TRIGGER_TYPE_TRIGGER));
+ ewl_text_trigger_start_pos_set(trigger, ewl_text_length_get(EWL_TEXT(o)));
- printf("Appending 'This is the multi\\n\\nline link.' [226]\n");
- ewl_text_text_append(EWL_TEXT(o), "This is the multi\n\nline link."); /* 29 */
- len = ewl_text_cursor_position_get(EWL_TEXT(o)) -
- ewl_text_trigger_start_pos_get(trigger);
- ewl_text_trigger_length_set(trigger, len);
+ printf("Appending 'This is the multi\\n\\nline link.' [226]\n");
+ ewl_text_text_append(EWL_TEXT(o), "This is the multi\n\nline link."); /* 29 */
+ len = ewl_text_cursor_position_get(EWL_TEXT(o)) -
+ ewl_text_trigger_start_pos_get(trigger);
+ ewl_text_trigger_length_set(trigger, len);
- ewl_container_child_append(EWL_CONTAINER(o), EWL_WIDGET(trigger));
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_UP,
- trigger_cb, "You clicked the multi-line trigger, have a coke.");
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_IN,
- trigger_cb_mouse_in, NULL);
- ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_OUT,
- trigger_cb_mouse_out, NULL);
+ ewl_container_child_append(EWL_CONTAINER(o), EWL_WIDGET(trigger));
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_UP,
+ trigger_cb, "You clicked the multi-line trigger, have a coke.");
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_IN,
+ trigger_cb_mouse_in, NULL);
+ ewl_callback_append(EWL_WIDGET(trigger), EWL_CALLBACK_MOUSE_OUT,
+ trigger_cb_mouse_out, NULL);
- printf("Colour set\n");
- ewl_text_color_set(EWL_TEXT(o), 255, 0, 255, 255);
+ printf("Colour set\n");
+ ewl_text_color_set(EWL_TEXT(o), 255, 0, 255, 255);
- printf("Appending 'ONE MORE SEGV\\n\\n' [241]\n");
- ewl_text_text_append(EWL_TEXT(o), "ONE MORE SEGV\n\n"); /* 15 */
+ printf("Appending 'ONE MORE SEGV\\n\\n' [241]\n");
+ ewl_text_text_append(EWL_TEXT(o), "ONE MORE SEGV\n\n"); /* 15 */
- printf("Colour set\n");
- ewl_text_color_set(EWL_TEXT(o), 0, 0, 0, 255);
+ printf("Colour set\n");
+ ewl_text_color_set(EWL_TEXT(o), 0, 0, 0, 255);
- printf("Appending 'Align Left\\n' [252]\n");
- ewl_text_text_append(EWL_TEXT(o), "Align Left\n"); /* 11 */
+ printf("Appending 'Align Left\\n' [252]\n");
+ ewl_text_text_append(EWL_TEXT(o), "Align Left\n"); /* 11 */
- printf("Align set\n");
- ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_CENTER);
+ printf("Align set\n");
+ ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_CENTER);
- printf("Appending 'Align Center.\\n' [266]\n");
- ewl_text_text_append(EWL_TEXT(o), "Align Center.\n"); /* 14 */
+ printf("Appending 'Align Center.\\n' [266]\n");
+ ewl_text_text_append(EWL_TEXT(o), "Align Center.\n"); /* 14 */
- printf("Align set\n");
- ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_RIGHT);
+ printf("Align set\n");
+ ewl_text_align_set(EWL_TEXT(o), EWL_FLAG_ALIGN_RIGHT);
- printf("Appending 'Align Right.\\n' [279]\n");
- ewl_text_text_append(EWL_TEXT(o), "Align Right.\n"); /* 13 */
+ printf("Appending 'Align Right.\\n' [279]\n");
+ ewl_text_text_append(EWL_TEXT(o), "Align Right.\n"); /* 13 */
- return 1;
+ return 1;
}
static void
trigger_cb(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data)
{
- printf("%s\n", (char *)data);
+ printf("%s\n", (char *)data);
}
static void
trigger_cb_mouse_in(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger *t;
+ Ewl_Text_Trigger *t;
- t = EWL_TEXT_TRIGGER(w);
+ t = EWL_TEXT_TRIGGER(w);
- ewl_text_cursor_position_set(EWL_TEXT(t->text_parent), t->char_pos);
- ewl_text_color_apply(EWL_TEXT(t->text_parent), 255, 0, 0, 255, t->char_len);
+ ewl_text_cursor_position_set(EWL_TEXT(t->text_parent), t->char_pos);
+ ewl_text_color_apply(EWL_TEXT(t->text_parent), 255, 0, 0, 255, t->char_len);
}
static void
trigger_cb_mouse_out(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Text_Trigger *t;
+ Ewl_Text_Trigger *t;
- t = EWL_TEXT_TRIGGER(w);
+ t = EWL_TEXT_TRIGGER(w);
- ewl_text_cursor_position_set(EWL_TEXT(t->text_parent), t->char_pos);
- ewl_text_color_apply(EWL_TEXT(t->text_parent), 0, 0, 0, 255, t->char_len);
+ ewl_text_cursor_position_set(EWL_TEXT(t->text_parent), t->char_pos);
+ ewl_text_color_apply(EWL_TEXT(t->text_parent), 0, 0, 0, 255, t->char_len);
}
static int
text_test_set_get(char *buf, int len)
{
- Ewl_Widget *o;
- char *t;
- int ret = 0;
+ Ewl_Widget *o;
+ char *t;
+ int ret = 0;
- o = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(o), "This is the test text.");
- t = ewl_text_text_get(EWL_TEXT(o));
+ o = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(o), "This is the test text.");
+ t = ewl_text_text_get(EWL_TEXT(o));
- if (strcmp(t, "This is the test text."))
- LOG_FAILURE(buf, len, "text_get did not match text_set.");
- else
- ret = 1;
+ if (strcmp(t, "This is the test text."))
+ LOG_FAILURE(buf, len, "text_get did not match text_set.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
static int
text_test_set_get_null(char *buf, int len)
{
- Ewl_Widget *o;
- char *t;
- int ret = 0;
+ Ewl_Widget *o;
+ char *t;
+ int ret = 0;
- o = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(o), "");
- t = ewl_text_text_get(EWL_TEXT(o));
+ o = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(o), "");
+ t = ewl_text_text_get(EWL_TEXT(o));
- if (t)
- LOG_FAILURE(buf, len, "text_get did not return null.");
- else
- ret = 1;
+ if (t)
+ LOG_FAILURE(buf, len, "text_get did not return null.");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
static int
text_valid_utf8_set_get(char *buf, int len)
{
- Ewl_Widget *t;
- char text[] = "This a valid UTF-8 string, although it contains "
- "at the moment only 7-bit ascii code.\n"
- " This will be changed later!";
- const char * returned_text;
- unsigned char *utext;
-
- utext = (unsigned char *)text;
-
- t = ewl_text_new();
- ewl_widget_show(t);
-
- /*
- * append the US-ASCII string
- */
- ewl_text_text_set(EWL_TEXT(t), text);
- returned_text = ewl_text_text_get(EWL_TEXT(t));
-
- if (strcmp(text, returned_text)) {
- LOG_FAILURE(buf, len, "Incorrect UTF-8 validation during"
- "setting a US-ASCII string");
- return FALSE;
- }
-
- ewl_text_clear(EWL_TEXT(t));
-
- /* insert the umlaut a with two dots */
- utext[2] = 0xC3;
- utext[3] = 0xA4;
- /* insert the euro sign */
- utext[10] = 0xE2;
- utext[11] = 0x82;
- utext[12] = 0xAC;
- /*
- * set a valid UTF-8 string
- */
- ewl_text_text_set(EWL_TEXT(t), text);
- returned_text = ewl_text_text_get(EWL_TEXT(t));
-
- if (strcmp(text, returned_text)) {
- LOG_FAILURE(buf, len, "Incorrect UTF-8 validation during"
- "setting a valid UTF-8 string");
- return FALSE;
- }
- return TRUE;
+ Ewl_Widget *t;
+ char text[] = "This a valid UTF-8 string, although it contains "
+ "at the moment only 7-bit ascii code.\n"
+ " This will be changed later!";
+ const char * returned_text;
+ unsigned char *utext;
+
+ utext = (unsigned char *)text;
+
+ t = ewl_text_new();
+ ewl_widget_show(t);
+
+ /*
+ * append the US-ASCII string
+ */
+ ewl_text_text_set(EWL_TEXT(t), text);
+ returned_text = ewl_text_text_get(EWL_TEXT(t));
+
+ if (strcmp(text, returned_text)) {
+ LOG_FAILURE(buf, len, "Incorrect UTF-8 validation during"
+ "setting a US-ASCII string");
+ return FALSE;
+ }
+
+ ewl_text_clear(EWL_TEXT(t));
+
+ /* insert the umlaut a with two dots */
+ utext[2] = 0xC3;
+ utext[3] = 0xA4;
+ /* insert the euro sign */
+ utext[10] = 0xE2;
+ utext[11] = 0x82;
+ utext[12] = 0xAC;
+ /*
+ * set a valid UTF-8 string
+ */
+ ewl_text_text_set(EWL_TEXT(t), text);
+ returned_text = ewl_text_text_get(EWL_TEXT(t));
+
+ if (strcmp(text, returned_text)) {
+ LOG_FAILURE(buf, len, "Incorrect UTF-8 validation during"
+ "setting a valid UTF-8 string");
+ return FALSE;
+ }
+ return TRUE;
}
static int
text_invalid_utf8_set_get(char *buf, int len)
{
- Ewl_Widget *t;
- char text[] = "This a valid UTF-8 string, although it contains "
- "at the moment only 7-bit ascii code.\n"
- " This will be changed later!";
- const char *returned_text;
- unsigned char *utext;
-
- utext = (unsigned char *)text;
-
- t = ewl_text_new();
- ewl_widget_show(t);
-
- /* insert some invalid bytes */
- utext[2] = 254;
- utext[4] = 0xA4;
-
- /* insert the euro sign without the 3rd byte */
- utext[10] = 0xE2;
- utext[11] = 0x82;
-
- /* set a valid UTF-8 string */
- ewl_text_text_set(EWL_TEXT(t), text);
- returned_text = ewl_text_text_get(EWL_TEXT(t));
-
- if (!returned_text)
- LOG_FAILURE(buf, len, "ewl_text_text_get() returned a NULL pointer");
-
- else if (!strcmp(text, returned_text)
- || returned_text[2] < 0
- || returned_text[4] < 0
- || returned_text[10] < 0
- || returned_text[11] < 0)
- {
- LOG_FAILURE(buf, len, "Incorrect UTF-8 validation during"
- "setting a invalid UTF-8 string");
- return FALSE;
- }
- return TRUE;
+ Ewl_Widget *t;
+ char text[] = "This a valid UTF-8 string, although it contains "
+ "at the moment only 7-bit ascii code.\n"
+ " This will be changed later!";
+ const char *returned_text;
+ unsigned char *utext;
+
+ utext = (unsigned char *)text;
+
+ t = ewl_text_new();
+ ewl_widget_show(t);
+
+ /* insert some invalid bytes */
+ utext[2] = 254;
+ utext[4] = 0xA4;
+
+ /* insert the euro sign without the 3rd byte */
+ utext[10] = 0xE2;
+ utext[11] = 0x82;
+
+ /* set a valid UTF-8 string */
+ ewl_text_text_set(EWL_TEXT(t), text);
+ returned_text = ewl_text_text_get(EWL_TEXT(t));
+
+ if (!returned_text)
+ LOG_FAILURE(buf, len, "ewl_text_text_get() returned a NULL pointer");
+
+ else if (!strcmp(text, returned_text)
+ || returned_text[2] < 0
+ || returned_text[4] < 0
+ || returned_text[10] < 0
+ || returned_text[11] < 0)
+ {
+ LOG_FAILURE(buf, len, "Incorrect UTF-8 validation during"
+ "setting a invalid UTF-8 string");
+ return FALSE;
+ }
+ return TRUE;
}
diff --git a/src/bin/tests/text_editor/ewl_text_editor_test.c b/src/bin/tests/text_editor/ewl_text_editor_test.c
index 6758ba6..2473e6b 100644
--- a/src/bin/tests/text_editor/ewl_text_editor_test.c
+++ b/src/bin/tests/text_editor/ewl_text_editor_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_combo.h"
@@ -18,31 +18,31 @@
typedef struct
{
- char *name;
- void (*cb)(Ewl_Widget *w, void *ev, void *data);
+ char *name;
+ void (*cb)(Ewl_Widget *w, void *ev, void *data);
} Ewl_Text_Editor_Control;
static char *txt = "I'm not a lumberjack, or a fur trader,\n"
- "I don't live in an igloo,\n"
- "Or eat blubber,\n"
- "Or own a dogsled,\n"
- "And I don't know Jimmy, Sally, or Suzie from Canada,"
- "although I'm certain they're really really nice,\n"
- "I have a Prime Minister, not a President,\n"
- "I speak English and French, not American,\n"
- "And I pronounce it about, not aboot,\n"
- "I can proudly sew my country's flag on my backpack,\n"
- "I believe in peacekeeping, not policing,\n"
- "diversity, not assimilation,\n"
- "and that the Beaver is a truly proud and nobel animal,\n"
- "a touque is a hat,\n"
- "a chesterfield is a couch,\n"
- "and it is pronounced Zed, not Zee, Zed,\n"
- "Canada is the 2nd largest land mass,\n"
- "the first nation of hockey,\n"
- "and the best part of North America,\n"
- "My name is Joe,\n"
- "and I AM CANADIAN!!!!!";
+ "I don't live in an igloo,\n"
+ "Or eat blubber,\n"
+ "Or own a dogsled,\n"
+ "And I don't know Jimmy, Sally, or Suzie from Canada,"
+ "although I'm certain they're really really nice,\n"
+ "I have a Prime Minister, not a President,\n"
+ "I speak English and French, not American,\n"
+ "And I pronounce it about, not aboot,\n"
+ "I can proudly sew my country's flag on my backpack,\n"
+ "I believe in peacekeeping, not policing,\n"
+ "diversity, not assimilation,\n"
+ "and that the Beaver is a truly proud and nobel animal,\n"
+ "a touque is a hat,\n"
+ "a chesterfield is a couch,\n"
+ "and it is pronounced Zed, not Zee, Zed,\n"
+ "Canada is the 2nd largest land mass,\n"
+ "the first nation of hockey,\n"
+ "and the best part of North America,\n"
+ "My name is Joe,\n"
+ "and I AM CANADIAN!!!!!";
static int create_test(Ewl_Container *box);
@@ -68,449 +68,449 @@ static void ete_cb_clear(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Text Editor";
- test->tip = "Defines a class for multi-line text layout\n"
- "and formatting.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Text Editor";
+ test->tip = "Defines a class for multi-line text layout\n"
+ "and formatting.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *hbox, *scroll, *o;
-
- hbox = ewl_htoolbar_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_toolbar_icon_part_hide(EWL_TOOLBAR(hbox), EWL_ICON_PART_LABEL);
- ewl_widget_show(hbox);
-
- {
- int i;
- Ewl_Model *model;
- Ewl_View *view;
- Ecore_List *styles;
-
- struct
- {
- char *icon;
- char *tooltip;
- void (*cb)(Ewl_Widget *w, void *ev, void *data);
- } format[] = {
- {EWL_ICON_FORMAT_JUSTIFY_LEFT, "Left align",
- ete_cb_justify_left},
- {EWL_ICON_FORMAT_JUSTIFY_CENTER, "Center",
- ete_cb_justify_center},
- {EWL_ICON_FORMAT_JUSTIFY_RIGHT, "Right align",
- ete_cb_justify_right},
- {EWL_ICON_FORMAT_TEXT_BOLD, "Bold", ete_cb_bold},
- {EWL_ICON_FORMAT_TEXT_ITALIC, "Italic", ete_cb_italic},
- {EWL_ICON_FORMAT_TEXT_UNDERLINE, "Underline",
- ete_cb_underline},
- {EWL_ICON_FORMAT_TEXT_STRIKETHROUGH, "Strikethrough",
- ete_cb_strikethrough},
- {NULL, NULL, NULL}
- };
-
- styles = ecore_list_new();
- ecore_list_append(styles, "None");
- ecore_list_append(styles, "Shadow");
- ecore_list_append(styles, "Soft Shadow");
- ecore_list_append(styles, "Far Shadow");
- ecore_list_append(styles, "Glow");
- ecore_list_append(styles, "Outline");
-
- for (i = 0; format[i].icon != NULL; i++)
- {
- const char *path;
-
- path = ewl_icon_theme_icon_path_get(format[i].icon,
- EWL_ICON_SIZE_SMALL);
-
- o = ewl_icon_simple_new();
- ewl_icon_image_set(EWL_ICON(o), path,
- format[i].icon);
- ewl_icon_label_set(EWL_ICON(o), format[i].tooltip);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_VFILL);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- format[i].cb, NULL);
- ewl_attach_tooltip_text_set(o, format[i].tooltip);
- ewl_widget_show(o);
- }
-
- o = ewl_spacer_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_widget_show(o);
-
- o = ewl_label_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_label_text_set(EWL_LABEL(o), "Font Style");
- ewl_widget_show(o);
-
- model = ewl_model_ecore_list_instance();
- view = ewl_label_view_get();
- o = ewl_combo_new();
- ewl_mvc_model_set(EWL_MVC(o), model);
- ewl_mvc_view_set(EWL_MVC(o), view);
- ewl_mvc_data_set(EWL_MVC(o), styles);
- ewl_mvc_selected_set(EWL_MVC(o), NULL,
- ewl_mvc_data_get(EWL_MVC(o)), 0, 0);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ete_cb_styles_changed, NULL);
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_widget_show(o);
-
- o = ewl_label_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_label_text_set(EWL_LABEL(o), "Font Size");
- ewl_widget_show(o);
-
- o = ewl_spinner_new();
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
- ewl_range_value_set(EWL_RANGE(o), 12);
- ewl_range_minimum_value_set(EWL_RANGE(o), 8);
- ewl_range_maximum_value_set(EWL_RANGE(o), 72);
- ewl_range_step_set(EWL_RANGE(o), 1);
- ewl_spinner_digits_set(EWL_SPINNER(o), 0);
- ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
- ete_cb_font_size, NULL);
- ewl_widget_show(o);
- }
-
- scroll = ewl_scrollpane_new();
- ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(scroll),
- EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN);
- ewl_container_child_append(EWL_CONTAINER(box), scroll);
- ewl_widget_name_set(scroll, "scrollpane");
- ewl_widget_show(scroll);
-
- o = ewl_entry_new();
- ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(scroll), o);
- ewl_widget_name_set(o, "entry");
- ewl_entry_multiline_set(EWL_ENTRY(o), TRUE);
- ewl_text_wrap_set(EWL_TEXT(o), EWL_TEXT_WRAP_WORD);
- ewl_text_font_size_set(EWL_TEXT(o), 12);
-
- 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_widget_show(o);
-
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE);
- ewl_widget_show(hbox);
-
- {
- int i;
- Ewl_Text_Editor_Control btns [] = {
- {"Fetch", ete_cb_fetch},
- {"Set", ete_cb_set},
- {"Load", ete_cb_load},
- {"Clear", ete_cb_clear},
- {NULL, NULL}
- };
-
- for (i = 0; btns[i].name != NULL; i++)
- {
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), btns[i].name);
- ewl_container_child_append(EWL_CONTAINER(hbox), o);
- ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HSHRINK|EWL_FLAG_FILL_VSHRINK);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, btns[i].cb, NULL);
- ewl_widget_show(o);
- }
-
- }
-
- return 1;
+ Ewl_Widget *hbox, *scroll, *o;
+
+ hbox = ewl_htoolbar_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox);
+ ewl_toolbar_icon_part_hide(EWL_TOOLBAR(hbox), EWL_ICON_PART_LABEL);
+ ewl_widget_show(hbox);
+
+ {
+ int i;
+ Ewl_Model *model;
+ Ewl_View *view;
+ Ecore_List *styles;
+
+ struct
+ {
+ char *icon;
+ char *tooltip;
+ void (*cb)(Ewl_Widget *w, void *ev, void *data);
+ } format[] = {
+ {EWL_ICON_FORMAT_JUSTIFY_LEFT, "Left align",
+ ete_cb_justify_left},
+ {EWL_ICON_FORMAT_JUSTIFY_CENTER, "Center",
+ ete_cb_justify_center},
+ {EWL_ICON_FORMAT_JUSTIFY_RIGHT, "Right align",
+ ete_cb_justify_right},
+ {EWL_ICON_FORMAT_TEXT_BOLD, "Bold", ete_cb_bold},
+ {EWL_ICON_FORMAT_TEXT_ITALIC, "Italic", ete_cb_italic},
+ {EWL_ICON_FORMAT_TEXT_UNDERLINE, "Underline",
+ ete_cb_underline},
+ {EWL_ICON_FORMAT_TEXT_STRIKETHROUGH, "Strikethrough",
+ ete_cb_strikethrough},
+ {NULL, NULL, NULL}
+ };
+
+ styles = ecore_list_new();
+ ecore_list_append(styles, "None");
+ ecore_list_append(styles, "Shadow");
+ ecore_list_append(styles, "Soft Shadow");
+ ecore_list_append(styles, "Far Shadow");
+ ecore_list_append(styles, "Glow");
+ ecore_list_append(styles, "Outline");
+
+ for (i = 0; format[i].icon != NULL; i++)
+ {
+ const char *path;
+
+ path = ewl_icon_theme_icon_path_get(format[i].icon,
+ EWL_ICON_SIZE_SMALL);
+
+ o = ewl_icon_simple_new();
+ ewl_icon_image_set(EWL_ICON(o), path,
+ format[i].icon);
+ ewl_icon_label_set(EWL_ICON(o), format[i].tooltip);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_VFILL);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ format[i].cb, NULL);
+ ewl_attach_tooltip_text_set(o, format[i].tooltip);
+ ewl_widget_show(o);
+ }
+
+ o = ewl_spacer_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_widget_show(o);
+
+ o = ewl_label_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_label_text_set(EWL_LABEL(o), "Font Style");
+ ewl_widget_show(o);
+
+ model = ewl_model_ecore_list_instance();
+ view = ewl_label_view_get();
+ o = ewl_combo_new();
+ ewl_mvc_model_set(EWL_MVC(o), model);
+ ewl_mvc_view_set(EWL_MVC(o), view);
+ ewl_mvc_data_set(EWL_MVC(o), styles);
+ ewl_mvc_selected_set(EWL_MVC(o), NULL,
+ ewl_mvc_data_get(EWL_MVC(o)), 0, 0);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ete_cb_styles_changed, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_widget_show(o);
+
+ o = ewl_label_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_label_text_set(EWL_LABEL(o), "Font Size");
+ ewl_widget_show(o);
+
+ o = ewl_spinner_new();
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
+ ewl_range_value_set(EWL_RANGE(o), 12);
+ ewl_range_minimum_value_set(EWL_RANGE(o), 8);
+ ewl_range_maximum_value_set(EWL_RANGE(o), 72);
+ ewl_range_step_set(EWL_RANGE(o), 1);
+ ewl_spinner_digits_set(EWL_SPINNER(o), 0);
+ ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
+ ete_cb_font_size, NULL);
+ ewl_widget_show(o);
+ }
+
+ scroll = ewl_scrollpane_new();
+ ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(scroll),
+ EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN);
+ ewl_container_child_append(EWL_CONTAINER(box), scroll);
+ ewl_widget_name_set(scroll, "scrollpane");
+ ewl_widget_show(scroll);
+
+ o = ewl_entry_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(scroll), o);
+ ewl_widget_name_set(o, "entry");
+ ewl_entry_multiline_set(EWL_ENTRY(o), TRUE);
+ ewl_text_wrap_set(EWL_TEXT(o), EWL_TEXT_WRAP_WORD);
+ ewl_text_font_size_set(EWL_TEXT(o), 12);
+
+ 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_widget_show(o);
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), hbox);
+ ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE);
+ ewl_widget_show(hbox);
+
+ {
+ int i;
+ Ewl_Text_Editor_Control btns [] = {
+ {"Fetch", ete_cb_fetch},
+ {"Set", ete_cb_set},
+ {"Load", ete_cb_load},
+ {"Clear", ete_cb_clear},
+ {NULL, NULL}
+ };
+
+ for (i = 0; btns[i].name != NULL; i++)
+ {
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), btns[i].name);
+ ewl_container_child_append(EWL_CONTAINER(hbox), o);
+ ewl_object_fill_policy_set(EWL_OBJECT(o),
+ EWL_FLAG_FILL_HSHRINK|EWL_FLAG_FILL_VSHRINK);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, btns[i].cb, NULL);
+ ewl_widget_show(o);
+ }
+
+ }
+
+ return 1;
}
static void
ete_style_apply(Ewl_Text *t, Ewl_Text_Style s)
{
- unsigned int cursor_pos;
- unsigned int styles;
+ unsigned int cursor_pos;
+ unsigned int styles;
- cursor_pos = ewl_text_cursor_position_get(t);
- styles = ewl_text_styles_get(t, cursor_pos);
+ cursor_pos = ewl_text_cursor_position_get(t);
+ styles = ewl_text_styles_get(t, cursor_pos);
- if (styles & s)
- styles &= ~s;
- else
- styles |= s;
+ if (styles & s)
+ styles &= ~s;
+ else
+ styles |= s;
- if (ewl_text_has_selection(t))
- {
- Ewl_Text_Trigger *selection;
+ if (ewl_text_has_selection(t))
+ {
+ Ewl_Text_Trigger *selection;
- selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(t));
- ewl_text_cursor_position_set(t,
- ewl_text_trigger_start_pos_get(selection));
+ selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(t));
+ ewl_text_cursor_position_set(t,
+ ewl_text_trigger_start_pos_get(selection));
- ewl_text_styles_apply(t, styles,
- ewl_text_trigger_length_get(selection));
+ ewl_text_styles_apply(t, styles,
+ ewl_text_trigger_length_get(selection));
- ewl_text_cursor_position_set(t, cursor_pos);
- }
- else
- ewl_text_styles_set(t, styles);
+ ewl_text_cursor_position_set(t, cursor_pos);
+ }
+ else
+ ewl_text_styles_set(t, styles);
}
static void
ete_cb_styles_changed(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry;
- Ewl_Selection_Idx *idx;
- char *str;
+ Ewl_Widget *entry;
+ Ewl_Selection_Idx *idx;
+ char *str;
- idx = ewl_mvc_selected_get(EWL_MVC(w));
- str = ecore_list_index_goto(ewl_mvc_data_get(EWL_MVC(w)), idx->row);
+ idx = ewl_mvc_selected_get(EWL_MVC(w));
+ str = ecore_list_index_goto(ewl_mvc_data_get(EWL_MVC(w)), idx->row);
- entry = ewl_widget_name_find("entry");
- if (!strcmp(str, "None"))
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_NONE);
+ entry = ewl_widget_name_find("entry");
+ if (!strcmp(str, "None"))
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_NONE);
- else if (!strcmp(str, "Shadow"))
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_SHADOW);
+ else if (!strcmp(str, "Shadow"))
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_SHADOW);
- else if (!strcmp(str, "Soft Shadow"))
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_SOFT_SHADOW);
+ else if (!strcmp(str, "Soft Shadow"))
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_SOFT_SHADOW);
- else if (!strcmp(str, "Far Shadow"))
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_FAR_SHADOW);
+ else if (!strcmp(str, "Far Shadow"))
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_FAR_SHADOW);
- else if (!strcmp(str, "Glow"))
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_GLOW);
+ else if (!strcmp(str, "Glow"))
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_GLOW);
- else if (!strcmp(str, "Outline"))
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_OUTLINE);
+ else if (!strcmp(str, "Outline"))
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_OUTLINE);
}
static void
ete_cb_strikethrough(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry;
+ Ewl_Widget *entry;
- entry = ewl_widget_name_find("entry");
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_STRIKETHROUGH);
+ entry = ewl_widget_name_find("entry");
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_STRIKETHROUGH);
}
static void
ete_cb_underline(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry;
+ Ewl_Widget *entry;
- entry = ewl_widget_name_find("entry");
- ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_UNDERLINE);
+ entry = ewl_widget_name_find("entry");
+ ete_style_apply(EWL_TEXT(entry), EWL_TEXT_STYLE_UNDERLINE);
}
static void
ete_align_apply(unsigned int align)
{
- Ewl_Widget *w;
- Ewl_Text *t;
+ Ewl_Widget *w;
+ Ewl_Text *t;
- w = ewl_widget_name_find("entry");
- t = EWL_TEXT(w);
+ w = ewl_widget_name_find("entry");
+ t = EWL_TEXT(w);
- if (ewl_text_has_selection(t))
- {
- Ewl_Text_Trigger *selection;
- unsigned int cursor_pos;
+ if (ewl_text_has_selection(t))
+ {
+ Ewl_Text_Trigger *selection;
+ unsigned int cursor_pos;
- cursor_pos = ewl_text_cursor_position_get(t);
+ cursor_pos = ewl_text_cursor_position_get(t);
- selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(t));
- ewl_text_cursor_position_set(t,
- ewl_text_trigger_start_pos_get(selection));
+ selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(t));
+ ewl_text_cursor_position_set(t,
+ ewl_text_trigger_start_pos_get(selection));
- ewl_text_align_apply(t, align,
- ewl_text_trigger_length_get(selection));
+ ewl_text_align_apply(t, align,
+ ewl_text_trigger_length_get(selection));
- ewl_text_cursor_position_set(t, cursor_pos);
- }
- else
- ewl_text_align_set(t, align);
+ ewl_text_cursor_position_set(t, cursor_pos);
+ }
+ else
+ ewl_text_align_set(t, align);
}
static void
ete_cb_justify_left(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ete_align_apply(EWL_FLAG_ALIGN_LEFT);
+ ete_align_apply(EWL_FLAG_ALIGN_LEFT);
}
static void
ete_cb_justify_center(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ete_align_apply(EWL_FLAG_ALIGN_CENTER);
+ ete_align_apply(EWL_FLAG_ALIGN_CENTER);
}
static void
ete_cb_justify_right(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ete_align_apply(EWL_FLAG_ALIGN_RIGHT);
+ ete_align_apply(EWL_FLAG_ALIGN_RIGHT);
}
static void
ete_font_apply(char *font)
{
- Ewl_Widget *w;
- Ewl_Text *t;
- char *of;
-
- w = ewl_widget_name_find("entry");
- t = EWL_TEXT(w);
-
- if (ewl_text_has_selection(EWL_TEXT(t)))
- of = ewl_text_font_get(EWL_TEXT(t),
- ewl_text_trigger_start_pos_get(
- EWL_TEXT_TRIGGER(ewl_text_selection_get(EWL_TEXT(t)))));
- else
- of = ewl_text_font_get(EWL_TEXT(t),
- ewl_text_cursor_position_get(EWL_TEXT(t)));
-
- if (!strcmp(of, "ewl/default/bold-italic"))
- {
- if (!strcmp(font, "ewl/default/bold"))
- font = "ewl/default/italic";
- else if (!strcmp(font, "ewl/default/italic"))
- font = "ewl/default/bold";
- }
- else if ((!strcmp(of, "ewl/default/italic") && !strcmp(font, "ewl/default/bold"))
- || ((!strcmp(of, "ewl/default/bold") && (!strcmp(font, "ewl/default/italic")))))
- font = "ewl/default/bold-italic";
-
- else if (!strcmp(of, font))
- font = "ewl/default";
-
- if (ewl_text_has_selection(t))
- {
- Ewl_Text_Trigger *selection;
- unsigned int cursor_pos;
-
- cursor_pos = ewl_text_cursor_position_get(t);
-
- selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(t));
- ewl_text_cursor_position_set(t,
- ewl_text_trigger_start_pos_get(selection));
-
- ewl_text_font_apply(t, font,
- ewl_text_trigger_length_get(selection));
-
- ewl_text_cursor_position_set(t, cursor_pos);
- }
- else
- ewl_text_font_set(t, font);
+ Ewl_Widget *w;
+ Ewl_Text *t;
+ char *of;
+
+ w = ewl_widget_name_find("entry");
+ t = EWL_TEXT(w);
+
+ if (ewl_text_has_selection(EWL_TEXT(t)))
+ of = ewl_text_font_get(EWL_TEXT(t),
+ ewl_text_trigger_start_pos_get(
+ EWL_TEXT_TRIGGER(ewl_text_selection_get(EWL_TEXT(t)))));
+ else
+ of = ewl_text_font_get(EWL_TEXT(t),
+ ewl_text_cursor_position_get(EWL_TEXT(t)));
+
+ if (!strcmp(of, "ewl/default/bold-italic"))
+ {
+ if (!strcmp(font, "ewl/default/bold"))
+ font = "ewl/default/italic";
+ else if (!strcmp(font, "ewl/default/italic"))
+ font = "ewl/default/bold";
+ }
+ else if ((!strcmp(of, "ewl/default/italic") && !strcmp(font, "ewl/default/bold"))
+ || ((!strcmp(of, "ewl/default/bold") && (!strcmp(font, "ewl/default/italic")))))
+ font = "ewl/default/bold-italic";
+
+ else if (!strcmp(of, font))
+ font = "ewl/default";
+
+ if (ewl_text_has_selection(t))
+ {
+ Ewl_Text_Trigger *selection;
+ unsigned int cursor_pos;
+
+ cursor_pos = ewl_text_cursor_position_get(t);
+
+ selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(t));
+ ewl_text_cursor_position_set(t,
+ ewl_text_trigger_start_pos_get(selection));
+
+ ewl_text_font_apply(t, font,
+ ewl_text_trigger_length_get(selection));
+
+ ewl_text_cursor_position_set(t, cursor_pos);
+ }
+ else
+ ewl_text_font_set(t, font);
}
static void
ete_cb_bold(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ete_font_apply("ewl/default/bold");
+ ete_font_apply("ewl/default/bold");
}
static void
ete_cb_italic(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ete_font_apply("ewl/default/italic");
+ ete_font_apply("ewl/default/italic");
}
static void
ete_cb_font_size(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry;
-
- entry = ewl_widget_name_find("entry");
- if (ewl_text_has_selection(EWL_TEXT(entry)))
- {
- unsigned int cursor_pos;
- Ewl_Text_Trigger *selection;
-
- cursor_pos = ewl_text_cursor_position_get(EWL_TEXT(entry));
- selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(
- EWL_TEXT(entry)));
- ewl_text_cursor_position_set(EWL_TEXT(entry),
- ewl_text_trigger_start_pos_get(selection));
- ewl_text_font_size_apply(EWL_TEXT(entry),
- ewl_range_value_get(EWL_RANGE(w)),
- ewl_text_trigger_length_get(selection));
- ewl_text_cursor_position_set(EWL_TEXT(entry), cursor_pos);
- }
- else
- ewl_text_font_size_set(EWL_TEXT(entry),
- ewl_range_value_get(EWL_RANGE(w)));
+ Ewl_Widget *entry;
+
+ entry = ewl_widget_name_find("entry");
+ if (ewl_text_has_selection(EWL_TEXT(entry)))
+ {
+ unsigned int cursor_pos;
+ Ewl_Text_Trigger *selection;
+
+ cursor_pos = ewl_text_cursor_position_get(EWL_TEXT(entry));
+ selection = EWL_TEXT_TRIGGER(ewl_text_selection_get(
+ EWL_TEXT(entry)));
+ ewl_text_cursor_position_set(EWL_TEXT(entry),
+ ewl_text_trigger_start_pos_get(selection));
+ ewl_text_font_size_apply(EWL_TEXT(entry),
+ ewl_range_value_get(EWL_RANGE(w)),
+ ewl_text_trigger_length_get(selection));
+ ewl_text_cursor_position_set(EWL_TEXT(entry), cursor_pos);
+ }
+ else
+ ewl_text_font_size_set(EWL_TEXT(entry),
+ ewl_range_value_get(EWL_RANGE(w)));
}
static void
ete_cb_fetch(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry;
- char *txt;
+ Ewl_Widget *entry;
+ char *txt;
- entry = ewl_widget_name_find("entry");
- txt = ewl_text_text_get(EWL_TEXT(entry));
+ entry = ewl_widget_name_find("entry");
+ txt = ewl_text_text_get(EWL_TEXT(entry));
- if (txt) {
- printf("%s\n", txt);
- free(txt);
- }
+ if (txt) {
+ printf("%s\n", txt);
+ free(txt);
+ }
}
static void
ete_cb_set(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry;
+ Ewl_Widget *entry;
- entry = ewl_widget_name_find("entry");
- ewl_text_text_set(EWL_TEXT(entry), txt);
+ entry = ewl_widget_name_find("entry");
+ ewl_text_text_set(EWL_TEXT(entry), txt);
}
static void
ete_cb_load(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- printf("I do nothing yet ...\n");
+ printf("I do nothing yet ...\n");
}
static void
ete_cb_clear(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *entry, *scroll;
+ Ewl_Widget *entry, *scroll;
- entry = ewl_widget_name_find("entry");
- ewl_text_clear(EWL_TEXT(entry));
+ entry = ewl_widget_name_find("entry");
+ ewl_text_clear(EWL_TEXT(entry));
- scroll = ewl_widget_name_find("scrollpane");
- ewl_widget_configure(scroll);
+ scroll = ewl_widget_name_find("scrollpane");
+ ewl_widget_configure(scroll);
}
diff --git a/src/bin/tests/text_format/ewl_text_format_test.c b/src/bin/tests/text_format/ewl_text_format_test.c
index 532668a..493ced6 100644
--- a/src/bin/tests/text_format/ewl_text_format_test.c
+++ b/src/bin/tests/text_format/ewl_text_format_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_text_fmt.h"
@@ -34,263 +34,263 @@ static int tf_apply_full_node_text(char *buf, int len);
static int tf_apply_partial_node_text(char *buf, int len);
static Ewl_Unit_Test text_fmt_unit_tests[] = {
- {"New Format", tf_new, NULL, -1, 0},
- {"New NULL Text", tf_new_null_text, NULL, -1, 1},
- {"Clear Format", tf_clear, NULL, -1, 0},
-
- {"Count empty", tf_count_empty, NULL, -1, 0},
- {"Count non-empty", tf_count_non_empty, NULL, -1, 0},
-
- {"Prepend to empty", tf_prepend_empty, NULL, -1, 0},
- {"Prepend to non-empty", tf_prepend_non_empty, NULL, -1, 0},
- {"Append to empty", tf_append_empty, NULL, -1, 0},
- {"Append to non-empty", tf_append_non_empty, NULL, -1, 0},
- {"Insert to empty", tf_insert_empty, NULL, -1, 0},
- {"Insert to non-empty", tf_insert_non_empty, NULL, -1, 0},
-
- {"Delete from empty list", tf_delete_empty, NULL, -1, 0},
- {"Delete from non-empty list", tf_delete_non_empty, NULL, -1, 0},
- {"Delete past end text", tf_delete_past_end, NULL, -1, 0},
- {"Delete all", tf_delete_all, NULL, -1, 0},
- {"Delete full node", tf_delete_full_node, NULL, -1, 0},
- {"Delete partial node", tf_delete_partial_node, NULL, -1, 0},
-
- /* gets */
- /* goto's */
-
- /* apply */
- {"Apply empty text", tf_apply_empty_text, NULL, -1, 0},
- {"Apply full text", tf_apply_full_text, NULL, -1, 0},
- {"Apply past end text", tf_apply_past_end_text, NULL, -1, 0},
- {"Apply full node text", tf_apply_full_node_text, NULL, -1, 0},
- {"Apply partial node text", tf_apply_partial_node_text, NULL, -1, 0},
-
- /* char_to_byte */
- /* byte_to_char */
-
- {NULL, NULL, NULL, -1, 0}
- };
+ {"New Format", tf_new, NULL, -1, 0},
+ {"New NULL Text", tf_new_null_text, NULL, -1, 1},
+ {"Clear Format", tf_clear, NULL, -1, 0},
+
+ {"Count empty", tf_count_empty, NULL, -1, 0},
+ {"Count non-empty", tf_count_non_empty, NULL, -1, 0},
+
+ {"Prepend to empty", tf_prepend_empty, NULL, -1, 0},
+ {"Prepend to non-empty", tf_prepend_non_empty, NULL, -1, 0},
+ {"Append to empty", tf_append_empty, NULL, -1, 0},
+ {"Append to non-empty", tf_append_non_empty, NULL, -1, 0},
+ {"Insert to empty", tf_insert_empty, NULL, -1, 0},
+ {"Insert to non-empty", tf_insert_non_empty, NULL, -1, 0},
+
+ {"Delete from empty list", tf_delete_empty, NULL, -1, 0},
+ {"Delete from non-empty list", tf_delete_non_empty, NULL, -1, 0},
+ {"Delete past end text", tf_delete_past_end, NULL, -1, 0},
+ {"Delete all", tf_delete_all, NULL, -1, 0},
+ {"Delete full node", tf_delete_full_node, NULL, -1, 0},
+ {"Delete partial node", tf_delete_partial_node, NULL, -1, 0},
+
+ /* gets */
+ /* goto's */
+
+ /* apply */
+ {"Apply empty text", tf_apply_empty_text, NULL, -1, 0},
+ {"Apply full text", tf_apply_full_text, NULL, -1, 0},
+ {"Apply past end text", tf_apply_past_end_text, NULL, -1, 0},
+ {"Apply full node text", tf_apply_full_node_text, NULL, -1, 0},
+ {"Apply partial node text", tf_apply_partial_node_text, NULL, -1, 0},
+
+ /* char_to_byte */
+ /* byte_to_char */
+
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Text Format";
- test->tip = "Defines unit tests for the text formatting nodes.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_UNIT;
- test->unit_tests = text_fmt_unit_tests;
+ test->name = "Text Format";
+ test->tip = "Defines unit tests for the text formatting nodes.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_UNIT;
+ test->unit_tests = text_fmt_unit_tests;
}
static int
tf_new(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_Text_Fmt *fmt;
-
- t = ewl_text_new();
- fmt = ewl_text_fmt_new(EWL_TEXT(t));
- if (!fmt)
- {
- LOG_FAILURE(buf, len, "_new returned NULL.");
- return 0;
- }
- ewl_widget_destroy(t);
- ewl_text_fmt_destroy(fmt);
- return 1;
+ Ewl_Widget *t;
+ Ewl_Text_Fmt *fmt;
+
+ t = ewl_text_new();
+ fmt = ewl_text_fmt_new(EWL_TEXT(t));
+ if (!fmt)
+ {
+ LOG_FAILURE(buf, len, "_new returned NULL.");
+ return 0;
+ }
+ ewl_widget_destroy(t);
+ ewl_text_fmt_destroy(fmt);
+ return 1;
}
static int
tf_new_null_text(char *buf, int len)
{
- Ewl_Text_Fmt *fmt;
-
- fmt = ewl_text_fmt_new(NULL);
- if (fmt)
- {
- LOG_FAILURE(buf, len, "_new returned fmt when Ewl_Text was NULL.");
- ewl_text_fmt_destroy(fmt);
- return 0;
- }
- return 1;
+ Ewl_Text_Fmt *fmt;
+
+ fmt = ewl_text_fmt_new(NULL);
+ if (fmt)
+ {
+ LOG_FAILURE(buf, len, "_new returned fmt when Ewl_Text was NULL.");
+ ewl_text_fmt_destroy(fmt);
+ return 0;
+ }
+ return 1;
}
static int
tf_clear(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_Text_Fmt *fmt;
- Ewl_Text_Context *tx;
-
- tx = ewl_text_context_new();
-
- t = ewl_text_new();
- fmt = ewl_text_fmt_new(EWL_TEXT(t));
- ewl_text_fmt_node_prepend(fmt, tx, 20, 20);
- ewl_text_fmt_node_prepend(fmt, tx, 30, 30);
-
- ewl_text_fmt_clear(fmt);
- if (ecore_dlist_count(fmt->nodes) != 0)
- {
- LOG_FAILURE(buf, len, "_clear left items in -> nodes.");
- return 0;
- }
- if ((fmt->current_node.char_idx != 0)
- || (fmt->current_node.byte_idx != 0))
- {
- LOG_FAILURE(buf, len, "_clear didn't reset current_node values.");
- return 0;
- }
- if ((fmt->length.char_len != 0)
- || (fmt->length.byte_len != 0))
- {
- LOG_FAILURE(buf, len, "_clear didn't reset length values.");
- return 0;
- }
-
- ewl_text_fmt_destroy(fmt);
- ewl_widget_destroy(t);
-
- return 1;
+ Ewl_Widget *t;
+ Ewl_Text_Fmt *fmt;
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_new();
+
+ t = ewl_text_new();
+ fmt = ewl_text_fmt_new(EWL_TEXT(t));
+ ewl_text_fmt_node_prepend(fmt, tx, 20, 20);
+ ewl_text_fmt_node_prepend(fmt, tx, 30, 30);
+
+ ewl_text_fmt_clear(fmt);
+ if (ecore_dlist_count(fmt->nodes) != 0)
+ {
+ LOG_FAILURE(buf, len, "_clear left items in -> nodes.");
+ return 0;
+ }
+ if ((fmt->current_node.char_idx != 0)
+ || (fmt->current_node.byte_idx != 0))
+ {
+ LOG_FAILURE(buf, len, "_clear didn't reset current_node values.");
+ return 0;
+ }
+ if ((fmt->length.char_len != 0)
+ || (fmt->length.byte_len != 0))
+ {
+ LOG_FAILURE(buf, len, "_clear didn't reset length values.");
+ return 0;
+ }
+
+ ewl_text_fmt_destroy(fmt);
+ ewl_widget_destroy(t);
+
+ return 1;
}
static int
tf_count_empty(char *buf, int len)
{
- Ewl_Widget *t;
- Ewl_Text_Fmt *fmt;
-
- t = ewl_text_new();
- fmt = ewl_text_fmt_new(EWL_TEXT(t));
-
- if (ewl_text_fmt_node_count_get(fmt) != 0)
- {
- LOG_FAILURE(buf, len, "_count returned non-zero on blank list.");
- return 0;
- }
- return 1;
+ Ewl_Widget *t;
+ Ewl_Text_Fmt *fmt;
+
+ t = ewl_text_new();
+ fmt = ewl_text_fmt_new(EWL_TEXT(t));
+
+ if (ewl_text_fmt_node_count_get(fmt) != 0)
+ {
+ LOG_FAILURE(buf, len, "_count returned non-zero on blank list.");
+ return 0;
+ }
+ return 1;
}
static int
tf_count_non_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_prepend_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_prepend_non_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_append_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_append_non_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_insert_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_insert_non_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_delete_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_delete_non_empty(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_delete_past_end(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_delete_all(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_delete_full_node(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_delete_partial_node(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_apply_empty_text(char *buf __UNUSED__, int len __UNUSED__)
{
- Ewl_Widget *t;
+ Ewl_Widget *t;
- t = ewl_text_new();
- ewl_text_color_apply(EWL_TEXT(t), 255, 0, 0, 255, 0);
+ t = ewl_text_new();
+ ewl_text_color_apply(EWL_TEXT(t), 255, 0, 0, 255, 0);
- return 1;
+ return 1;
}
static int
tf_apply_full_text(char *buf __UNUSED__, int len __UNUSED__)
{
- Ewl_Widget *t;
+ Ewl_Widget *t;
- t = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(t), "four");
- ewl_text_color_apply(EWL_TEXT(t), 255, 0, 0, 255, 4);
+ t = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(t), "four");
+ ewl_text_color_apply(EWL_TEXT(t), 255, 0, 0, 255, 4);
- return 1;
+ return 1;
}
static int
tf_apply_past_end_text(char *buf __UNUSED__, int len __UNUSED__)
{
- Ewl_Widget *t;
+ Ewl_Widget *t;
- t = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(t), "four");
- ewl_text_color_apply(EWL_TEXT(t), 255, 0, 0, 255, 5);
+ t = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(t), "four");
+ ewl_text_color_apply(EWL_TEXT(t), 255, 0, 0, 255, 5);
- return 1;
+ return 1;
}
static int
tf_apply_full_node_text(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
static int
tf_apply_partial_node_text(char *buf __UNUSED__, int len __UNUSED__)
{
- return 1;
+ return 1;
}
diff --git a/src/bin/tests/theme/ewl_theme_test.c b/src/bin/tests/theme/ewl_theme_test.c
index 1ad3c3f..aade1e7 100644
--- a/src/bin/tests/theme/ewl_theme_test.c
+++ b/src/bin/tests/theme/ewl_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_border.h"
@@ -34,365 +34,365 @@ static void cb_default_theme(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Theme";
- test->tip = "Shows the utilization of themes\n"
- "inside a EWL application.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_ADVANCED;
+ test->name = "Theme";
+ test->tip = "Shows the utilization of themes\n"
+ "inside a EWL application.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_ADVANCED;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *abutton, *dbutton;
- Ewl_Widget *box2, *vbox, *list, *misc;
- DIR *rep;
- struct dirent *file;
-
- default_theme = ewl_theme_path_get();
-
- box2 = ewl_hbox_new();
- ewl_container_child_append(box, box2);
- ewl_widget_show(box2);
-
- vbox = ewl_vbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_VFILL);
- ewl_container_child_append(EWL_CONTAINER(box2), vbox);
- ewl_widget_show(vbox);
-
- /* the theme list tree */
- list = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(list), "Theme name");
- ewl_container_child_append(EWL_CONTAINER(vbox), list);
- ewl_widget_show(list);
-
- rep = opendir(PACKAGE_DATA_DIR "/ewl/themes");
- while ((file = readdir(rep)))
- {
- char *name;
- int len;
-
- name = file->d_name;
- len = strlen(name);
-
- if ((len >= 4) && (!strcmp(name + len - 4, ".edj"))) {
- Ewl_Widget *w;
-
- w = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(w), name);
- ewl_object_fill_policy_set(EWL_OBJECT(w),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_callback_append(w, EWL_CALLBACK_CLICKED,
- cb_select_theme, strdup(name));
- ewl_container_child_append(EWL_CONTAINER(list), w);
- ewl_widget_show(w);
- }
- }
-
- list = ewl_hbox_new();
- ewl_object_fill_policy_set(EWL_OBJECT(list), EWL_FLAG_FILL_NONE);
- ewl_container_child_append(EWL_CONTAINER(vbox), list);
- ewl_widget_show(list);
-
- abutton = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(abutton), "Apply");
- ewl_container_child_append(EWL_CONTAINER(list), abutton);
- ewl_widget_show(abutton);
-
- dbutton = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(dbutton), "Default");
- ewl_container_child_append(EWL_CONTAINER(list), dbutton);
- ewl_widget_disable(dbutton);
- ewl_widget_show(dbutton);
-
- ewl_callback_append(abutton, EWL_CALLBACK_CLICKED, cb_apply_theme, dbutton);
- ewl_callback_append(dbutton, EWL_CALLBACK_CLICKED, cb_default_theme, NULL);
-
- vbox = ewl_border_new();
- ewl_border_label_set(EWL_BORDER(vbox), "Theme Visualization");
- ewl_container_child_append(EWL_CONTAINER(box2), vbox);
- ewl_widget_show(vbox);
-
- misc = widgets_build();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- return 1;
+ Ewl_Widget *abutton, *dbutton;
+ Ewl_Widget *box2, *vbox, *list, *misc;
+ DIR *rep;
+ struct dirent *file;
+
+ default_theme = ewl_theme_path_get();
+
+ box2 = ewl_hbox_new();
+ ewl_container_child_append(box, box2);
+ ewl_widget_show(box2);
+
+ vbox = ewl_vbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_VFILL);
+ ewl_container_child_append(EWL_CONTAINER(box2), vbox);
+ ewl_widget_show(vbox);
+
+ /* the theme list tree */
+ list = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(list), "Theme name");
+ ewl_container_child_append(EWL_CONTAINER(vbox), list);
+ ewl_widget_show(list);
+
+ rep = opendir(PACKAGE_DATA_DIR "/ewl/themes");
+ while ((file = readdir(rep)))
+ {
+ char *name;
+ int len;
+
+ name = file->d_name;
+ len = strlen(name);
+
+ if ((len >= 4) && (!strcmp(name + len - 4, ".edj"))) {
+ Ewl_Widget *w;
+
+ w = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(w), name);
+ ewl_object_fill_policy_set(EWL_OBJECT(w),
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_callback_append(w, EWL_CALLBACK_CLICKED,
+ cb_select_theme, strdup(name));
+ ewl_container_child_append(EWL_CONTAINER(list), w);
+ ewl_widget_show(w);
+ }
+ }
+
+ list = ewl_hbox_new();
+ ewl_object_fill_policy_set(EWL_OBJECT(list), EWL_FLAG_FILL_NONE);
+ ewl_container_child_append(EWL_CONTAINER(vbox), list);
+ ewl_widget_show(list);
+
+ abutton = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(abutton), "Apply");
+ ewl_container_child_append(EWL_CONTAINER(list), abutton);
+ ewl_widget_show(abutton);
+
+ dbutton = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(dbutton), "Default");
+ ewl_container_child_append(EWL_CONTAINER(list), dbutton);
+ ewl_widget_disable(dbutton);
+ ewl_widget_show(dbutton);
+
+ ewl_callback_append(abutton, EWL_CALLBACK_CLICKED, cb_apply_theme, dbutton);
+ ewl_callback_append(dbutton, EWL_CALLBACK_CLICKED, cb_default_theme, NULL);
+
+ vbox = ewl_border_new();
+ ewl_border_label_set(EWL_BORDER(vbox), "Theme Visualization");
+ ewl_container_child_append(EWL_CONTAINER(box2), vbox);
+ ewl_widget_show(vbox);
+
+ misc = widgets_build();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ return 1;
}
static void
cb_select_theme(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data)
{
- Ewl_Widget *notebook;
- char theme_filename[PATH_MAX];
+ Ewl_Widget *notebook;
+ char theme_filename[PATH_MAX];
- notebook = ewl_widget_name_find("notebook");
+ notebook = ewl_widget_name_find("notebook");
- snprintf(theme_filename, sizeof(theme_filename),
- PACKAGE_DATA_DIR "/ewl/themes/%s", (char *)data);
- ewl_theme_data_reset(notebook);
- ewl_theme_data_str_set(notebook, "/file", theme_filename);
+ snprintf(theme_filename, sizeof(theme_filename),
+ PACKAGE_DATA_DIR "/ewl/themes/%s", (char *)data);
+ ewl_theme_data_reset(notebook);
+ ewl_theme_data_str_set(notebook, "/file", theme_filename);
- if (selected_theme) free(selected_theme);
- selected_theme = strdup(theme_filename);
+ if (selected_theme) free(selected_theme);
+ selected_theme = strdup(theme_filename);
- ewl_widget_hide(notebook);
- ewl_widget_show(notebook);
+ ewl_widget_hide(notebook);
+ ewl_widget_show(notebook);
}
static void
cb_apply_theme(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data)
{
- Ewl_Widget *db = data;
+ Ewl_Widget *db = data;
- ewl_widget_enable(db);
- ewl_theme_theme_set(selected_theme);
+ ewl_widget_enable(db);
+ ewl_theme_theme_set(selected_theme);
}
static void
cb_default_theme(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *db = w;
+ Ewl_Widget *db = w;
- ewl_widget_disable(db);
- ewl_theme_theme_set(default_theme);
+ ewl_widget_disable(db);
+ ewl_theme_theme_set(default_theme);
}
static Ewl_Widget *
widgets_build(void)
{
- Ewl_Widget *misc, *item, *vbox, *notebook;
- int i;
- struct {
- char *name;
- char *image;
- } menus[] = {
- {"image", "dia-diagram.png"},
- {NULL, NULL},
- {"label", NULL}
- };
-
- notebook = ewl_notebook_new();
- ewl_widget_name_set(notebook, "notebook");
-
- /* buttons */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox, "Buttons");
- ewl_widget_show(vbox);
-
- misc = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(misc), "Normal button");
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_checkbutton_new();
- ewl_button_label_set(EWL_BUTTON(misc), "Check button");
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_radiobutton_new();
- ewl_button_label_set(EWL_BUTTON(misc), "Radio button");
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- /* numerical/text entries */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox,
- "Numerical & Text Entries");
- ewl_widget_show(vbox);
-
- misc = ewl_entry_new();
- ewl_text_text_set(EWL_TEXT(misc), "Normal entry");
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_password_new();
- ewl_text_text_set(EWL_TEXT(misc), "Password entry");
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_spinner_new();
- ewl_spinner_digits_set(EWL_SPINNER(misc), 0);
- ewl_range_minimum_value_set(EWL_RANGE(misc), 0);
- ewl_range_maximum_value_set(EWL_RANGE(misc), 1024);
- ewl_range_step_set(EWL_RANGE(misc), 1.0);
- ewl_range_value_set(EWL_RANGE(misc), 15.0);
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_hseeker_new();
- ewl_range_maximum_value_set(EWL_RANGE(misc), 10.0);
- ewl_range_step_set(EWL_RANGE(misc), 1.0);
- ewl_range_value_set(EWL_RANGE(misc), 15.0);
- ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- /* menus */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox, "Menus");
- ewl_widget_show(vbox);
-
- misc = ewl_menu_new();
- ewl_button_label_set(EWL_BUTTON(misc), "Menu");
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- for (i = 0; i < 3; i++)
- {
- item = ewl_menu_item_new();
- if (menus[i].name)
- ewl_button_label_set(EWL_BUTTON(item),
- menus[i].name);
-
- if (menus[i].image)
- ewl_button_image_set(EWL_BUTTON(item),
- menus[i].image, NULL);
-
- ewl_container_child_append(EWL_CONTAINER(misc), item);
- ewl_widget_show(item);
- }
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
+ Ewl_Widget *misc, *item, *vbox, *notebook;
+ int i;
+ struct {
+ char *name;
+ char *image;
+ } menus[] = {
+ {"image", "dia-diagram.png"},
+ {NULL, NULL},
+ {"label", NULL}
+ };
+
+ notebook = ewl_notebook_new();
+ ewl_widget_name_set(notebook, "notebook");
+
+ /* buttons */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox, "Buttons");
+ ewl_widget_show(vbox);
+
+ misc = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(misc), "Normal button");
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_checkbutton_new();
+ ewl_button_label_set(EWL_BUTTON(misc), "Check button");
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_radiobutton_new();
+ ewl_button_label_set(EWL_BUTTON(misc), "Radio button");
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ /* numerical/text entries */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox,
+ "Numerical & Text Entries");
+ ewl_widget_show(vbox);
+
+ misc = ewl_entry_new();
+ ewl_text_text_set(EWL_TEXT(misc), "Normal entry");
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_password_new();
+ ewl_text_text_set(EWL_TEXT(misc), "Password entry");
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_spinner_new();
+ ewl_spinner_digits_set(EWL_SPINNER(misc), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(misc), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(misc), 1024);
+ ewl_range_step_set(EWL_RANGE(misc), 1.0);
+ ewl_range_value_set(EWL_RANGE(misc), 15.0);
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_hseeker_new();
+ ewl_range_maximum_value_set(EWL_RANGE(misc), 10.0);
+ ewl_range_step_set(EWL_RANGE(misc), 1.0);
+ ewl_range_value_set(EWL_RANGE(misc), 15.0);
+ ewl_object_alignment_set(EWL_OBJECT(misc), EWL_FLAG_ALIGN_LEFT);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ /* menus */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox, "Menus");
+ ewl_widget_show(vbox);
+
+ misc = ewl_menu_new();
+ ewl_button_label_set(EWL_BUTTON(misc), "Menu");
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ for (i = 0; i < 3; i++)
+ {
+ item = ewl_menu_item_new();
+ if (menus[i].name)
+ ewl_button_label_set(EWL_BUTTON(item),
+ menus[i].name);
+
+ if (menus[i].image)
+ ewl_button_image_set(EWL_BUTTON(item),
+ menus[i].image, NULL);
+
+ ewl_container_child_append(EWL_CONTAINER(misc), item);
+ ewl_widget_show(item);
+ }
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
#if 0
XXX Port this to use the model/view system
- misc = ewl_combo_new("Combo entry");
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- for (i = 0; i < 3; i++)
- {
- item = ewl_menu_item_new();
- if (menus[i].name)
- ewl_button_label_set(EWL_BUTTON(item),
- menus[i].name);
-
- if (menus[i].image)
- ewl_button_image_set(EWL_BUTTON(item),
- menus[i].image, NULL);
-
- ewl_container_child_append(EWL_CONTAINER(misc), item);
- ewl_widget_show(item);
- }
-
- /* List/tree */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox,
- "List and Tree");
- ewl_widget_show(vbox);
-
- str = "List";
- misc = ewl_tree_new(1);
- ewl_tree_headers_set(EWL_TREE(misc), &str);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- str = "Row 1";
- item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, &str);
-
- str = "Row 2";
- item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, &str);
-
- str = "Row 3";
- item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, &str);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- str_col[0] = "Tree";
- str_col[1] = "Column";
- misc = ewl_tree_new(2);
- ewl_tree_headers_set(EWL_TREE(misc), str_col);
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- str_col[0] = "row1";
- str_col[1] = "label";
- item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, str_col);
-
- str_col[0] = "sub row";
- str_col[1] = "label";
- item = ewl_tree_text_row_add(EWL_TREE(misc), EWL_ROW(item), str_col);
-
- str_col[0] = "row2";
- str_col[1] = "label";
- item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, str_col);
-
- str_col[0] = "sub row";
- str_col[1] = "label";
- item = ewl_tree_text_row_add(EWL_TREE(misc), EWL_ROW(item), str_col);
+ misc = ewl_combo_new("Combo entry");
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ for (i = 0; i < 3; i++)
+ {
+ item = ewl_menu_item_new();
+ if (menus[i].name)
+ ewl_button_label_set(EWL_BUTTON(item),
+ menus[i].name);
+
+ if (menus[i].image)
+ ewl_button_image_set(EWL_BUTTON(item),
+ menus[i].image, NULL);
+
+ ewl_container_child_append(EWL_CONTAINER(misc), item);
+ ewl_widget_show(item);
+ }
+
+ /* List/tree */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox,
+ "List and Tree");
+ ewl_widget_show(vbox);
+
+ str = "List";
+ misc = ewl_tree_new(1);
+ ewl_tree_headers_set(EWL_TREE(misc), &str);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ str = "Row 1";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, &str);
+
+ str = "Row 2";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, &str);
+
+ str = "Row 3";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, &str);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ str_col[0] = "Tree";
+ str_col[1] = "Column";
+ misc = ewl_tree_new(2);
+ ewl_tree_headers_set(EWL_TREE(misc), str_col);
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ str_col[0] = "row1";
+ str_col[1] = "label";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, str_col);
+
+ str_col[0] = "sub row";
+ str_col[1] = "label";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), EWL_ROW(item), str_col);
+
+ str_col[0] = "row2";
+ str_col[1] = "label";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), NULL, str_col);
+
+ str_col[0] = "sub row";
+ str_col[1] = "label";
+ item = ewl_tree_text_row_add(EWL_TREE(misc), EWL_ROW(item), str_col);
#endif
- /* Misc */
- vbox = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
- ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox, "Misc");
- ewl_widget_show(vbox);
-
- misc = ewl_hpaned_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- item = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(item), "left");
- ewl_container_child_append(EWL_CONTAINER(misc), item);
- ewl_widget_show(item);
-
- item = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(item), "center");
- ewl_container_child_append(EWL_CONTAINER(misc), item);
- ewl_widget_show(item);
-
- item = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(item), "right");
- ewl_container_child_append(EWL_CONTAINER(misc), item);
- ewl_widget_show(item);
-
- misc = ewl_hseparator_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_widget_show(misc);
-
- misc = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(misc), "Tooltip");
- ewl_container_child_append(EWL_CONTAINER(vbox), misc);
- ewl_attach_tooltip_text_set(misc, "blah blah blah");
- ewl_widget_show(misc);
-
- return notebook;
+ /* Misc */
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(notebook), vbox);
+ ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), vbox, "Misc");
+ ewl_widget_show(vbox);
+
+ misc = ewl_hpaned_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ item = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(item), "left");
+ ewl_container_child_append(EWL_CONTAINER(misc), item);
+ ewl_widget_show(item);
+
+ item = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(item), "center");
+ ewl_container_child_append(EWL_CONTAINER(misc), item);
+ ewl_widget_show(item);
+
+ item = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(item), "right");
+ ewl_container_child_append(EWL_CONTAINER(misc), item);
+ ewl_widget_show(item);
+
+ misc = ewl_hseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_widget_show(misc);
+
+ misc = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(misc), "Tooltip");
+ ewl_container_child_append(EWL_CONTAINER(vbox), misc);
+ ewl_attach_tooltip_text_set(misc, "blah blah blah");
+ ewl_widget_show(misc);
+
+ return notebook;
}
diff --git a/src/bin/tests/toolbar/ewl_toolbar_test.c b/src/bin/tests/toolbar/ewl_toolbar_test.c
index f014058..8f9a338 100644
--- a/src/bin/tests/toolbar/ewl_toolbar_test.c
+++ b/src/bin/tests/toolbar/ewl_toolbar_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"
@@ -14,66 +14,66 @@ static void cb_click(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Toolbar";
- test->tip = "Defines a widget for displaying a toolbar";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Toolbar";
+ test->tip = "Defines a widget for displaying a toolbar";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *body, *o2, *o;
-
- body = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), body);
- ewl_widget_show(body);
-
- o2 = ewl_toolbar_new();
- ewl_container_child_append(EWL_CONTAINER(body), o2);
- ewl_object_alignment_set(EWL_OBJECT(o2), EWL_FLAG_ALIGN_CENTER);
- ewl_object_fill_policy_set(EWL_OBJECT(o2),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
- ewl_toolbar_icon_part_hide(EWL_TOOLBAR(o2), EWL_ICON_PART_LABEL);
- ewl_widget_show(o2);
-
- o = ewl_icon_simple_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_ARROW_LEFT);
- ewl_callback_append(EWL_WIDGET(o), EWL_CALLBACK_CLICKED, cb_click, o2);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_icon_simple_new();
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_ARROW_RIGHT);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_icon_simple_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_STOP);
- ewl_widget_show(o);
-
- o = ewl_icon_simple_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_HOME);
- ewl_widget_show(o);
-
- o = ewl_vseparator_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- o = ewl_hseeker_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *body, *o2, *o;
+
+ body = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(box), body);
+ ewl_widget_show(body);
+
+ o2 = ewl_toolbar_new();
+ ewl_container_child_append(EWL_CONTAINER(body), o2);
+ ewl_object_alignment_set(EWL_OBJECT(o2), EWL_FLAG_ALIGN_CENTER);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2),
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+ ewl_toolbar_icon_part_hide(EWL_TOOLBAR(o2), EWL_ICON_PART_LABEL);
+ ewl_widget_show(o2);
+
+ o = ewl_icon_simple_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_ARROW_LEFT);
+ ewl_callback_append(EWL_WIDGET(o), EWL_CALLBACK_CLICKED, cb_click, o2);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_simple_new();
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_ARROW_RIGHT);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_icon_simple_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_STOP);
+ ewl_widget_show(o);
+
+ o = ewl_icon_simple_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_HOME);
+ ewl_widget_show(o);
+
+ o = ewl_vseparator_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ o = ewl_hseeker_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_widget_show(o);
+
+ return 1;
}
void
cb_click(Ewl_Widget *w __UNUSED__, void *e __UNUSED__, void *data)
{
- ewl_toolbar_icon_part_hide(EWL_TOOLBAR(data), EWL_ICON_PART_NONE);
+ ewl_toolbar_icon_part_hide(EWL_TOOLBAR(data), EWL_ICON_PART_NONE);
}
diff --git a/src/bin/tests/tooltip/ewl_tooltip_test.c b/src/bin/tests/tooltip/ewl_tooltip_test.c
index 01b864d..c6009bf 100644
--- a/src/bin/tests/tooltip/ewl_tooltip_test.c
+++ b/src/bin/tests/tooltip/ewl_tooltip_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"
@@ -10,34 +10,34 @@ static int create_test(Ewl_Container *win);
void
test_info(Ewl_Test *test)
{
- test->name = "Tooltip";
- test->tip = "Defines a widget for displaying short\n"
- "messages after a delay.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_SIMPLE;
+ test->name = "Tooltip";
+ test->tip = "Defines a widget for displaying short\n"
+ "messages after a delay.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_SIMPLE;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *button;
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Hover on this button");
- ewl_container_child_append(EWL_CONTAINER(box), button);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
- ewl_attach_tooltip_text_set(button, "and see.");
- ewl_widget_show(button);
-
- button = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(button), "Hover on this button");
- ewl_container_child_append(EWL_CONTAINER(box), button);
- ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
- ewl_attach_tooltip_text_set(button, "and see more.");
- ewl_widget_show(button);
-
- return 1;
+ Ewl_Widget *button;
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Hover on this button");
+ ewl_container_child_append(EWL_CONTAINER(box), button);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
+ ewl_attach_tooltip_text_set(button, "and see.");
+ ewl_widget_show(button);
+
+ button = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(button), "Hover on this button");
+ ewl_container_child_append(EWL_CONTAINER(box), button);
+ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
+ ewl_attach_tooltip_text_set(button, "and see more.");
+ ewl_widget_show(button);
+
+ return 1;
}
diff --git a/src/bin/tests/tree/ewl_tree_test.c b/src/bin/tests/tree/ewl_tree_test.c
index 6c7f5ee..25fc7c5 100644
--- a/src/bin/tests/tree/ewl_tree_test.c
+++ b/src/bin/tests/tree/ewl_tree_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,31 +20,31 @@ typedef struct Tree_Test_Data Tree_Test_Data;
typedef struct Tree_Test_Row_Data Tree_Test_Row_Data;
struct Tree_Test_Row_Data
{
- char *image;
- char *text;
- Tree_Test_Data *subdata;
+ char *image;
+ char *text;
+ Tree_Test_Data *subdata;
- int expandable;
+ int expandable;
};
struct Tree_Test_Data
{
- unsigned int count;
- unsigned int row_count;
- Tree_Test_Row_Data **rows;
+ unsigned int count;
+ unsigned int row_count;
+ Tree_Test_Row_Data **rows;
};
static int create_test(Ewl_Container *win);
static void *tree_test_data_setup(void);
static Ewl_Widget *tree_test_cb_widget_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
static void *tree_test_cb_header_data_fetch(void *data, unsigned int column);
static Ewl_Widget *tree_test_cb_header_fetch(void *data, unsigned int column);
static void *tree_test_data_fetch(void *data, unsigned int row,
- unsigned int column);
+ unsigned int column);
static int tree_test_column_sortable(void *data, unsigned int column);
static void tree_test_data_sort(void *data, unsigned int column,
- Ewl_Sort_Direction sort);
+ Ewl_Sort_Direction sort);
static unsigned int tree_test_data_count_get(void *data);
static int tree_test_data_expandable_get(void *data, unsigned int row);
static void *tree_test_data_expansion_fetch(void *data, unsigned int row);
@@ -59,514 +59,514 @@ static void tree_cb_select_mode_change(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
{
- test->name = "Tree";
- test->tip = "Defines a widget for laying out other\n"
- "widgets in a tree or list like manner.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_CONTAINER;
+ test->name = "Tree";
+ test->tip = "Defines a widget for laying out other\n"
+ "widgets in a tree or list like manner.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_CONTAINER;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *tree, *o, *o2, *o3;
- Ewl_Model *model;
- Ewl_View *view;
- void *data;
-
- o2 = ewl_hbox_new();
- ewl_container_child_append(box, o2);
- ewl_object_fill_policy_set(EWL_OBJECT(o2),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- ewl_widget_show(o2);
-
- /* create our data */
- data = tree_test_data_setup();
-
- /* the tree will only use one model. We could use a model per
- * column, but a single model will work fine for this test */
- model = ewl_model_new();
- ewl_model_data_fetch_set(model, tree_test_data_fetch);
- ewl_model_data_header_fetch_set(model,
- tree_test_cb_header_data_fetch);
- ewl_model_data_sort_set(model, tree_test_data_sort);
- ewl_model_column_sortable_set(model, tree_test_column_sortable);
- ewl_model_data_count_set(model, tree_test_data_count_get);
- ewl_model_data_expandable_set(model, tree_test_data_expandable_get);
- ewl_model_expansion_data_fetch_set(model,
- tree_test_data_expansion_fetch);
-
- view = ewl_view_new();
- ewl_view_widget_fetch_set(view, tree_test_cb_widget_fetch);
- ewl_view_header_fetch_set(view, tree_test_cb_header_fetch);
-
- tree = ewl_tree_new();
- ewl_container_child_append(EWL_CONTAINER(box), tree);
- ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
- ewl_callback_append(tree, EWL_CALLBACK_VALUE_CHANGED,
- tree_cb_value_changed, NULL);
- ewl_mvc_data_set(EWL_MVC(tree), data);
- ewl_mvc_model_set(EWL_MVC(tree), model);
- ewl_mvc_view_set(EWL_MVC(tree), view);
- ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_MULTI);
- ewl_tree_column_count_set(EWL_TREE(tree), 3);
- ewl_tree_row_expand(EWL_TREE(tree), data, 2);
- ewl_widget_name_set(tree, "tree");
- ewl_widget_show(tree);
-
- o3 = ewl_vbox_new();
- ewl_container_child_append(EWL_CONTAINER(o2), o3);
- ewl_widget_show(o3);
-
- /* create the checkbuttons for the top box */
- o = ewl_checkbutton_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(o), "Scroll headers");
- ewl_container_child_append(EWL_CONTAINER(o3), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_scroll_headers, tree);
- ewl_widget_show(o);
-
- o = ewl_checkbutton_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
- ewl_button_label_set(EWL_BUTTON(o), "Hide headers");
- ewl_container_child_append(EWL_CONTAINER(o3), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_hide_headers, tree);
- ewl_widget_show(o);
-
- o = ewl_checkbutton_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_button_label_set(EWL_BUTTON(o), "Plain view");
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_plain_view, tree);
- ewl_widget_show(o);
-
- o = ewl_spinner_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_spinner_digits_set(EWL_SPINNER(o), 0);
- ewl_range_minimum_value_set(EWL_RANGE(o), 0);
- ewl_range_maximum_value_set(EWL_RANGE(o), 10000);
- ewl_range_value_set(EWL_RANGE(o), 5);
- ewl_range_step_set(EWL_RANGE(o), 1);
- ewl_widget_name_set(o, "rows_spinner");
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_button_label_set(EWL_BUTTON(o), "Set number of rows");
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_tree_cb_set_rows_clicked, NULL);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
- ewl_button_label_set(EWL_BUTTON(o), "Row select");
- ewl_container_child_append(EWL_CONTAINER(o2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- tree_cb_select_mode_change, NULL);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *tree, *o, *o2, *o3;
+ Ewl_Model *model;
+ Ewl_View *view;
+ void *data;
+
+ o2 = ewl_hbox_new();
+ ewl_container_child_append(box, o2);
+ ewl_object_fill_policy_set(EWL_OBJECT(o2),
+ EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
+ ewl_widget_show(o2);
+
+ /* create our data */
+ data = tree_test_data_setup();
+
+ /* the tree will only use one model. We could use a model per
+ * column, but a single model will work fine for this test */
+ model = ewl_model_new();
+ ewl_model_data_fetch_set(model, tree_test_data_fetch);
+ ewl_model_data_header_fetch_set(model,
+ tree_test_cb_header_data_fetch);
+ ewl_model_data_sort_set(model, tree_test_data_sort);
+ ewl_model_column_sortable_set(model, tree_test_column_sortable);
+ ewl_model_data_count_set(model, tree_test_data_count_get);
+ ewl_model_data_expandable_set(model, tree_test_data_expandable_get);
+ ewl_model_expansion_data_fetch_set(model,
+ tree_test_data_expansion_fetch);
+
+ view = ewl_view_new();
+ ewl_view_widget_fetch_set(view, tree_test_cb_widget_fetch);
+ ewl_view_header_fetch_set(view, tree_test_cb_header_fetch);
+
+ tree = ewl_tree_new();
+ ewl_container_child_append(EWL_CONTAINER(box), tree);
+ ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
+ ewl_callback_append(tree, EWL_CALLBACK_VALUE_CHANGED,
+ tree_cb_value_changed, NULL);
+ ewl_mvc_data_set(EWL_MVC(tree), data);
+ ewl_mvc_model_set(EWL_MVC(tree), model);
+ ewl_mvc_view_set(EWL_MVC(tree), view);
+ ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_MULTI);
+ ewl_tree_column_count_set(EWL_TREE(tree), 3);
+ ewl_tree_row_expand(EWL_TREE(tree), data, 2);
+ ewl_widget_name_set(tree, "tree");
+ ewl_widget_show(tree);
+
+ o3 = ewl_vbox_new();
+ ewl_container_child_append(EWL_CONTAINER(o2), o3);
+ ewl_widget_show(o3);
+
+ /* create the checkbuttons for the top box */
+ o = ewl_checkbutton_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(o), "Scroll headers");
+ ewl_container_child_append(EWL_CONTAINER(o3), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_scroll_headers, tree);
+ ewl_widget_show(o);
+
+ o = ewl_checkbutton_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
+ ewl_button_label_set(EWL_BUTTON(o), "Hide headers");
+ ewl_container_child_append(EWL_CONTAINER(o3), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_hide_headers, tree);
+ ewl_widget_show(o);
+
+ o = ewl_checkbutton_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_button_label_set(EWL_BUTTON(o), "Plain view");
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_plain_view, tree);
+ ewl_widget_show(o);
+
+ o = ewl_spinner_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_spinner_digits_set(EWL_SPINNER(o), 0);
+ ewl_range_minimum_value_set(EWL_RANGE(o), 0);
+ ewl_range_maximum_value_set(EWL_RANGE(o), 10000);
+ ewl_range_value_set(EWL_RANGE(o), 5);
+ ewl_range_step_set(EWL_RANGE(o), 1);
+ ewl_widget_name_set(o, "rows_spinner");
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_button_label_set(EWL_BUTTON(o), "Set number of rows");
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_tree_cb_set_rows_clicked, NULL);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
+ ewl_button_label_set(EWL_BUTTON(o), "Row select");
+ ewl_container_child_append(EWL_CONTAINER(o2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ tree_cb_select_mode_change, NULL);
+ ewl_widget_show(o);
+
+ return 1;
}
static void *
tree_test_data_setup(void)
{
- Tree_Test_Data *data;
- Tree_Test_Row_Data **dt;
-
- data = calloc(1, sizeof(Tree_Test_Data));
- dt = calloc(TREE_DATA_ELEMENTS, sizeof(Tree_Test_Row_Data *));
-
- dt[0] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[0]->text = strdup("The E logo");
- dt[0]->expandable = 0;
-
- dt[1] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[1]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/elicit.png");
- dt[1]->text = strdup("The Elicit image");
- dt[1]->expandable = 1;
-
- dt[1]->subdata = calloc(1, sizeof(Tree_Test_Data));
- dt[1]->subdata->count = 1;
- dt[1]->subdata->row_count = 1;
- dt[1]->subdata->rows = calloc(dt[1]->subdata->count, sizeof(Tree_Test_Row_Data *));
- dt[1]->subdata->rows[0] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[1]->subdata->rows[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[1]->subdata->rows[0]->text = strdup("The First Subrow");
-
- dt[2] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/entrance.png");
- dt[2]->text = strdup("The Entrance image");
- dt[2]->expandable = 1;
-
- dt[2]->subdata = calloc(1, sizeof(Tree_Test_Data));
- dt[2]->subdata->count = 6;
- dt[2]->subdata->row_count = 6;
- dt[2]->subdata->rows = calloc(dt[2]->subdata->count, sizeof(Tree_Test_Row_Data *));
- dt[2]->subdata->rows[0] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->subdata->rows[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[2]->subdata->rows[0]->text = strdup("Squee. 1.");
- dt[2]->subdata->rows[1] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->subdata->rows[1]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[2]->subdata->rows[1]->text = strdup("Splat. 2.");
- dt[2]->subdata->rows[2] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->subdata->rows[2]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[2]->subdata->rows[2]->text = strdup("Squee. 3.");
- dt[2]->subdata->rows[3] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->subdata->rows[3]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[2]->subdata->rows[3]->text = strdup("Splat. 4.");
- dt[2]->subdata->rows[4] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->subdata->rows[4]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[2]->subdata->rows[4]->text = strdup("Squee. 5.");
- dt[2]->subdata->rows[5] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[2]->subdata->rows[5]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
- dt[2]->subdata->rows[5]->text = strdup("Splat. 6.");
-
- dt[3] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[3]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/End.png");
- dt[3]->text = strdup("Zebra");
- dt[3]->expandable = 0;
-
- dt[4] = calloc(1, sizeof(Tree_Test_Row_Data));
- dt[4]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/banner-top.png");
- dt[4]->text = strdup("Ant");
- dt[4]->expandable = 0;
-
- data->rows = dt;
- data->count = TREE_DATA_ELEMENTS;
- data->row_count = TREE_DATA_ELEMENTS;
-
- return data;
+ Tree_Test_Data *data;
+ Tree_Test_Row_Data **dt;
+
+ data = calloc(1, sizeof(Tree_Test_Data));
+ dt = calloc(TREE_DATA_ELEMENTS, sizeof(Tree_Test_Row_Data *));
+
+ dt[0] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[0]->text = strdup("The E logo");
+ dt[0]->expandable = 0;
+
+ dt[1] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[1]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/elicit.png");
+ dt[1]->text = strdup("The Elicit image");
+ dt[1]->expandable = 1;
+
+ dt[1]->subdata = calloc(1, sizeof(Tree_Test_Data));
+ dt[1]->subdata->count = 1;
+ dt[1]->subdata->row_count = 1;
+ dt[1]->subdata->rows = calloc(dt[1]->subdata->count, sizeof(Tree_Test_Row_Data *));
+ dt[1]->subdata->rows[0] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[1]->subdata->rows[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[1]->subdata->rows[0]->text = strdup("The First Subrow");
+
+ dt[2] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/entrance.png");
+ dt[2]->text = strdup("The Entrance image");
+ dt[2]->expandable = 1;
+
+ dt[2]->subdata = calloc(1, sizeof(Tree_Test_Data));
+ dt[2]->subdata->count = 6;
+ dt[2]->subdata->row_count = 6;
+ dt[2]->subdata->rows = calloc(dt[2]->subdata->count, sizeof(Tree_Test_Row_Data *));
+ dt[2]->subdata->rows[0] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->subdata->rows[0]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[2]->subdata->rows[0]->text = strdup("Squee. 1.");
+ dt[2]->subdata->rows[1] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->subdata->rows[1]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[2]->subdata->rows[1]->text = strdup("Splat. 2.");
+ dt[2]->subdata->rows[2] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->subdata->rows[2]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[2]->subdata->rows[2]->text = strdup("Squee. 3.");
+ dt[2]->subdata->rows[3] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->subdata->rows[3]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[2]->subdata->rows[3]->text = strdup("Splat. 4.");
+ dt[2]->subdata->rows[4] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->subdata->rows[4]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[2]->subdata->rows[4]->text = strdup("Squee. 5.");
+ dt[2]->subdata->rows[5] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[2]->subdata->rows[5]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/e-logo.png");
+ dt[2]->subdata->rows[5]->text = strdup("Splat. 6.");
+
+ dt[3] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[3]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/End.png");
+ dt[3]->text = strdup("Zebra");
+ dt[3]->expandable = 0;
+
+ dt[4] = calloc(1, sizeof(Tree_Test_Row_Data));
+ dt[4]->image = strdup(PACKAGE_DATA_DIR"/ewl/images/banner-top.png");
+ dt[4]->text = strdup("Ant");
+ dt[4]->expandable = 0;
+
+ data->rows = dt;
+ data->count = TREE_DATA_ELEMENTS;
+ data->row_count = TREE_DATA_ELEMENTS;
+
+ return data;
}
static Ewl_Widget *
tree_test_cb_widget_fetch(void *data, unsigned int row __UNUSED__,
- unsigned int column)
+ unsigned int column)
{
- Ewl_Widget *w = NULL;
-
- switch (column) {
- case 0:
- w = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(w), data);
- break;
- case 1:
- w = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(w), data);
- break;
- case 2:
- {
- Tree_Test_Row_Data *d;
- 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);
- }
- break;
- }
- ewl_widget_show(w);
-
- return w;
+ Ewl_Widget *w = NULL;
+
+ switch (column) {
+ case 0:
+ w = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(w), data);
+ break;
+ case 1:
+ w = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(w), data);
+ break;
+ case 2:
+ {
+ Tree_Test_Row_Data *d;
+ 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);
+ }
+ break;
+ }
+ ewl_widget_show(w);
+
+ return w;
}
static void *
tree_test_cb_header_data_fetch(void *data __UNUSED__, unsigned int column)
{
- if (column == 0)
- return "Title";
+ if (column == 0)
+ return "Title";
- if (column == 1)
- return "Image";
+ if (column == 1)
+ return "Image";
- return "Button";
+ return "Button";
}
static Ewl_Widget *
tree_test_cb_header_fetch(void *data, unsigned int column __UNUSED__)
{
- Ewl_Widget *l;
+ Ewl_Widget *l;
- l = ewl_label_new();
- ewl_label_text_set(EWL_LABEL(l), data);
- ewl_widget_show(l);
+ l = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(l), data);
+ ewl_widget_show(l);
- return l;
+ return l;
}
static void *
tree_test_data_fetch(void *data, unsigned int row, unsigned int column)
{
- Tree_Test_Data *d;
- void *val = NULL;
+ Tree_Test_Data *d;
+ void *val = NULL;
- d = data;
+ d = data;
- /* NOTE: this is just for testing purposes, should not be needed in a
- * normal app */
- if (row >= d->row_count)
- {
- printf("Asking for too many rows %d (count == %d)\n",
- row, d->row_count);
- return NULL;
- }
+ /* NOTE: this is just for testing purposes, should not be needed in a
+ * normal app */
+ if (row >= d->row_count)
+ {
+ printf("Asking for too many rows %d (count == %d)\n",
+ row, d->row_count);
+ return NULL;
+ }
- if (column == 0)
- val = d->rows[row % d->count]->text;
+ if (column == 0)
+ val = d->rows[row % d->count]->text;
- else if (column == 1)
- val = d->rows[row % d->count]->image;
+ else if (column == 1)
+ val = d->rows[row % d->count]->image;
- else if (column == 2)
- val = d->rows[row % d->count];
+ else if (column == 2)
+ val = d->rows[row % d->count];
- else
- {
- /* NOTE: this is just for testing purposes, should not be
- * needed in a normal app */
- printf("Unknown column %d\n", column);
- }
+ else
+ {
+ /* NOTE: this is just for testing purposes, should not be
+ * needed in a normal app */
+ printf("Unknown column %d\n", column);
+ }
- return val;
+ return val;
}
static void
tree_test_data_sort(void *data, unsigned int column, Ewl_Sort_Direction sort)
{
- int i;
- Tree_Test_Data *d;
-
- /* just leave it if we're in sort none. */
- if (sort == EWL_SORT_DIRECTION_NONE)
- return;
-
- d = data;
-
- for (i = (d->count - 1); i >= 0; i--)
- {
- int j;
-
- for (j = 1; j <= i; j++)
- {
- char *a, *b;
-
- if (column == 0)
- {
- a = d->rows[j - 1]->text;
- b = d->rows[j]->text;
- }
- else
- {
- a = d->rows[j - 1]->image;
- b = d->rows[j]->image;
- }
-
- if (((sort == EWL_SORT_DIRECTION_ASCENDING)
- && strcmp(a, b) > 0)
- || ((sort == EWL_SORT_DIRECTION_DESCENDING)
- && strcmp(a, b) < 0))
- {
- char *temp;
-
- temp = d->rows[j - 1]->text;
- d->rows[j - 1]->text = d->rows[j]->text;
- d->rows[j]->text = temp;
-
- temp = d->rows[j - 1]->image;
- d->rows[j - 1]->image = d->rows[j]->image;
- d->rows[j]->image = temp;
- }
- }
- }
+ int i;
+ Tree_Test_Data *d;
+
+ /* just leave it if we're in sort none. */
+ if (sort == EWL_SORT_DIRECTION_NONE)
+ return;
+
+ d = data;
+
+ for (i = (d->count - 1); i >= 0; i--)
+ {
+ int j;
+
+ for (j = 1; j <= i; j++)
+ {
+ char *a, *b;
+
+ if (column == 0)
+ {
+ a = d->rows[j - 1]->text;
+ b = d->rows[j]->text;
+ }
+ else
+ {
+ a = d->rows[j - 1]->image;
+ b = d->rows[j]->image;
+ }
+
+ if (((sort == EWL_SORT_DIRECTION_ASCENDING)
+ && strcmp(a, b) > 0)
+ || ((sort == EWL_SORT_DIRECTION_DESCENDING)
+ && strcmp(a, b) < 0))
+ {
+ char *temp;
+
+ temp = d->rows[j - 1]->text;
+ d->rows[j - 1]->text = d->rows[j]->text;
+ d->rows[j]->text = temp;
+
+ temp = d->rows[j - 1]->image;
+ d->rows[j - 1]->image = d->rows[j]->image;
+ d->rows[j]->image = temp;
+ }
+ }
+ }
}
static int
tree_test_column_sortable(void *data __UNUSED__, unsigned int column)
{
- return ((column == 0) || (column == 1));
+ return ((column == 0) || (column == 1));
}
static unsigned int
tree_test_data_count_get(void *data)
{
- Tree_Test_Data *d;
+ Tree_Test_Data *d;
- d = data;
+ d = data;
- return d->row_count;
+ return d->row_count;
}
static int
tree_test_data_expandable_get(void *data, unsigned int row)
{
- Tree_Test_Data *d;
- int ret = FALSE;
+ Tree_Test_Data *d;
+ int ret = FALSE;
- d = data;
+ d = data;
- if (d && d->rows[row % d->count])
- ret = d->rows[row % d->count]->expandable;
+ if (d && d->rows[row % d->count])
+ ret = d->rows[row % d->count]->expandable;
- return ret;
+ return ret;
}
static void *
tree_test_data_expansion_fetch(void *data, unsigned int parent)
{
- Tree_Test_Data *d;
+ Tree_Test_Data *d;
- d = data;
+ d = data;
- return d->rows[parent]->subdata;
+ return d->rows[parent]->subdata;
}
static void
ewl_tree_cb_scroll_headers(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Tree *tree;
- Ewl_Widget *view;
+ Ewl_Tree *tree;
+ Ewl_Widget *view;
- tree = data;
- view = ewl_tree_content_widget_get(tree);
+ tree = data;
+ view = ewl_tree_content_widget_get(tree);
- if (EWL_TREE_VIEW_SCROLLED_IS(view))
- ewl_tree_view_scrolled_scroll_headers_set(EWL_TREE_VIEW(view),
- ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)));
+ if (EWL_TREE_VIEW_SCROLLED_IS(view))
+ ewl_tree_view_scrolled_scroll_headers_set(EWL_TREE_VIEW(view),
+ ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)));
}
static void
ewl_tree_cb_hide_headers(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data)
{
- Ewl_Tree *tree;
- int vis = TRUE;
+ Ewl_Tree *tree;
+ int vis = TRUE;
- tree = data;
+ tree = data;
- if (ewl_tree_headers_visible_get(tree))
- vis = FALSE;
+ if (ewl_tree_headers_visible_get(tree))
+ vis = FALSE;
- ewl_tree_headers_visible_set(tree, vis);
+ ewl_tree_headers_visible_set(tree, vis);
}
static void
ewl_tree_cb_plain_view(Ewl_Widget *w, void *ev __UNUSED__, void *data)
{
- Ewl_Tree *tree;
- const Ewl_View *view;
+ Ewl_Tree *tree;
+ const Ewl_View *view;
- tree = data;
- if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
- view = ewl_tree_view_plain_get();
- else
- view = ewl_tree_view_scrolled_get();
+ tree = data;
+ if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)))
+ view = ewl_tree_view_plain_get();
+ else
+ view = ewl_tree_view_scrolled_get();
- ewl_tree_content_view_set(EWL_TREE(tree), view);
+ ewl_tree_content_view_set(EWL_TREE(tree), view);
}
static void
ewl_tree_cb_set_rows_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *spinner, *tree;
- Tree_Test_Data *d;
+ Ewl_Widget *spinner, *tree;
+ Tree_Test_Data *d;
- tree = ewl_widget_name_find("tree");
- spinner = ewl_widget_name_find("rows_spinner");
+ tree = ewl_widget_name_find("tree");
+ spinner = ewl_widget_name_find("rows_spinner");
- d = ewl_mvc_data_get(EWL_MVC(tree));
- d->row_count = ewl_range_value_get(EWL_RANGE(spinner));
+ d = ewl_mvc_data_get(EWL_MVC(tree));
+ d->row_count = ewl_range_value_get(EWL_RANGE(spinner));
- ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
+ ewl_mvc_dirty_set(EWL_MVC(tree), TRUE);
}
static void
tree_cb_value_changed(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ecore_List *selected;
- Ewl_Selection *sel;
-
- printf("Selected:\n");
- 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)
- {
- char *val;
- unsigned int col;
- Ewl_Selection_Idx *idx;
-
- idx = EWL_SELECTION_IDX(sel);
- col = idx->column;
- if (col != 2)
- val = sel->model->fetch(sel->data, idx->row, col);
- else
- {
- Tree_Test_Row_Data *d;
- d = sel->model->fetch(sel->data, idx->row, col);
- val = d->text;
- }
-
- printf(" [%d,%d] %s\n", idx->row, idx->column, val);
- }
- else
- {
- Ewl_Selection_Range *idx;
- unsigned int i, k;
-
- idx = EWL_SELECTION_RANGE(sel);
- for (i = idx->start.row; i <= idx->end.row; i++)
- {
- for (k = idx->start.column; k <=
- idx->end.column; k++)
- {
- char *val;
-
- if (k != 3)
- val = sel->model->fetch(sel->data,
- i, k);
- else
- {
- Tree_Test_Row_Data *d;
- d = sel->model->fetch(sel->data,
- i, k);
- val = d->text;
- }
- printf(" [%d,%d] %s\n", i, k, val);
- }
- }
- }
- }
+ Ecore_List *selected;
+ Ewl_Selection *sel;
+
+ printf("Selected:\n");
+ 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)
+ {
+ char *val;
+ unsigned int col;
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ col = idx->column;
+ if (col != 2)
+ val = sel->model->fetch(sel->data, idx->row, col);
+ else
+ {
+ Tree_Test_Row_Data *d;
+ d = sel->model->fetch(sel->data, idx->row, col);
+ val = d->text;
+ }
+
+ printf(" [%d,%d] %s\n", idx->row, idx->column, val);
+ }
+ else
+ {
+ Ewl_Selection_Range *idx;
+ unsigned int i, k;
+
+ idx = EWL_SELECTION_RANGE(sel);
+ for (i = idx->start.row; i <= idx->end.row; i++)
+ {
+ for (k = idx->start.column; k <=
+ idx->end.column; k++)
+ {
+ char *val;
+
+ if (k != 3)
+ val = sel->model->fetch(sel->data,
+ i, k);
+ else
+ {
+ Tree_Test_Row_Data *d;
+ d = sel->model->fetch(sel->data,
+ i, k);
+ val = d->text;
+ }
+ printf(" [%d,%d] %s\n", i, k, val);
+ }
+ }
+ }
+ }
}
static void
tree_cb_select_mode_change(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *tree;
-
- tree = ewl_widget_name_find("tree");
- if (!strcmp(ewl_button_label_get(EWL_BUTTON(w)), "Row select"))
- {
- ewl_button_label_set(EWL_BUTTON(w), "Cell select");
- ewl_tree_selection_type_set(EWL_TREE(tree),
- EWL_TREE_SELECTION_TYPE_ROW);
- }
- else
- {
- ewl_button_label_set(EWL_BUTTON(w), "Row select");
- ewl_tree_selection_type_set(EWL_TREE(tree),
- EWL_TREE_SELECTION_TYPE_CELL);
- }
+ Ewl_Widget *tree;
+
+ tree = ewl_widget_name_find("tree");
+ if (!strcmp(ewl_button_label_get(EWL_BUTTON(w)), "Row select"))
+ {
+ ewl_button_label_set(EWL_BUTTON(w), "Cell select");
+ ewl_tree_selection_type_set(EWL_TREE(tree),
+ EWL_TREE_SELECTION_TYPE_ROW);
+ }
+ else
+ {
+ ewl_button_label_set(EWL_BUTTON(w), "Row select");
+ ewl_tree_selection_type_set(EWL_TREE(tree),
+ EWL_TREE_SELECTION_TYPE_CELL);
+ }
}
diff --git a/src/bin/tests/widget/ewl_widget_test.c b/src/bin/tests/widget/ewl_widget_test.c
index 9c1d986..14e1a2d 100644
--- a/src/bin/tests/widget/ewl_widget_test.c
+++ b/src/bin/tests/widget/ewl_widget_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"
@@ -52,150 +52,150 @@ static int focusable_test_set_get(char *buf, int len);
static int focus_test_send_get(char *buf, int len);
static Ewl_Unit_Test widget_unit_tests[] = {
- {"EWL_WIDGET_IS", widget_is_test, NULL, -1, 0},
- {"Widget name set/get", name_test_set_get, NULL, -1, 0},
- {"Widget NULL name set/get", name_test_nul_set_get, NULL, -1, 0},
- {"Widget name find", name_find_test, NULL, -1, 0},
- {"Widget missing name find", name_find_missing_test, NULL, -1, 0},
- {"Widget find NULL", name_find_null_test, NULL, -1, 1},
- {"Widget type is test", widget_type_is_test, NULL, -1, 0},
- {"Widget type is without type test", widget_type_is_non_type_test, NULL, -1, 0},
- {"Widget enable", widget_enable_test, NULL, -1, 0},
- {"Widget disable", widget_disable_test, NULL, -1, 0},
- {"Widget colour set/get", widget_colour_test_set_get, NULL, -1, 0},
- {"Widget colour get NULL", widget_colour_test_get_null, NULL, -1, 0},
- {"widget appearance set/get", appearance_test_set_get, NULL, -1, 0},
- {"widget appearance path set/get", appearance_path_test_set_get, NULL, -1, 0},
- {"widget inheritance set/get", inheritance_test_set_get, NULL, -1, 0},
- {"widget internal set/get", internal_test_set_get, NULL, -1, 0},
- {"widget clipped set/get", clipped_test_set_get, NULL, -1, 0},
- {"widget data set/get", data_test_set_get, NULL, -1, 0},
- {"widget data set/remove", data_test_set_remove, NULL, -1, 0},
- {"widget_new", widget_new, NULL, -1, 0},
- {"widget_init state", init, NULL, -1, 0},
- {"widget_show state", show, NULL, -1, 0},
- {"widget_realize state", realize, NULL, -1, 0},
- {"widget realize unrealize state", realize_unrealize, NULL, -1, 0},
- {"widget_parent_set state", parent_set, NULL, -1, 0},
- {"widget parent set while shown state", parent_set_show, NULL, -1, 0},
- {"widget Reparent unrealized state", reparent_unrealized, NULL, -1, 0},
- {"widget reparent realized state", reparent_realized, NULL, -1, 0},
- {"widget realize then reveal state", realize_reveal, NULL, -1, 0},
- {"widget realize reveal obscure state", realize_reveal_obscure, NULL, -1, 0},
- {"widget realize reveal unrealize state", realize_reveal_unrealize, NULL, -1, 0},
- {"widget show realize unrealize state", show_realize_unrealize, NULL, -1, 0},
- {"widget focusable set/get", focusable_test_set_get, NULL, -1, 0},
- {"widget focus send/get", focus_test_send_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"EWL_WIDGET_IS", widget_is_test, NULL, -1, 0},
+ {"Widget name set/get", name_test_set_get, NULL, -1, 0},
+ {"Widget NULL name set/get", name_test_nul_set_get, NULL, -1, 0},
+ {"Widget name find", name_find_test, NULL, -1, 0},
+ {"Widget missing name find", name_find_missing_test, NULL, -1, 0},
+ {"Widget find NULL", name_find_null_test, NULL, -1, 1},
+ {"Widget type is test", widget_type_is_test, NULL, -1, 0},
+ {"Widget type is without type test", widget_type_is_non_type_test, NULL, -1, 0},
+ {"Widget enable", widget_enable_test, NULL, -1, 0},
+ {"Widget disable", widget_disable_test, NULL, -1, 0},
+ {"Widget colour set/get", widget_colour_test_set_get, NULL, -1, 0},
+ {"Widget colour get NULL", widget_colour_test_get_null, NULL, -1, 0},
+ {"widget appearance set/get", appearance_test_set_get, NULL, -1, 0},
+ {"widget appearance path set/get", appearance_path_test_set_get, NULL, -1, 0},
+ {"widget inheritance set/get", inheritance_test_set_get, NULL, -1, 0},
+ {"widget internal set/get", internal_test_set_get, NULL, -1, 0},
+ {"widget clipped set/get", clipped_test_set_get, NULL, -1, 0},
+ {"widget data set/get", data_test_set_get, NULL, -1, 0},
+ {"widget data set/remove", data_test_set_remove, NULL, -1, 0},
+ {"widget_new", widget_new, NULL, -1, 0},
+ {"widget_init state", init, NULL, -1, 0},
+ {"widget_show state", show, NULL, -1, 0},
+ {"widget_realize state", realize, NULL, -1, 0},
+ {"widget realize unrealize state", realize_unrealize, NULL, -1, 0},
+ {"widget_parent_set state", parent_set, NULL, -1, 0},
+ {"widget parent set while shown state", parent_set_show, NULL, -1, 0},
+ {"widget Reparent unrealized state", reparent_unrealized, NULL, -1, 0},
+ {"widget reparent realized state", reparent_realized, NULL, -1, 0},
+ {"widget realize then reveal state", realize_reveal, NULL, -1, 0},
+ {"widget realize reveal obscure state", realize_reveal_obscure, NULL, -1, 0},
+ {"widget realize reveal unrealize state", realize_reveal_unrealize, NULL, -1, 0},
+ {"widget show realize unrealize state", show_realize_unrealize, NULL, -1, 0},
+ {"widget focusable set/get", focusable_test_set_get, NULL, -1, 0},
+ {"widget focus send/get", focus_test_send_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Widget";
- test->tip = "The base widget type.";
- test->filename = __FILE__;
- test->type = EWL_TEST_TYPE_MISC;
- test->func = create_test;
- test->unit_tests = widget_unit_tests;
+ test->name = "Widget";
+ test->tip = "The base widget type.";
+ test->filename = __FILE__;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->func = create_test;
+ test->unit_tests = widget_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *vbox, *b2, *o;
-
- vbox = ewl_vbox_new();
- ewl_container_child_append(box, vbox);
- ewl_widget_show(vbox);
-
- b2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), b2);
- ewl_widget_show(b2);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "First button");
- ewl_widget_name_set(o, "first_widget");
- ewl_container_child_append(EWL_CONTAINER(b2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_first_click, NULL);
- ewl_widget_show(o);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Second button");
- ewl_widget_name_set(o, "second_widget");
- ewl_container_child_append(EWL_CONTAINER(b2), o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_second_click, NULL);
- ewl_widget_disable(o);
- ewl_widget_show(o);
-
- b2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), b2);
- ewl_widget_show(b2);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Toggle");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_toggle, NULL);
- ewl_container_child_append(EWL_CONTAINER(b2), o);
- ewl_widget_show(o);
-
- b2 = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(vbox), b2);
- ewl_widget_show(b2);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Change fullscreen setting");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED,
- ewl_widget_cb_toggle_fullscreen, NULL);
- ewl_container_child_append(EWL_CONTAINER(b2), o);
- ewl_widget_show(o);
-
- return 1;
+ Ewl_Widget *vbox, *b2, *o;
+
+ vbox = ewl_vbox_new();
+ ewl_container_child_append(box, vbox);
+ ewl_widget_show(vbox);
+
+ b2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), b2);
+ ewl_widget_show(b2);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "First button");
+ ewl_widget_name_set(o, "first_widget");
+ ewl_container_child_append(EWL_CONTAINER(b2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_first_click, NULL);
+ ewl_widget_show(o);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Second button");
+ ewl_widget_name_set(o, "second_widget");
+ ewl_container_child_append(EWL_CONTAINER(b2), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_second_click, NULL);
+ ewl_widget_disable(o);
+ ewl_widget_show(o);
+
+ b2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), b2);
+ ewl_widget_show(b2);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Toggle");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_toggle, NULL);
+ ewl_container_child_append(EWL_CONTAINER(b2), o);
+ ewl_widget_show(o);
+
+ b2 = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox), b2);
+ ewl_widget_show(b2);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Change fullscreen setting");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_widget_cb_toggle_fullscreen, NULL);
+ ewl_container_child_append(EWL_CONTAINER(b2), o);
+ ewl_widget_show(o);
+
+ return 1;
}
static void
ewl_widget_cb_toggle(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *o, *o2;
-
- o = ewl_widget_name_find("first_widget");
- o2 = ewl_widget_name_find("second_widget");
-
- if (DISABLED(o))
- {
- ewl_widget_enable(o);
- ewl_widget_disable(o2);
- }
- else
- {
- ewl_widget_disable(o);
- ewl_widget_enable(o2);
- }
+ Ewl_Widget *o, *o2;
+
+ o = ewl_widget_name_find("first_widget");
+ o2 = ewl_widget_name_find("second_widget");
+
+ if (DISABLED(o))
+ {
+ ewl_widget_enable(o);
+ ewl_widget_disable(o2);
+ }
+ else
+ {
+ ewl_widget_disable(o);
+ ewl_widget_enable(o2);
+ }
}
static void
ewl_widget_cb_first_click(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- printf("First clicked\n");
+ printf("First clicked\n");
}
static void
ewl_widget_cb_second_click(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- printf("Second clicked\n");
+ printf("Second clicked\n");
}
static void
ewl_widget_cb_toggle_fullscreen(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Embed *win;
+ Ewl_Embed *win;
- win = ewl_embed_widget_find(w);
- ewl_window_fullscreen_set(EWL_WINDOW(win),
- !ewl_window_fullscreen_get(EWL_WINDOW(win)));
+ win = ewl_embed_widget_find(w);
+ ewl_window_fullscreen_set(EWL_WINDOW(win),
+ !ewl_window_fullscreen_get(EWL_WINDOW(win)));
}
/*
@@ -204,19 +204,19 @@ ewl_widget_cb_toggle_fullscreen(Ewl_Widget *w, void *ev __UNUSED__,
static int
appearance_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
- ewl_widget_appearance_set(w, "my_appearance");
- if (strcmp("my_appearance", ewl_widget_appearance_get(w)))
- LOG_FAILURE(buf, len, "appearance_get doesn't match appearance_set");
- else
- ret = 1;
+ ewl_widget_appearance_set(w, "my_appearance");
+ if (strcmp("my_appearance", ewl_widget_appearance_get(w)))
+ LOG_FAILURE(buf, len, "appearance_get doesn't match appearance_set");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
/*
@@ -225,24 +225,24 @@ appearance_test_set_get(char *buf, int len)
static int
appearance_path_test_set_get(char *buf, int len)
{
- Ewl_Widget *box;
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *box;
+ Ewl_Widget *w;
+ int ret = 0;
- box = ewl_vbox_new();
+ box = ewl_vbox_new();
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
- ewl_container_child_append(EWL_CONTAINER(box), w);
+ ewl_container_child_append(EWL_CONTAINER(box), w);
- ewl_widget_appearance_set(w, "my_appearance");
- if (strcmp("/vbox/my_appearance", ewl_widget_appearance_path_get(w)))
- LOG_FAILURE(buf, len, "appearance_path_get doesn't match");
- else
- ret = 1;
+ ewl_widget_appearance_set(w, "my_appearance");
+ if (strcmp("/vbox/my_appearance", ewl_widget_appearance_path_get(w)))
+ LOG_FAILURE(buf, len, "appearance_path_get doesn't match");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
/*
@@ -252,26 +252,26 @@ appearance_path_test_set_get(char *buf, int len)
static int
inheritance_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
- const char *my_class = "myclass";
- const char *unknown_class = "unknownclass";
-
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
-
- ewl_widget_inherit(w, my_class);
- if (!ewl_widget_type_is(w, my_class))
- LOG_FAILURE(buf, len, "inheritance doesn't contain correct type");
- else {
- if (ewl_widget_type_is(w, unknown_class))
- LOG_FAILURE(buf, len,
- "inheritance contains incorrect type");
- else
- ret = 1;
- }
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+ const char *my_class = "myclass";
+ const char *unknown_class = "unknownclass";
+
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
+
+ ewl_widget_inherit(w, my_class);
+ if (!ewl_widget_type_is(w, my_class))
+ LOG_FAILURE(buf, len, "inheritance doesn't contain correct type");
+ else {
+ if (ewl_widget_type_is(w, unknown_class))
+ LOG_FAILURE(buf, len,
+ "inheritance contains incorrect type");
+ else
+ ret = 1;
+ }
+
+ return ret;
}
/*
@@ -281,28 +281,28 @@ inheritance_test_set_get(char *buf, int len)
static int
internal_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
-
- if (!ewl_widget_internal_is(w)) {
- ewl_widget_internal_set(w, TRUE);
- if (ewl_widget_internal_is(w)) {
- ewl_widget_internal_set(w, FALSE);
- if (ewl_widget_internal_is(w))
- LOG_FAILURE(buf, len, "internal flag not FALSE");
- else
- ret = 1;
- }
- else
- LOG_FAILURE(buf, len, "internal flag not TRUE");
- }
- else
- LOG_FAILURE(buf, len, "internal set after widget_init");
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
+
+ if (!ewl_widget_internal_is(w)) {
+ ewl_widget_internal_set(w, TRUE);
+ if (ewl_widget_internal_is(w)) {
+ ewl_widget_internal_set(w, FALSE);
+ if (ewl_widget_internal_is(w))
+ LOG_FAILURE(buf, len, "internal flag not FALSE");
+ else
+ ret = 1;
+ }
+ else
+ LOG_FAILURE(buf, len, "internal flag not TRUE");
+ }
+ else
+ LOG_FAILURE(buf, len, "internal set after widget_init");
+
+ return ret;
}
/*
@@ -312,28 +312,28 @@ internal_test_set_get(char *buf, int len)
static int
clipped_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
-
- if (ewl_widget_clipped_is(w)) {
- ewl_widget_clipped_set(w, FALSE);
- if (!ewl_widget_clipped_is(w)) {
- ewl_widget_clipped_set(w, TRUE);
- if (!ewl_widget_clipped_is(w))
- LOG_FAILURE(buf, len, "clipped flag not TRUE");
- else
- ret = 1;
- }
- else
- LOG_FAILURE(buf, len, "clipped flag not FALSE");
- }
- else
- LOG_FAILURE(buf, len, "clipped not set after widget_init");
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
+
+ if (ewl_widget_clipped_is(w)) {
+ ewl_widget_clipped_set(w, FALSE);
+ if (!ewl_widget_clipped_is(w)) {
+ ewl_widget_clipped_set(w, TRUE);
+ if (!ewl_widget_clipped_is(w))
+ LOG_FAILURE(buf, len, "clipped flag not TRUE");
+ else
+ ret = 1;
+ }
+ else
+ LOG_FAILURE(buf, len, "clipped flag not FALSE");
+ }
+ else
+ LOG_FAILURE(buf, len, "clipped not set after widget_init");
+
+ return ret;
}
/*
@@ -343,27 +343,27 @@ clipped_test_set_get(char *buf, int len)
static int
data_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
- char *key, *value, *found;
+ Ewl_Widget *w;
+ int ret = 0;
+ char *key, *value, *found;
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
- key = strdup("Data key");
- value = strdup("Data value");
+ key = strdup("Data key");
+ value = strdup("Data value");
- ewl_widget_data_set(w, key, value);
- found = ewl_widget_data_get(w, key);
+ ewl_widget_data_set(w, key, value);
+ found = ewl_widget_data_get(w, key);
- if (!found)
- LOG_FAILURE(buf, len, "could not find set data");
- else if (found != value)
- LOG_FAILURE(buf, len, "found value does not match set data");
- else
- ret = 1;
+ if (!found)
+ LOG_FAILURE(buf, len, "could not find set data");
+ else if (found != value)
+ LOG_FAILURE(buf, len, "found value does not match set data");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
/*
@@ -372,29 +372,29 @@ data_test_set_get(char *buf, int len)
static int
data_test_set_remove(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
- char *key, *value, *found;
+ Ewl_Widget *w;
+ int ret = 0;
+ char *key, *value, *found;
- w = calloc(1, sizeof(Ewl_Widget));
- ewl_widget_init(w);
+ w = calloc(1, sizeof(Ewl_Widget));
+ ewl_widget_init(w);
- key = strdup("Data key");
- value = strdup("Data value");
+ key = strdup("Data key");
+ value = strdup("Data value");
- ewl_widget_data_set(w, key, value);
- found = ewl_widget_data_del(w, key);
+ ewl_widget_data_set(w, key, value);
+ found = ewl_widget_data_del(w, key);
- if (!found)
- LOG_FAILURE(buf, len, "could not find set data");
- else if (found != value)
- LOG_FAILURE(buf, len, "removed value does not match set data");
- else if (ewl_widget_data_get(w, key))
- LOG_FAILURE(buf, len, "data value present after remove");
- else
- ret = 1;
+ if (!found)
+ LOG_FAILURE(buf, len, "could not find set data");
+ else if (found != value)
+ LOG_FAILURE(buf, len, "removed value does not match set data");
+ else if (ewl_widget_data_get(w, key))
+ LOG_FAILURE(buf, len, "data value present after remove");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
/*
@@ -403,19 +403,19 @@ data_test_set_remove(char *buf, int len)
static int
widget_new(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- if (!w)
- LOG_FAILURE(buf, len, "Failed to create widget");
- else
- {
- ewl_widget_destroy(w);
- ret = 1;
- }
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ if (!w)
+ LOG_FAILURE(buf, len, "Failed to create widget");
+ else
+ {
+ ewl_widget_destroy(w);
+ ret = 1;
+ }
+
+ return ret;
}
/*
@@ -425,22 +425,22 @@ widget_new(char *buf, int len)
static int
init(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- if (VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget VISIBLE after _init");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after _init");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after _init");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
-
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ if (VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget VISIBLE after _init");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after _init");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after _init");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+
+ return ret;
}
/*
@@ -449,23 +449,23 @@ init(char *buf, int len)
static int
show(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_show(w);
-
- if (!VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget !VISIBLE after show");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after show");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after show");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_show(w);
+
+ if (!VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget !VISIBLE after show");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after show");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after show");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -474,48 +474,48 @@ show(char *buf, int len)
static int
realize(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_realize(w);
- if (VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget VISIBLE after realize");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED without window");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after realize");
- else
- {
- Ewl_Widget *win;
-
- /*
- * Create a window and add the child to allow the realize to
- * succeed. This will be using the buffer engine.
- */
- win = ewl_window_new();
- ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
-
- ewl_container_child_append(EWL_CONTAINER(win), w);
- ewl_widget_realize(w);
-
- if (VISIBLE(win))
- LOG_FAILURE(buf, len, "Window VISIBLE after realize");
- else if (!REALIZED(win))
- LOG_FAILURE(buf, len, "Window !REALIZED after realize");
- else if (!REALIZED(w))
- LOG_FAILURE(buf, len, "Widget !REALIZED after realize");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after realize");
- else if (REVEALED(win))
- LOG_FAILURE(buf, len, "Window REVEALED after realize");
- else
- ret = 1;
-
- ewl_widget_destroy(win);
- }
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_realize(w);
+ if (VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget VISIBLE after realize");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED without window");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after realize");
+ else
+ {
+ Ewl_Widget *win;
+
+ /*
+ * Create a window and add the child to allow the realize to
+ * succeed. This will be using the buffer engine.
+ */
+ win = ewl_window_new();
+ ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
+
+ ewl_container_child_append(EWL_CONTAINER(win), w);
+ ewl_widget_realize(w);
+
+ if (VISIBLE(win))
+ LOG_FAILURE(buf, len, "Window VISIBLE after realize");
+ else if (!REALIZED(win))
+ LOG_FAILURE(buf, len, "Window !REALIZED after realize");
+ else if (!REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget !REALIZED after realize");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after realize");
+ else if (REVEALED(win))
+ LOG_FAILURE(buf, len, "Window REVEALED after realize");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(win);
+ }
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -524,26 +524,26 @@ realize(char *buf, int len)
static int
realize_unrealize(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_realize(w);
- ewl_widget_unrealize(w);
-
- if (VISIBLE(w))
- /* This is the currently expected behavior, but we're discussing
- * if this is really the behavior we want */
- LOG_FAILURE(buf, len, "Widget VISIBLE after realize/unrealize");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after realize/unrealize");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after realize/unrealize");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_realize(w);
+ ewl_widget_unrealize(w);
+
+ if (VISIBLE(w))
+ /* This is the currently expected behavior, but we're discussing
+ * if this is really the behavior we want */
+ LOG_FAILURE(buf, len, "Widget VISIBLE after realize/unrealize");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after realize/unrealize");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after realize/unrealize");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -552,30 +552,30 @@ realize_unrealize(char *buf, int len)
static int
parent_set(char *buf, int len)
{
- Ewl_Widget *w, *b;
- int ret = 0;
-
- b = ewl_box_new();
- ewl_widget_show(b);
-
- w = ewl_widget_new();
- ewl_widget_parent_set(w, b);
- if (!w->parent)
- LOG_FAILURE(buf, len, "Widget parent NULL after parent set");
- else if (ewl_widget_parent_get(w) != b)
- LOG_FAILURE(buf, len, "Widget parent wrong after parent set");
- else if (VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget VISIBLE after parent set");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after parent set");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after parent set");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- ewl_widget_destroy(b);
- return ret;
+ Ewl_Widget *w, *b;
+ int ret = 0;
+
+ b = ewl_box_new();
+ ewl_widget_show(b);
+
+ w = ewl_widget_new();
+ ewl_widget_parent_set(w, b);
+ if (!w->parent)
+ LOG_FAILURE(buf, len, "Widget parent NULL after parent set");
+ else if (ewl_widget_parent_get(w) != b)
+ LOG_FAILURE(buf, len, "Widget parent wrong after parent set");
+ else if (VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget VISIBLE after parent set");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after parent set");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after parent set");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ ewl_widget_destroy(b);
+ return ret;
}
/*
@@ -584,33 +584,33 @@ parent_set(char *buf, int len)
static int
parent_set_show(char *buf, int len)
{
- Ewl_Widget *w, *b;
- int ret = 0;
-
- b = ewl_box_new();
- ewl_widget_show(b);
-
- w = ewl_widget_new();
- ewl_widget_show(w);
- ewl_widget_parent_set(w, b);
-
- if (!w->parent)
- LOG_FAILURE(buf, len, "Parent NULL after parent_set");
- else if (!VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget !VISIBLE after parent_set");
- else if (REALIZED(w))
- /* The widget has not been realized yet as that happens in the
- * idle loop, so this should test that it is still not realized
- * after changing parents. */
- LOG_FAILURE(buf, len, "Widget REALIZED after parent_set");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after parent_set");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- ewl_widget_destroy(b);
- return ret;
+ Ewl_Widget *w, *b;
+ int ret = 0;
+
+ b = ewl_box_new();
+ ewl_widget_show(b);
+
+ w = ewl_widget_new();
+ ewl_widget_show(w);
+ ewl_widget_parent_set(w, b);
+
+ if (!w->parent)
+ LOG_FAILURE(buf, len, "Parent NULL after parent_set");
+ else if (!VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget !VISIBLE after parent_set");
+ else if (REALIZED(w))
+ /* The widget has not been realized yet as that happens in the
+ * idle loop, so this should test that it is still not realized
+ * after changing parents. */
+ LOG_FAILURE(buf, len, "Widget REALIZED after parent_set");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after parent_set");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ ewl_widget_destroy(b);
+ return ret;
}
/*
@@ -620,254 +620,254 @@ parent_set_show(char *buf, int len)
static int
reparent_unrealized(char *buf, int len)
{
- Ewl_Widget *w, *b1, *b2;
- int ret = 0;
-
- b1 = ewl_box_new();
- ewl_widget_show(b1);
-
- b2 = ewl_box_new();
- ewl_widget_show(b2);
-
- w = ewl_widget_new();
- ewl_widget_parent_set(w, b1);
- ewl_widget_parent_set(w, b2);
-
- if (!w->parent)
- LOG_FAILURE(buf, len, "Widget parent NULL after reparent");
- else if (w->parent != b2)
- LOG_FAILURE(buf, len, "Widget parent != b2 after reparent");
- else if (VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget VISIBLE after reparent");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after reparent");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after reparent");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- ewl_widget_destroy(b1);
- ewl_widget_destroy(b2);
- return ret;
+ Ewl_Widget *w, *b1, *b2;
+ int ret = 0;
+
+ b1 = ewl_box_new();
+ ewl_widget_show(b1);
+
+ b2 = ewl_box_new();
+ ewl_widget_show(b2);
+
+ w = ewl_widget_new();
+ ewl_widget_parent_set(w, b1);
+ ewl_widget_parent_set(w, b2);
+
+ if (!w->parent)
+ LOG_FAILURE(buf, len, "Widget parent NULL after reparent");
+ else if (w->parent != b2)
+ LOG_FAILURE(buf, len, "Widget parent != b2 after reparent");
+ else if (VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget VISIBLE after reparent");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after reparent");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after reparent");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ ewl_widget_destroy(b1);
+ ewl_widget_destroy(b2);
+ return ret;
}
static int
reparent_realized(char *buf, int len)
{
- Ewl_Widget *w, *b1, *b2;
- int ret = 0;
-
- b1 = ewl_box_new();
- ewl_widget_show(b1);
-
- b2 = ewl_box_new();
- ewl_widget_show(b2);
-
- w = ewl_widget_new();
- ewl_widget_show(w);
- ewl_widget_parent_set(w, b1);
- ewl_widget_parent_set(w, b2);
-
- if (!w->parent)
- LOG_FAILURE(buf, len, "Widget parent NULL after reparent");
- else if (w->parent != b2)
- LOG_FAILURE(buf, len, "Widget parent != b2 after reparent");
- else if (!VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget !VISIBLE after reparent");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after reparent");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after reparent");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- ewl_widget_destroy(b1);
- ewl_widget_destroy(b2);
-
- return ret;
+ Ewl_Widget *w, *b1, *b2;
+ int ret = 0;
+
+ b1 = ewl_box_new();
+ ewl_widget_show(b1);
+
+ b2 = ewl_box_new();
+ ewl_widget_show(b2);
+
+ w = ewl_widget_new();
+ ewl_widget_show(w);
+ ewl_widget_parent_set(w, b1);
+ ewl_widget_parent_set(w, b2);
+
+ if (!w->parent)
+ LOG_FAILURE(buf, len, "Widget parent NULL after reparent");
+ else if (w->parent != b2)
+ LOG_FAILURE(buf, len, "Widget parent != b2 after reparent");
+ else if (!VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget !VISIBLE after reparent");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after reparent");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after reparent");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ ewl_widget_destroy(b1);
+ ewl_widget_destroy(b2);
+
+ return ret;
}
static int
realize_reveal(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_realize(w);
- ewl_widget_reveal(w);
-
- if (VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget VISIBLE after realize/reveal");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after realize/reveal");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after realize/reveal");
- else
- {
- Ewl_Widget *win;
-
- /*
- * Create a window and add the child to allow the realize to
- * succeed. This will be using the buffer engine.
- */
- win = ewl_window_new();
- ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
-
- ewl_container_child_append(EWL_CONTAINER(win), w);
- ewl_widget_realize(w);
- ewl_widget_reveal(w);
-
- if (VISIBLE(win))
- LOG_FAILURE(buf, len,
- "Window VISIBLE after realize/reveal");
- else if (!REALIZED(win))
- LOG_FAILURE(buf, len,
- "Window !REALIZED after realize/reveal");
- else if (!REALIZED(w))
- LOG_FAILURE(buf, len,
- "Widget !REALIZED after realize/reveal");
- else if (!REVEALED(w))
- LOG_FAILURE(buf, len,
- "Widget !REVEALED after realize/reveal");
- else if (REVEALED(win))
- LOG_FAILURE(buf, len,
- "Window REVEALED after realize/reveal");
- else
- ret = 1;
-
- ewl_widget_destroy(win);
- }
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_realize(w);
+ ewl_widget_reveal(w);
+
+ if (VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget VISIBLE after realize/reveal");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after realize/reveal");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after realize/reveal");
+ else
+ {
+ Ewl_Widget *win;
+
+ /*
+ * Create a window and add the child to allow the realize to
+ * succeed. This will be using the buffer engine.
+ */
+ win = ewl_window_new();
+ ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
+
+ ewl_container_child_append(EWL_CONTAINER(win), w);
+ ewl_widget_realize(w);
+ ewl_widget_reveal(w);
+
+ if (VISIBLE(win))
+ LOG_FAILURE(buf, len,
+ "Window VISIBLE after realize/reveal");
+ else if (!REALIZED(win))
+ LOG_FAILURE(buf, len,
+ "Window !REALIZED after realize/reveal");
+ else if (!REALIZED(w))
+ LOG_FAILURE(buf, len,
+ "Widget !REALIZED after realize/reveal");
+ else if (!REVEALED(w))
+ LOG_FAILURE(buf, len,
+ "Widget !REVEALED after realize/reveal");
+ else if (REVEALED(win))
+ LOG_FAILURE(buf, len,
+ "Window REVEALED after realize/reveal");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(win);
+ }
+
+ ewl_widget_destroy(w);
+ return ret;
}
static int
realize_reveal_obscure(char *buf, int len)
{
- Ewl_Widget *w;
- Ewl_Widget *win;
- int ret = 0;
-
- w = ewl_widget_new();
-
- /*
- * Create a window and add the child to allow the realize to
- * succeed. This will be using the buffer engine.
- */
- win = ewl_window_new();
- ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
-
- ewl_container_child_append(EWL_CONTAINER(win), w);
- ewl_widget_realize(w);
- ewl_widget_reveal(w);
- ewl_widget_obscure(w);
-
- if (VISIBLE(win))
- LOG_FAILURE(buf, len,
- "Window VISIBLE after realize/reveal/obscure");
- else if (!REALIZED(win))
- LOG_FAILURE(buf, len,
- "Window !REALIZED after realize/reveal/obscure");
- else if (!REALIZED(w))
- LOG_FAILURE(buf, len,
- "Widget !REALIZED after realize/reveal/obscure");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len,
- "Widget REVEALED after realize/reveal/obscure");
- else if (REVEALED(win))
- LOG_FAILURE(buf, len,
- "Window REVEALED after realize/reveal/obscure");
- else if (REVEALED(win))
- LOG_FAILURE(buf, len,
- "Window REVEALED after realize/reveal/obscure");
- else
- ret = 1;
-
- ewl_widget_destroy(win);
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ Ewl_Widget *win;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ /*
+ * Create a window and add the child to allow the realize to
+ * succeed. This will be using the buffer engine.
+ */
+ win = ewl_window_new();
+ ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
+
+ ewl_container_child_append(EWL_CONTAINER(win), w);
+ ewl_widget_realize(w);
+ ewl_widget_reveal(w);
+ ewl_widget_obscure(w);
+
+ if (VISIBLE(win))
+ LOG_FAILURE(buf, len,
+ "Window VISIBLE after realize/reveal/obscure");
+ else if (!REALIZED(win))
+ LOG_FAILURE(buf, len,
+ "Window !REALIZED after realize/reveal/obscure");
+ else if (!REALIZED(w))
+ LOG_FAILURE(buf, len,
+ "Widget !REALIZED after realize/reveal/obscure");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len,
+ "Widget REVEALED after realize/reveal/obscure");
+ else if (REVEALED(win))
+ LOG_FAILURE(buf, len,
+ "Window REVEALED after realize/reveal/obscure");
+ else if (REVEALED(win))
+ LOG_FAILURE(buf, len,
+ "Window REVEALED after realize/reveal/obscure");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(win);
+ ewl_widget_destroy(w);
+ return ret;
}
static int
realize_reveal_unrealize(char *buf, int len)
{
- Ewl_Widget *w;
- Ewl_Widget *win;
- int ret = 0;
-
- w = ewl_widget_new();
-
- /*
- * Create a window and add the child to allow the realize to
- * succeed. This will be using the buffer engine.
- */
- win = ewl_window_new();
- ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
-
- ewl_container_child_append(EWL_CONTAINER(win), w);
- ewl_widget_realize(w);
- ewl_widget_reveal(w);
- ewl_widget_unrealize(w);
-
- if (VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget VISIBLE after realize/reveal/unrealize");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after realize/reveal/unrealize");
- else if (!REALIZED(win))
- LOG_FAILURE(buf, len, "Window !REALIZED after realize/reveal/unrealize");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after realize/reveal/unrealize");
- else if (REVEALED(win))
- LOG_FAILURE(buf, len, "Window REVEALED after realize/reveal/unrealize");
- else
- ret = 1;
-
- ewl_widget_destroy(win);
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ Ewl_Widget *win;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ /*
+ * Create a window and add the child to allow the realize to
+ * succeed. This will be using the buffer engine.
+ */
+ win = ewl_window_new();
+ ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
+
+ ewl_container_child_append(EWL_CONTAINER(win), w);
+ ewl_widget_realize(w);
+ ewl_widget_reveal(w);
+ ewl_widget_unrealize(w);
+
+ if (VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget VISIBLE after realize/reveal/unrealize");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after realize/reveal/unrealize");
+ else if (!REALIZED(win))
+ LOG_FAILURE(buf, len, "Window !REALIZED after realize/reveal/unrealize");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after realize/reveal/unrealize");
+ else if (REVEALED(win))
+ LOG_FAILURE(buf, len, "Window REVEALED after realize/reveal/unrealize");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(win);
+ ewl_widget_destroy(w);
+ return ret;
}
static int
show_realize_unrealize(char *buf, int len)
{
- Ewl_Widget *w;
- Ewl_Widget *win;
- int ret = 0;
-
- w = ewl_widget_new();
-
- /*
- * Create a window and add the child to allow the realize to
- * succeed. This will be using the buffer engine.
- */
- win = ewl_window_new();
- ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
-
- ewl_container_child_append(EWL_CONTAINER(win), w);
- ewl_widget_show(w);
- ewl_widget_realize(w);
- ewl_widget_unrealize(w);
-
- if (!VISIBLE(w))
- LOG_FAILURE(buf, len, "Widget not VISIBLE after show/realize/unrealize");
- else if (REALIZED(w))
- LOG_FAILURE(buf, len, "Widget REALIZED after show/realize/unrealize");
- else if (!REALIZED(win))
- LOG_FAILURE(buf, len, "Window !REALIZED after show/realize/unrealize");
- else if (REVEALED(w))
- LOG_FAILURE(buf, len, "Widget REVEALED after show/realize/unrealize");
- else if (REVEALED(win))
- LOG_FAILURE(buf, len, "Window REVEALED after show/realize/unrealize");
- else
- ret = 1;
-
- ewl_widget_destroy(win);
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ Ewl_Widget *win;
+ int ret = 0;
+
+ w = ewl_widget_new();
+
+ /*
+ * Create a window and add the child to allow the realize to
+ * succeed. This will be using the buffer engine.
+ */
+ win = ewl_window_new();
+ ewl_embed_engine_name_set(EWL_EMBED(win), "evas_buffer");
+
+ ewl_container_child_append(EWL_CONTAINER(win), w);
+ ewl_widget_show(w);
+ ewl_widget_realize(w);
+ ewl_widget_unrealize(w);
+
+ if (!VISIBLE(w))
+ LOG_FAILURE(buf, len, "Widget not VISIBLE after show/realize/unrealize");
+ else if (REALIZED(w))
+ LOG_FAILURE(buf, len, "Widget REALIZED after show/realize/unrealize");
+ else if (!REALIZED(win))
+ LOG_FAILURE(buf, len, "Window !REALIZED after show/realize/unrealize");
+ else if (REVEALED(w))
+ LOG_FAILURE(buf, len, "Widget REVEALED after show/realize/unrealize");
+ else if (REVEALED(win))
+ LOG_FAILURE(buf, len, "Window REVEALED after show/realize/unrealize");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(win);
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -876,17 +876,17 @@ show_realize_unrealize(char *buf, int len)
static int
widget_is_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- if (!EWL_WIDGET_IS(w))
- LOG_FAILURE(buf, len, "Widget is not Widget type");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ if (!EWL_WIDGET_IS(w))
+ LOG_FAILURE(buf, len, "Widget is not Widget type");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -895,20 +895,20 @@ widget_is_test(char *buf, int len)
static int
name_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
- const char *name;
-
- w = ewl_widget_new();
- ewl_widget_name_set(w, "test widget");
- name = ewl_widget_name_get(w);
- if (strcmp("test widget", name))
- LOG_FAILURE(buf, len, "Returned name '%s' not 'test widget'", name);
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+ const char *name;
+
+ w = ewl_widget_new();
+ ewl_widget_name_set(w, "test widget");
+ name = ewl_widget_name_get(w);
+ if (strcmp("test widget", name))
+ LOG_FAILURE(buf, len, "Returned name '%s' not 'test widget'", name);
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -917,19 +917,19 @@ name_test_set_get(char *buf, int len)
static int
name_test_nul_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_name_set(w, "test name");
- ewl_widget_name_set(w, NULL);
- if (NULL != ewl_widget_name_get(w))
- LOG_FAILURE(buf, len, "Widget name not NULL");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_name_set(w, "test name");
+ ewl_widget_name_set(w, NULL);
+ if (NULL != ewl_widget_name_get(w))
+ LOG_FAILURE(buf, len, "Widget name not NULL");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -938,19 +938,19 @@ name_test_nul_set_get(char *buf, int len)
static int
name_find_test(char *buf, int len)
{
- Ewl_Widget *w1, *w2;
- int ret = 0;
-
- w1 = ewl_widget_new();
- ewl_widget_name_set(w1, "test widget");
- w2 = ewl_widget_name_find("test widget");
- if (w1 != w2)
- LOG_FAILURE(buf, len, "widget found not equal to widget set");
- else
- ret = 1;
-
- ewl_widget_destroy(w1);
- return ret;
+ Ewl_Widget *w1, *w2;
+ int ret = 0;
+
+ w1 = ewl_widget_new();
+ ewl_widget_name_set(w1, "test widget");
+ w2 = ewl_widget_name_find("test widget");
+ if (w1 != w2)
+ LOG_FAILURE(buf, len, "widget found not equal to widget set");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w1);
+ return ret;
}
/*
@@ -959,16 +959,16 @@ name_find_test(char *buf, int len)
static int
name_find_missing_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_name_find("Missing widget name");
- if (w != NULL)
- LOG_FAILURE(buf, len, "Found widget when we shouldn't have");
- else
- ret = 1;
+ w = ewl_widget_name_find("Missing widget name");
+ if (w != NULL)
+ LOG_FAILURE(buf, len, "Found widget when we shouldn't have");
+ else
+ ret = 1;
- return ret;
+ return ret;
}
/*
@@ -977,15 +977,15 @@ name_find_missing_test(char *buf, int len)
static int
name_find_null_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_name_find(NULL);
- if (w != NULL)
- LOG_FAILURE(buf, len, "Found widget when searching for NULL");
- else
- ret = 1;
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_name_find(NULL);
+ if (w != NULL)
+ LOG_FAILURE(buf, len, "Found widget when searching for NULL");
+ else
+ ret = 1;
+ return ret;
}
/*
@@ -994,18 +994,18 @@ name_find_null_test(char *buf, int len)
static int
widget_type_is_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_inherit(w, "my type");
- if (!ewl_widget_type_is(w, "my type"))
- LOG_FAILURE(buf, len, "Failed to match 'my type' on widget");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_inherit(w, "my type");
+ if (!ewl_widget_type_is(w, "my type"))
+ LOG_FAILURE(buf, len, "Failed to match 'my type' on widget");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -1014,17 +1014,17 @@ widget_type_is_test(char *buf, int len)
static int
widget_type_is_non_type_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- if (ewl_widget_type_is(w, "my missing type"))
- LOG_FAILURE(buf, len, "Matchined 'my missing type' on widget without type set");
- else
- ret = 1;
+ w = ewl_widget_new();
+ if (ewl_widget_type_is(w, "my missing type"))
+ LOG_FAILURE(buf, len, "Matchined 'my missing type' on widget without type set");
+ else
+ ret = 1;
- ewl_widget_destroy(w);
- return ret;
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -1033,20 +1033,20 @@ widget_type_is_non_type_test(char *buf, int len)
static int
widget_enable_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_widget_disable(w);
- ewl_widget_enable(w);
+ w = ewl_widget_new();
+ ewl_widget_disable(w);
+ ewl_widget_enable(w);
- if (DISABLED(w))
- LOG_FAILURE(buf, len, "Widget DISABLED after calling enable");
- else
- ret = 1;
+ if (DISABLED(w))
+ LOG_FAILURE(buf, len, "Widget DISABLED after calling enable");
+ else
+ ret = 1;
- ewl_widget_destroy(w);
- return ret;
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -1055,18 +1055,18 @@ widget_enable_test(char *buf, int len)
static int
widget_disable_test(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
-
- w = ewl_widget_new();
- ewl_widget_disable(w);
- if (!DISABLED(w))
- LOG_FAILURE(buf, len, "Widget not disabled aftering calling disable");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_disable(w);
+ if (!DISABLED(w))
+ LOG_FAILURE(buf, len, "Widget not disabled aftering calling disable");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -1075,26 +1075,26 @@ widget_disable_test(char *buf, int len)
static int
widget_colour_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
- unsigned int r = 0, g = 0, b = 0, a = 0;
-
- w = ewl_widget_new();
- ewl_widget_color_set(w, 248, 148, 48, 255);
- ewl_widget_color_get(w, &r, &g, &b, &a);
- if (r != 248)
- LOG_FAILURE(buf, len, "Red colour not retrieved correctly");
- else if (g != 148)
- LOG_FAILURE(buf, len, "Green colour not retrived correctly");
- else if (b != 48)
- LOG_FAILURE(buf, len, "Blue colour not retrived correctly");
- else if (a != 255)
- LOG_FAILURE(buf, len, "Alpha colour not retrieved correctly");
- else
- ret = 1;
-
- ewl_widget_destroy(w);
- return ret;
+ Ewl_Widget *w;
+ int ret = 0;
+ unsigned int r = 0, g = 0, b = 0, a = 0;
+
+ w = ewl_widget_new();
+ ewl_widget_color_set(w, 248, 148, 48, 255);
+ ewl_widget_color_get(w, &r, &g, &b, &a);
+ if (r != 248)
+ LOG_FAILURE(buf, len, "Red colour not retrieved correctly");
+ else if (g != 148)
+ LOG_FAILURE(buf, len, "Green colour not retrived correctly");
+ else if (b != 48)
+ LOG_FAILURE(buf, len, "Blue colour not retrived correctly");
+ else if (a != 255)
+ LOG_FAILURE(buf, len, "Alpha colour not retrieved correctly");
+ else
+ ret = 1;
+
+ ewl_widget_destroy(w);
+ return ret;
}
/*
@@ -1104,11 +1104,11 @@ widget_colour_test_set_get(char *buf, int len)
static int
widget_colour_test_get_null(char *buf __UNUSED__, int len __UNUSED__)
{
- Ewl_Widget *w;
+ Ewl_Widget *w;
- w = ewl_widget_new();
- ewl_widget_color_get(w, NULL, NULL, NULL, NULL);
- return 1;
+ w = ewl_widget_new();
+ ewl_widget_color_get(w, NULL, NULL, NULL, NULL);
+ return 1;
}
/*
@@ -1118,30 +1118,30 @@ widget_colour_test_get_null(char *buf __UNUSED__, int len __UNUSED__)
static int
focusable_test_set_get(char *buf, int len)
{
- Ewl_Widget *w;
- unsigned int focusable;
- int ret = 0;
-
- w = ewl_widget_new();
- focusable = ewl_widget_focusable_get(w);
- if (focusable) {
- ewl_widget_focusable_set(w, FALSE);
- focusable = ewl_widget_focusable_get(w);
- if (!focusable) {
- ewl_widget_focusable_set(w, TRUE);
- focusable = ewl_widget_focusable_get(w);
- if (focusable)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "focusable set to FALSE");
- }
- else
- LOG_FAILURE(buf, len, "focusable set to TRUE");
- }
- else
- LOG_FAILURE(buf, len, "default focusable set to FALSE");
-
- return ret;
+ Ewl_Widget *w;
+ unsigned int focusable;
+ int ret = 0;
+
+ w = ewl_widget_new();
+ focusable = ewl_widget_focusable_get(w);
+ if (focusable) {
+ ewl_widget_focusable_set(w, FALSE);
+ focusable = ewl_widget_focusable_get(w);
+ if (!focusable) {
+ ewl_widget_focusable_set(w, TRUE);
+ focusable = ewl_widget_focusable_get(w);
+ if (focusable)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "focusable set to FALSE");
+ }
+ else
+ LOG_FAILURE(buf, len, "focusable set to TRUE");
+ }
+ else
+ LOG_FAILURE(buf, len, "default focusable set to FALSE");
+
+ return ret;
}
/*
@@ -1150,26 +1150,26 @@ focusable_test_set_get(char *buf, int len)
static int
focus_test_send_get(char *buf, int len)
{
- Ewl_Widget *w;
- int ret = 0;
+ Ewl_Widget *w;
+ int ret = 0;
- w = ewl_widget_new();
- ewl_widget_focus_send(w);
+ w = ewl_widget_new();
+ ewl_widget_focus_send(w);
- if (ewl_widget_focused_get() == w)
- LOG_FAILURE(buf, len, "focused with no embed");
- else {
- Ewl_Widget *embed;
+ if (ewl_widget_focused_get() == w)
+ LOG_FAILURE(buf, len, "focused with no embed");
+ else {
+ Ewl_Widget *embed;
- embed = ewl_embed_new();
- ewl_container_child_append(EWL_CONTAINER(embed), w);
- ewl_widget_focus_send(w);
+ embed = ewl_embed_new();
+ ewl_container_child_append(EWL_CONTAINER(embed), w);
+ ewl_widget_focus_send(w);
- if (ewl_widget_focused_get() == w)
- ret = 1;
- else
- LOG_FAILURE(buf, len, "widget not focused");
- }
+ if (ewl_widget_focused_get() == w)
+ ret = 1;
+ else
+ LOG_FAILURE(buf, len, "widget not focused");
+ }
- return ret;
+ return ret;
}
diff --git a/src/bin/tests/window/ewl_window_test.c b/src/bin/tests/window/ewl_window_test.c
index 3a13857..fcc54c1 100644
--- a/src/bin/tests/window/ewl_window_test.c
+++ b/src/bin/tests/window/ewl_window_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_window.h"
@@ -33,79 +33,79 @@ static int override_set_get(char *buf, int len);
*/
static Ewl_Unit_Test window_unit_tests[] = {
- {"title set/get", title_set_get, NULL, -1, 0},
- {"name set/get", name_set_get, NULL, -1, 0},
- {"class set/get", class_set_get, NULL, -1, 0},
- {"borderless set/get", borderless_set_get, NULL, -1, 0},
- {"dialog set/get", dialog_set_get, NULL, -1, 0},
- {"fullscreen set/get", fullscreen_set_get, NULL, -1, 0},
- {"skip_taskbar set/get", skip_taskbar_set_get, NULL, -1, 0},
- {"skip_pager set/get", skip_pager_set_get, NULL, -1, 0},
- {"urgent set/get", urgent_set_get, NULL, -1, 0},
- {"modal set/get", modal_set_get, NULL, -1, 0},
- {"keyboard_grab set/get", keyboard_grab_set_get, NULL, -1, 0},
- {"pointer_grab set/get", pointer_grab_set_get, NULL, -1, 0},
- {"override set/get", override_set_get, NULL, -1, 0},
- {NULL, NULL, NULL, -1, 0}
- };
+ {"title set/get", title_set_get, NULL, -1, 0},
+ {"name set/get", name_set_get, NULL, -1, 0},
+ {"class set/get", class_set_get, NULL, -1, 0},
+ {"borderless set/get", borderless_set_get, NULL, -1, 0},
+ {"dialog set/get", dialog_set_get, NULL, -1, 0},
+ {"fullscreen set/get", fullscreen_set_get, NULL, -1, 0},
+ {"skip_taskbar set/get", skip_taskbar_set_get, NULL, -1, 0},
+ {"skip_pager set/get", skip_pager_set_get, NULL, -1, 0},
+ {"urgent set/get", urgent_set_get, NULL, -1, 0},
+ {"modal set/get", modal_set_get, NULL, -1, 0},
+ {"keyboard_grab set/get", keyboard_grab_set_get, NULL, -1, 0},
+ {"pointer_grab set/get", pointer_grab_set_get, NULL, -1, 0},
+ {"override set/get", override_set_get, NULL, -1, 0},
+ {NULL, NULL, NULL, -1, 0}
+ };
void
test_info(Ewl_Test *test)
{
- test->name = "Window";
- test->tip = "The window system.";
- test->filename = __FILE__;
- test->func = create_test;
- test->type = EWL_TEST_TYPE_MISC;
- test->unit_tests = window_unit_tests;
+ test->name = "Window";
+ test->tip = "The window system.";
+ test->filename = __FILE__;
+ test->func = create_test;
+ test->type = EWL_TEST_TYPE_MISC;
+ test->unit_tests = window_unit_tests;
}
static int
create_test(Ewl_Container *box)
{
- Ewl_Widget *o;
+ Ewl_Widget *o;
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Launch window");
- ewl_container_child_append(box, o);
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, run_window, NULL);
- ewl_widget_show(o);
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Launch window");
+ ewl_container_child_append(box, o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, run_window, NULL);
+ ewl_widget_show(o);
- return 1;
+ return 1;
}
static void
run_window(Ewl_Widget *w, void *ev, void *data)
{
- Ewl_Widget *win, *b, *o;
-
- win = ewl_window_new();
- ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, del_window_cb, NULL);
- ewl_window_borderless_set(EWL_WINDOW(win), TRUE);
- ewl_widget_show(win);
-
- b = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(win), b);
- ewl_widget_show(b);
-
- o = ewl_button_new();
- ewl_button_label_set(EWL_BUTTON(o), "Flip borderless");
- ewl_callback_append(o, EWL_CALLBACK_CLICKED, flip_border_cb, win);
- ewl_container_child_append(EWL_CONTAINER(b), o);
- ewl_widget_show(o);
+ Ewl_Widget *win, *b, *o;
+
+ win = ewl_window_new();
+ ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, del_window_cb, NULL);
+ ewl_window_borderless_set(EWL_WINDOW(win), TRUE);
+ ewl_widget_show(win);
+
+ b = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(win), b);
+ ewl_widget_show(b);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Flip borderless");
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED, flip_border_cb, win);
+ ewl_container_child_append(EWL_CONTAINER(b), o);
+ ewl_widget_show(o);
}
static void
del_window_cb(Ewl_Widget *w, void *ev, void *data)
{
- ewl_widget_destroy(w);
+ ewl_widget_destroy(w);
}
static void
flip_border_cb(Ewl_Widget *w, void *ev, void *data)
{
- ewl_window_borderless_set(EWL_WINDOW(data),
- !ewl_window_borderless_get(EWL_WINDOW(data)));
+ ewl_window_borderless_set(EWL_WINDOW(data),
+ !ewl_window_borderless_get(EWL_WINDOW(data)));
}
/*
@@ -114,34 +114,34 @@ flip_border_cb(Ewl_Widget *w, void *ev, void *data)
static int
title_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- const char *title;
- int ret = 0;
-
- win = ewl_window_new();
- title = ewl_window_title_get(EWL_WINDOW(win));
-
- if (title)
- snprintf(buf, len, "default title set to '%s'", title);
- else {
- ewl_window_title_set(EWL_WINDOW(win), "A title");
- title = ewl_window_title_get(EWL_WINDOW(win));
-
- if (strcmp(title, "A title"))
- snprintf(buf, len, "incorrect title set");
- else {
- ewl_window_title_set(EWL_WINDOW(win), "");
- title = ewl_window_title_get(EWL_WINDOW(win));
- if (title)
- snprintf(buf, len, "non-empty title set");
- else
- ret = 1;
- }
- }
-
- ewl_widget_destroy(win);
-
- return ret;
+ Ewl_Widget *win;
+ const char *title;
+ int ret = 0;
+
+ win = ewl_window_new();
+ title = ewl_window_title_get(EWL_WINDOW(win));
+
+ if (title)
+ snprintf(buf, len, "default title set to '%s'", title);
+ else {
+ ewl_window_title_set(EWL_WINDOW(win), "A title");
+ title = ewl_window_title_get(EWL_WINDOW(win));
+
+ if (strcmp(title, "A title"))
+ snprintf(buf, len, "incorrect title set");
+ else {
+ ewl_window_title_set(EWL_WINDOW(win), "");
+ title = ewl_window_title_get(EWL_WINDOW(win));
+ if (title)
+ snprintf(buf, len, "non-empty title set");
+ else
+ ret = 1;
+ }
+ }
+
+ ewl_widget_destroy(win);
+
+ return ret;
}
/*
@@ -150,34 +150,34 @@ title_set_get(char *buf, int len)
static int
name_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- const char *name;
- int ret = 0;
-
- win = ewl_window_new();
- name = ewl_window_name_get(EWL_WINDOW(win));
-
- if (name)
- snprintf(buf, len, "default name set to '%s'", name);
- else {
- ewl_window_name_set(EWL_WINDOW(win), "A name");
- name = ewl_window_name_get(EWL_WINDOW(win));
-
- if (strcmp(name, "A name"))
- snprintf(buf, len, "incorrect name set");
- else {
- ewl_window_name_set(EWL_WINDOW(win), "");
- name = ewl_window_name_get(EWL_WINDOW(win));
- if (name)
- snprintf(buf, len, "non-empty name set");
- else
- ret = 1;
- }
- }
-
- ewl_widget_destroy(win);
-
- return ret;
+ Ewl_Widget *win;
+ const char *name;
+ int ret = 0;
+
+ win = ewl_window_new();
+ name = ewl_window_name_get(EWL_WINDOW(win));
+
+ if (name)
+ snprintf(buf, len, "default name set to '%s'", name);
+ else {
+ ewl_window_name_set(EWL_WINDOW(win), "A name");
+ name = ewl_window_name_get(EWL_WINDOW(win));
+
+ if (strcmp(name, "A name"))
+ snprintf(buf, len, "incorrect name set");
+ else {
+ ewl_window_name_set(EWL_WINDOW(win), "");
+ name = ewl_window_name_get(EWL_WINDOW(win));
+ if (name)
+ snprintf(buf, len, "non-empty name set");
+ else
+ ret = 1;
+ }
+ }
+
+ ewl_widget_destroy(win);
+
+ return ret;
}
/*
@@ -186,34 +186,34 @@ name_set_get(char *buf, int len)
static int
class_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- const char *class;
- int ret = 0;
-
- win = ewl_window_new();
- class = ewl_window_class_get(EWL_WINDOW(win));
-
- if (class)
- snprintf(buf, len, "default class set to '%s'", class);
- else {
- ewl_window_class_set(EWL_WINDOW(win), "A class");
- class = ewl_window_class_get(EWL_WINDOW(win));
-
- if (strcmp(class, "A class"))
- snprintf(buf, len, "incorrect class set");
- else {
- ewl_window_class_set(EWL_WINDOW(win), "");
- class = ewl_window_class_get(EWL_WINDOW(win));
- if (class)
- snprintf(buf, len, "non-empty class set");
- else
- ret = 1;
- }
- }
-
- ewl_widget_destroy(win);
-
- return ret;
+ Ewl_Widget *win;
+ const char *class;
+ int ret = 0;
+
+ win = ewl_window_new();
+ class = ewl_window_class_get(EWL_WINDOW(win));
+
+ if (class)
+ snprintf(buf, len, "default class set to '%s'", class);
+ else {
+ ewl_window_class_set(EWL_WINDOW(win), "A class");
+ class = ewl_window_class_get(EWL_WINDOW(win));
+
+ if (strcmp(class, "A class"))
+ snprintf(buf, len, "incorrect class set");
+ else {
+ ewl_window_class_set(EWL_WINDOW(win), "");
+ class = ewl_window_class_get(EWL_WINDOW(win));
+ if (class)
+ snprintf(buf, len, "non-empty class set");
+ else
+ ret = 1;
+ }
+ }
+
+ ewl_widget_destroy(win);
+
+ return ret;
}
/*
@@ -222,23 +222,23 @@ class_set_get(char *buf, int len)
static int
borderless_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
- ewl_window_borderless_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_borderless_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "setting borderless TRUE failed");
+ win = ewl_window_new();
+ ewl_window_borderless_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_borderless_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "setting borderless TRUE failed");
- ewl_window_borderless_set(EWL_WINDOW(win), FALSE);
- if (ewl_window_borderless_get(EWL_WINDOW(win)))
- snprintf(buf, len, "setting borderless FALSE failed");
+ ewl_window_borderless_set(EWL_WINDOW(win), FALSE);
+ if (ewl_window_borderless_get(EWL_WINDOW(win)))
+ snprintf(buf, len, "setting borderless FALSE failed");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -247,31 +247,31 @@ borderless_set_get(char *buf, int len)
static int
dialog_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_dialog_get(EWL_WINDOW(win))) {
+ if (!ewl_window_dialog_get(EWL_WINDOW(win))) {
- ewl_window_dialog_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_dialog_get(EWL_WINDOW(win))) {
+ ewl_window_dialog_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_dialog_get(EWL_WINDOW(win))) {
- ewl_window_dialog_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_dialog_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "dialog unset failed");
- }
- else
- snprintf(buf, len, "dialog set failed");
- }
- else
- snprintf(buf, len, "default dialog set");
+ ewl_window_dialog_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_dialog_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "dialog unset failed");
+ }
+ else
+ snprintf(buf, len, "dialog set failed");
+ }
+ else
+ snprintf(buf, len, "default dialog set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -280,31 +280,31 @@ dialog_set_get(char *buf, int len)
static int
fullscreen_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_fullscreen_get(EWL_WINDOW(win))) {
+ if (!ewl_window_fullscreen_get(EWL_WINDOW(win))) {
- ewl_window_fullscreen_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_fullscreen_get(EWL_WINDOW(win))) {
+ ewl_window_fullscreen_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_fullscreen_get(EWL_WINDOW(win))) {
- ewl_window_fullscreen_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_fullscreen_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "fullscreen unset failed");
- }
- else
- snprintf(buf, len, "fullscreen set failed");
- }
- else
- snprintf(buf, len, "default fullscreen set");
+ ewl_window_fullscreen_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_fullscreen_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "fullscreen unset failed");
+ }
+ else
+ snprintf(buf, len, "fullscreen set failed");
+ }
+ else
+ snprintf(buf, len, "default fullscreen set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -313,31 +313,31 @@ fullscreen_set_get(char *buf, int len)
static int
skip_taskbar_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_skip_taskbar_get(EWL_WINDOW(win))) {
+ if (!ewl_window_skip_taskbar_get(EWL_WINDOW(win))) {
- ewl_window_skip_taskbar_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_skip_taskbar_get(EWL_WINDOW(win))) {
+ ewl_window_skip_taskbar_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_skip_taskbar_get(EWL_WINDOW(win))) {
- ewl_window_skip_taskbar_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_skip_taskbar_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "skip_taskbar unset failed");
- }
- else
- snprintf(buf, len, "skip_taskbar set failed");
- }
- else
- snprintf(buf, len, "default skip_taskbar set");
+ ewl_window_skip_taskbar_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_skip_taskbar_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "skip_taskbar unset failed");
+ }
+ else
+ snprintf(buf, len, "skip_taskbar set failed");
+ }
+ else
+ snprintf(buf, len, "default skip_taskbar set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -346,31 +346,31 @@ skip_taskbar_set_get(char *buf, int len)
static int
skip_pager_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_skip_pager_get(EWL_WINDOW(win))) {
+ if (!ewl_window_skip_pager_get(EWL_WINDOW(win))) {
- ewl_window_skip_pager_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_skip_pager_get(EWL_WINDOW(win))) {
+ ewl_window_skip_pager_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_skip_pager_get(EWL_WINDOW(win))) {
- ewl_window_skip_pager_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_skip_pager_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "skip_pager unset failed");
- }
- else
- snprintf(buf, len, "skip_pager set failed");
- }
- else
- snprintf(buf, len, "default skip_pager set");
+ ewl_window_skip_pager_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_skip_pager_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "skip_pager unset failed");
+ }
+ else
+ snprintf(buf, len, "skip_pager set failed");
+ }
+ else
+ snprintf(buf, len, "default skip_pager set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -379,31 +379,31 @@ skip_pager_set_get(char *buf, int len)
static int
urgent_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_urgent_get(EWL_WINDOW(win))) {
+ if (!ewl_window_urgent_get(EWL_WINDOW(win))) {
- ewl_window_urgent_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_urgent_get(EWL_WINDOW(win))) {
+ ewl_window_urgent_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_urgent_get(EWL_WINDOW(win))) {
- ewl_window_urgent_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_urgent_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "urgent unset failed");
- }
- else
- snprintf(buf, len, "urgent set failed");
- }
- else
- snprintf(buf, len, "default urgent set");
+ ewl_window_urgent_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_urgent_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "urgent unset failed");
+ }
+ else
+ snprintf(buf, len, "urgent set failed");
+ }
+ else
+ snprintf(buf, len, "default urgent set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -412,31 +412,31 @@ urgent_set_get(char *buf, int len)
static int
modal_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_modal_get(EWL_WINDOW(win))) {
+ if (!ewl_window_modal_get(EWL_WINDOW(win))) {
- ewl_window_modal_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_modal_get(EWL_WINDOW(win))) {
+ ewl_window_modal_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_modal_get(EWL_WINDOW(win))) {
- ewl_window_modal_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_modal_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "modal unset failed");
- }
- else
- snprintf(buf, len, "modal set failed");
- }
- else
- snprintf(buf, len, "default modal set");
+ ewl_window_modal_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_modal_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "modal unset failed");
+ }
+ else
+ snprintf(buf, len, "modal set failed");
+ }
+ else
+ snprintf(buf, len, "default modal set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -445,31 +445,31 @@ modal_set_get(char *buf, int len)
static int
keyboard_grab_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_keyboard_grab_get(EWL_WINDOW(win))) {
+ if (!ewl_window_keyboard_grab_get(EWL_WINDOW(win))) {
- ewl_window_keyboard_grab_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_keyboard_grab_get(EWL_WINDOW(win))) {
+ ewl_window_keyboard_grab_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_keyboard_grab_get(EWL_WINDOW(win))) {
- ewl_window_keyboard_grab_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_keyboard_grab_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "keyboard_grab unset failed");
- }
- else
- snprintf(buf, len, "keyboard_grab set failed");
- }
- else
- snprintf(buf, len, "default keyboard_grab set");
+ ewl_window_keyboard_grab_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_keyboard_grab_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "keyboard_grab unset failed");
+ }
+ else
+ snprintf(buf, len, "keyboard_grab set failed");
+ }
+ else
+ snprintf(buf, len, "default keyboard_grab set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -478,31 +478,31 @@ keyboard_grab_set_get(char *buf, int len)
static int
pointer_grab_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_pointer_grab_get(EWL_WINDOW(win))) {
+ if (!ewl_window_pointer_grab_get(EWL_WINDOW(win))) {
- ewl_window_pointer_grab_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_pointer_grab_get(EWL_WINDOW(win))) {
+ ewl_window_pointer_grab_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_pointer_grab_get(EWL_WINDOW(win))) {
- ewl_window_pointer_grab_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_pointer_grab_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "pointer_grab unset failed");
- }
- else
- snprintf(buf, len, "pointer_grab set failed");
- }
- else
- snprintf(buf, len, "default pointer_grab set");
+ ewl_window_pointer_grab_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_pointer_grab_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "pointer_grab unset failed");
+ }
+ else
+ snprintf(buf, len, "pointer_grab set failed");
+ }
+ else
+ snprintf(buf, len, "default pointer_grab set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
/*
@@ -511,29 +511,29 @@ pointer_grab_set_get(char *buf, int len)
static int
override_set_get(char *buf, int len)
{
- Ewl_Widget *win;
- int ret = 0;
+ Ewl_Widget *win;
+ int ret = 0;
- win = ewl_window_new();
+ win = ewl_window_new();
- if (!ewl_window_override_get(EWL_WINDOW(win))) {
+ if (!ewl_window_override_get(EWL_WINDOW(win))) {
- ewl_window_override_set(EWL_WINDOW(win), TRUE);
- if (ewl_window_override_get(EWL_WINDOW(win))) {
+ ewl_window_override_set(EWL_WINDOW(win), TRUE);
+ if (ewl_window_override_get(EWL_WINDOW(win))) {
- ewl_window_override_set(EWL_WINDOW(win), FALSE);
- if (!ewl_window_override_get(EWL_WINDOW(win)))
- ret = 1;
- else
- snprintf(buf, len, "override unset failed");
- }
- else
- snprintf(buf, len, "override set failed");
- }
- else
- snprintf(buf, len, "default override set");
+ ewl_window_override_set(EWL_WINDOW(win), FALSE);
+ if (!ewl_window_override_get(EWL_WINDOW(win)))
+ ret = 1;
+ else
+ snprintf(buf, len, "override unset failed");
+ }
+ else
+ snprintf(buf, len, "override set failed");
+ }
+ else
+ snprintf(buf, len, "default override set");
- ewl_widget_destroy(win);
+ ewl_widget_destroy(win);
- return ret;
+ return ret;
}
--
Enlightenment DR17 toolkit based (based on the EFL)
More information about the Pkg-e-commits
mailing list