Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/bin
Modified Files:
ewl_dialog_test.c ewl_filedialog_multi_test.c
ewl_filedialog_test.c ewl_image_test.c ewl_media_test.c
Log Message:
- get rid of ewl_button_stock.[ch]. If you want a stock button you do:
b = ewl_button_new();
ewl_button_stock_type_set(EWL_BUTTON(b), EWL_STOCK_OK);
and thats it. You can then attach a click callback to the button and in
the callback do
ewl_button_stock_type_get(EWL_BUTTON(b));
to get the type of the button. Non-stock buttons have type EWL_STOCK_NONE.
- cleanup Ewl_Dialog. This gets rid of all the api for adding buttons and
replaces it with ewl_dialog_active_area_set(). You specify which part of
the dialog is active and just use the container functions to append into
it.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_dialog_test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_dialog_test.c 9 Oct 2005 05:18:39 -0000 1.5
+++ ewl_dialog_test.c 10 Oct 2005 15:27:10 -0000 1.6
@@ -2,141 +2,136 @@
static void
__destroy_test_window(Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_widget_destroy(EWL_WIDGET(w));
+ ewl_widget_destroy(EWL_WIDGET(w));
}
void
-__create_window_response(Ewl_Widget *w __UNUSED__, int *id,
- void *data __UNUSED__)
+__create_window_response(Ewl_Widget *w, void *ev __UNUSED__,
+ void *data __UNUSED__)
{
- Ewl_Widget *win_ok = NULL;
- Ewl_Widget *win_cancel = NULL;
- Ewl_Widget *label;
- char str[100];
- int response;
-
- response = (int)*id;
- switch (response)
- {
- case EWL_RESPONSE_OK:
- {
- if (win_ok != NULL)
- {
- ewl_window_raise (EWL_WINDOW (win_ok));
- return;
- }
- win_ok = ewl_window_new ();
- ewl_window_title_set (EWL_WINDOW (win_ok), "OK Window");
- ewl_window_name_set (EWL_WINDOW (win_ok), "EWL Test Application");
- ewl_window_class_set (EWL_WINDOW (win_ok), "EFL Test Application");
- ewl_object_insets_set (EWL_OBJECT (win_ok), 5, 5, 5, 5);
- ewl_callback_append (win_ok, EWL_CALLBACK_DELETE_WINDOW,
- __destroy_test_window, NULL);
+ Ewl_Widget *win_ok = NULL;
+ Ewl_Widget *win_cancel = NULL;
+ Ewl_Widget *label;
+ char str[100];
+ Ewl_Stock_Type response;
+
+ response = ewl_button_stock_type_get(EWL_BUTTON(w));
+ if (response == EWL_STOCK_OK)
+ {
+ if (win_ok != NULL)
+ {
+ ewl_window_raise (EWL_WINDOW (win_ok));
+ return;
+ }
+ win_ok = ewl_window_new ();
+ ewl_window_title_set (EWL_WINDOW (win_ok), "OK Window");
+ ewl_window_name_set (EWL_WINDOW (win_ok), "EWL Test
Application");
+ ewl_window_class_set (EWL_WINDOW (win_ok), "EFL Test
Application");
+ ewl_object_insets_set (EWL_OBJECT (win_ok), 5, 5, 5, 5);
+ ewl_callback_append (win_ok, EWL_CALLBACK_DELETE_WINDOW,
+ __destroy_test_window, NULL);
+
+ sprintf (str, "You have clicked on the OK Button\nThe response
id is %d.\n", response);
+
+ label = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(label), str);
+ ewl_container_child_append (EWL_CONTAINER (win_ok), label);
+ ewl_widget_show (label);
+
+ ewl_widget_show (win_ok);
+
+ }
+ else if (response == EWL_STOCK_CANCEL)
+ {
+ if (win_cancel != NULL)
+ {
+ ewl_window_raise (EWL_WINDOW (win_cancel));
+ return;
+ }
+
+ win_cancel = ewl_window_new ();
+ ewl_window_title_set (EWL_WINDOW (win_cancel), "CANCEL Window");
+ ewl_window_name_set (EWL_WINDOW (win_cancel), "EWL Test
Application");
+ ewl_window_class_set (EWL_WINDOW (win_cancel), "EFL Test
Application");
+ ewl_object_insets_set (EWL_OBJECT (win_cancel), 5, 5, 5, 5);
+ ewl_callback_append (win_cancel, EWL_CALLBACK_DELETE_WINDOW,
+ __destroy_test_window, NULL);
+
+ sprintf (str, "You have clicked on the CANCEL Button\nThe
response id is %d.\n", response);
+
+ label = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(label), str);
+ ewl_container_child_append (EWL_CONTAINER (win_cancel), label);
+ ewl_widget_show (label);
- sprintf (str, "You have clicked on the OK Button\nThe response id is
%d.\n", response);
+ ewl_widget_show (win_cancel);
- label = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(label), str);
- ewl_container_child_append (EWL_CONTAINER (win_ok), label);
- ewl_widget_show (label);
-
- ewl_widget_show (win_ok);
-
- break;
- }
- case EWL_RESPONSE_CANCEL:
- {
- if (win_cancel != NULL)
- {
- ewl_window_raise (EWL_WINDOW (win_cancel));
- return;
- }
-
- win_cancel = ewl_window_new ();
- ewl_window_title_set (EWL_WINDOW (win_cancel), "CANCEL Window");
- ewl_window_name_set (EWL_WINDOW (win_cancel), "EWL Test Application");
- ewl_window_class_set (EWL_WINDOW (win_cancel), "EFL Test Application");
- ewl_object_insets_set (EWL_OBJECT (win_cancel), 5, 5, 5, 5);
- ewl_callback_append (win_cancel, EWL_CALLBACK_DELETE_WINDOW,
- __destroy_test_window, NULL);
-
- sprintf (str, "You have clicked on the CANCEL Button\nThe response id
is %d.\n", response);
-
- label = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(label), str);
- ewl_container_child_append (EWL_CONTAINER (win_cancel), label);
- ewl_widget_show (label);
-
- ewl_widget_show (win_cancel);
-
- break;
- }
- }
+ }
}
static void
__destroy_dialog_test_window (Ewl_Widget *w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- ewl_widget_destroy (EWL_WIDGET (w));
+ ewl_widget_destroy (EWL_WIDGET (w));
}
void
__create_dialog_test_window (Ewl_Widget * w, void *ev __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
- Ewl_Widget *dialog_win;
- Ewl_Widget *hbox;
- Ewl_Widget *image;
- Ewl_Widget *label;
- Ewl_Widget *button;
-
- dialog_win = ewl_dialog_new ();
- ewl_window_title_set (EWL_WINDOW (dialog_win), "Dialog Test");
- ewl_window_name_set (EWL_WINDOW (dialog_win), "EWL Test Application");
- ewl_window_class_set (EWL_WINDOW (dialog_win), "EFL Test Application");
- ewl_object_insets_set (EWL_OBJECT (dialog_win), 5, 5, 5, 5);
-
- if (w)
- ewl_callback_append (dialog_win, EWL_CALLBACK_DELETE_WINDOW,
- EWL_CALLBACK_FUNCTION (__destroy_dialog_test_window), NULL);
- else
- ewl_callback_append(dialog_win, EWL_CALLBACK_DELETE_WINDOW,
- __close_main_window, NULL);
-
- hbox = ewl_hbox_new ();
- ewl_dialog_widget_add (EWL_DIALOG (dialog_win), hbox);
- ewl_widget_show (hbox);
-
- image = ewl_image_new ();
- ewl_image_file_set(EWL_IMAGE(image), "my_image.png", NULL);
- ewl_container_child_append (EWL_CONTAINER (hbox), image);
- ewl_widget_show (image);
-
- label = ewl_text_new();
- ewl_text_text_set(EWL_TEXT(label), "This is a test for the Dialog widget");
- ewl_container_child_append (EWL_CONTAINER (hbox), label);
- ewl_widget_show (label);
-
- button = ewl_button_stock_new();
- ewl_button_stock_id_set(EWL_BUTTON_STOCK(button), EWL_STOCK_OK);
- ewl_button_stock_response_id_set(EWL_BUTTON_STOCK(button), EWL_RESPONSE_OK);
- ewl_container_child_append (EWL_CONTAINER (dialog_win), button);
- ewl_callback_append (button, EWL_CALLBACK_VALUE_CHANGED,
- EWL_CALLBACK_FUNCTION (__create_window_response), NULL);
- ewl_widget_show (button);
-
- button = ewl_button_stock_new();
- ewl_button_stock_id_set(EWL_BUTTON_STOCK(button), EWL_STOCK_CANCEL);
- ewl_button_stock_response_id_set(EWL_BUTTON_STOCK(button),
- EWL_RESPONSE_CANCEL);
- ewl_container_child_append (EWL_CONTAINER (dialog_win), button);
- ewl_callback_append (button, EWL_CALLBACK_VALUE_CHANGED,
- EWL_CALLBACK_FUNCTION (__create_window_response), NULL);
- ewl_widget_show (button);
-
- ewl_widget_show (dialog_win);
+ Ewl_Widget *dialog_win;
+ Ewl_Widget *hbox;
+ Ewl_Widget *label;
+ Ewl_Widget *button;
+
+ dialog_win = ewl_dialog_new();
+ ewl_window_title_set(EWL_WINDOW (dialog_win), "Dialog Test");
+ ewl_window_name_set(EWL_WINDOW (dialog_win), "EWL Test Application");
+ ewl_window_class_set(EWL_WINDOW (dialog_win), "EFL Test Application");
+ ewl_object_insets_set(EWL_OBJECT (dialog_win), 5, 5, 5, 5);
+
+ if (w)
+ ewl_callback_append(dialog_win, EWL_CALLBACK_DELETE_WINDOW,
+
EWL_CALLBACK_FUNCTION(__destroy_dialog_test_window), NULL);
+ else
+ ewl_callback_append(dialog_win, EWL_CALLBACK_DELETE_WINDOW,
+ __close_main_window, NULL);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog_win), EWL_POSITION_TOP);
+
+ hbox = ewl_hbox_new();
+ ewl_container_child_append(EWL_CONTAINER(dialog_win), hbox);
+ ewl_widget_show(hbox);
+
+ label = ewl_label_new();
+ ewl_label_text_set(EWL_LABEL(label), "blah blah blah");
+ ewl_container_child_append(EWL_CONTAINER(hbox), label);
+ ewl_widget_show(label);
+
+ label = ewl_text_new();
+ ewl_text_text_set(EWL_TEXT(label), "This is a test for the Dialog
widget");
+ ewl_container_child_append(EWL_CONTAINER (hbox), label);
+ ewl_widget_show(label);
+
+ ewl_dialog_active_area_set(EWL_DIALOG(dialog_win), EWL_POSITION_BOTTOM);
+
+ button = ewl_button_new();
+ ewl_button_stock_type_set(EWL_BUTTON(button), EWL_STOCK_OK);
+ ewl_container_child_append(EWL_CONTAINER(dialog_win), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED,
+ __create_window_response, NULL);
+ ewl_widget_show(button);
+
+ button = ewl_button_new();
+ ewl_button_stock_type_set(EWL_BUTTON(button), EWL_STOCK_CANCEL);
+ ewl_container_child_append(EWL_CONTAINER(dialog_win), button);
+ ewl_callback_append(button, EWL_CALLBACK_CLICKED,
+ __create_window_response, NULL);
+ ewl_widget_show(button);
+
+ ewl_widget_show(dialog_win);
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_filedialog_multi_test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_filedialog_multi_test.c 28 May 2005 20:32:49 -0000 1.2
+++ ewl_filedialog_multi_test.c 10 Oct 2005 15:27:10 -0000 1.3
@@ -45,7 +45,7 @@
response = (int *)ev;
switch (*response) {
- case EWL_RESPONSE_OPEN:
+ case EWL_STOCK_OPEN:
{
Ecore_List *list;
list = ewl_filedialog_select_list_get(EWL_FILEDIALOG(w));
@@ -53,7 +53,7 @@
ecore_list_for_each(list, __fdm_print, NULL);
break;
}
- case EWL_RESPONSE_CANCEL:
+ case EWL_STOCK_CANCEL:
{
printf("Test program says bugger off.\n");
break;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_filedialog_test.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_filedialog_test.c 5 Oct 2005 05:41:01 -0000 1.4
+++ ewl_filedialog_test.c 10 Oct 2005 15:27:10 -0000 1.5
@@ -44,13 +44,13 @@
response = (int *)ev;
switch (*response)
{
- case EWL_RESPONSE_OPEN:
+ case EWL_STOCK_OPEN:
{
printf("file open from test program: %s\n",
ewl_filedialog_file_get (EWL_FILEDIALOG (w)));
break;
}
- case EWL_RESPONSE_CANCEL:
+ case EWL_STOCK_CANCEL:
{
printf("Test program says bugger off.\n");
break;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_image_test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_image_test.c 5 Oct 2005 05:41:01 -0000 1.5
+++ ewl_image_test.c 10 Oct 2005 15:27:10 -0000 1.6
@@ -261,7 +261,7 @@
response = (int *)ev;
- if (*response == EWL_RESPONSE_OPEN) {
+ if (*response == EWL_STOCK_OPEN) {
char *path;
printf("File open from image test: %s\n",
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_media_test.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ewl_media_test.c 5 Oct 2005 10:45:32 -0000 1.7
+++ ewl_media_test.c 10 Oct 2005 15:27:10 -0000 1.8
@@ -17,7 +17,7 @@
static Ewl_Widget *seeker;
typedef struct {
- char *name;
+ Ewl_Stock_Type name;
Ewl_Callback_Function func;
} Control;
@@ -118,7 +118,7 @@
ewl_widget_hide(fd_win);
switch (*response) {
- case EWL_RESPONSE_OPEN:
+ case EWL_STOCK_OPEN:
file = ewl_filedialog_file_get(EWL_FILEDIALOG(w));
break;
}
@@ -234,13 +234,13 @@
{ EWL_STOCK_REWIND, rew_cb },
{ EWL_STOCK_FASTFORWARD, ff_cb },
{ EWL_STOCK_OPEN, open_cb },
- { NULL, NULL }
+ { EWL_STOCK_NONE, NULL }
};
int i;
- for(i = 0; controls[i].name != NULL; i++) {
- o = ewl_button_stock_new();
- ewl_button_stock_id_set(EWL_BUTTON_STOCK(o), controls[i].name);
+ for(i = 0; controls[i].name != EWL_STOCK_NONE; i++) {
+ o = ewl_button_new();
+ ewl_button_stock_type_set(EWL_BUTTON(o), controls[i].name);
ewl_container_child_append(EWL_CONTAINER(b), o);
ewl_callback_append(o, EWL_CALLBACK_CLICKED,
controls[i].func, NULL);
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs