Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin Modified Files: Makefile.am ewl_notebook_test.c ewl_test.c ewl_test.h ewl_theme_test.c Removed Files: ewl_notebook2_test.c Log Message: - rename notebook2 to notebook. - this is API breakage. you now use the normal container functions to append/prepend/insert widgets to the notebook - update the theme test to the new notebook api - fixup some other wierdness in the theme code =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/Makefile.am,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- Makefile.am 3 Feb 2006 06:00:12 -0000 1.15 +++ Makefile.am 4 Feb 2006 05:58:48 -0000 1.16 @@ -37,7 +37,6 @@ ewl_menu_test.c \ ewl_menu_bar_test.c \ ewl_notebook_test.c \ - ewl_notebook2_test.c \ ewl_paned_test.c \ ewl_password_test.c \ ewl_progressbar_test.c \ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_notebook_test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_notebook_test.c 3 Oct 2005 06:43:07 -0000 1.3 +++ ewl_notebook_test.c 4 Feb 2006 05:58:48 -0000 1.4 @@ -1,316 +1,328 @@ #include "ewl_test.h" -static Ewl_Widget *notebook_button; +static Ewl_Widget *nb2_button; +static int count = 1; -static void __notebook_append_page(Ewl_Widget * w, void *ev_data, - void *user_data); -static void __notebook_prepend_page(Ewl_Widget * w, void *ev_data, - void *user_data); -static void __notebook_remove_visible_page(Ewl_Widget * w, void *ev_data, - void *user_data); - -static Ewl_Widget *button_aleft, *button_acenter, *button_aright; -static Ewl_Widget *button_atop, *button_abottom; -static Ewl_Widget *button_pleft, *button_pright, *button_ptop, *button_pbottom; +static Ewl_Widget *create_page(const char *name); static void -__destroy_notebook_test_window(Ewl_Widget * w, void *ev_data __UNUSED__, +__destroy_notebook_test_window(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { ewl_widget_destroy(w); - ewl_callback_append(notebook_button, EWL_CALLBACK_CLICKED, + + ewl_callback_append(nb2_button, EWL_CALLBACK_CLICKED, __create_notebook_test_window, NULL); } static void -__notebook_change_alignment(Ewl_Widget * w, void *ev_data __UNUSED__, - void *user_data) +notebook_cb_toggle_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, + void *data __UNUSED__) { - if (!ewl_radiobutton_is_checked(EWL_RADIOBUTTON(w))) - return; + Ewl_Widget *n; - if (w == button_aleft) - ewl_notebook_tabs_alignment_set(user_data, EWL_FLAG_ALIGN_LEFT); - else if (w == button_acenter) - ewl_notebook_tabs_alignment_set(user_data, - EWL_FLAG_ALIGN_CENTER); - else if (w == button_aright) - ewl_notebook_tabs_alignment_set(user_data, EWL_FLAG_ALIGN_RIGHT); - else if (w == button_atop) - ewl_notebook_tabs_alignment_set(user_data, EWL_FLAG_ALIGN_TOP); - else if (w == button_abottom) - ewl_notebook_tabs_alignment_set(user_data, - EWL_FLAG_ALIGN_BOTTOM); + 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_change_position(Ewl_Widget * w, void *ev_data __UNUSED__, - void *user_data) +notebook_change_align(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, + void *data) { - if (!ewl_radiobutton_is_checked(w)) - return; - - if (w == button_pleft) - ewl_notebook_tabs_position_set(user_data, EWL_POSITION_LEFT); - else if (w == button_pright) - ewl_notebook_tabs_position_set(user_data, EWL_POSITION_RIGHT); - else if (w == button_ptop) - ewl_notebook_tabs_position_set(user_data, EWL_POSITION_TOP); - else if (w == button_pbottom) - ewl_notebook_tabs_position_set(user_data, EWL_POSITION_BOTTOM); + 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_create_main_page(Ewl_Widget * notebook) +notebook_change_position(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, + void *data) { - Ewl_Widget *main_vbox; - Ewl_Widget *tab; - Ewl_Widget *text; - Ewl_Widget *avbox, *alabel; - Ewl_Widget *pvbox, *plabel; - - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), "Main"); - ewl_widget_show(tab); - - main_vbox = ewl_vbox_new(); - ewl_box_spacing_set(EWL_BOX(main_vbox), 10); - ewl_widget_show(main_vbox); - - text = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(text), "Main"); - ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER); - ewl_container_child_append(EWL_CONTAINER(main_vbox), text); - ewl_widget_show(text); - - avbox = ewl_vbox_new(); - ewl_object_alignment_set(EWL_OBJECT(avbox), EWL_FLAG_ALIGN_CENTER); - ewl_container_child_append(EWL_CONTAINER(main_vbox), avbox); - ewl_widget_show(avbox); - - alabel = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(alabel), "Tabs Alignment"); - ewl_container_child_append(EWL_CONTAINER(avbox), alabel); - ewl_widget_show(alabel); - - button_atop = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_atop), "Top"); - ewl_container_child_append(EWL_CONTAINER(avbox), button_atop); - ewl_callback_append(button_atop, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_alignment, notebook); - ewl_widget_show(button_atop); - - button_aleft = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_aleft), "Left"); - ewl_radiobutton_checked_set(button_aleft, 1); - ewl_container_child_append(EWL_CONTAINER(avbox), button_aleft); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_aleft), - EWL_RADIOBUTTON(button_atop)); - ewl_callback_append(button_aleft, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_alignment, notebook); - ewl_widget_show(button_aleft); - - button_acenter = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_acenter), "Center"); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_acenter), - EWL_RADIOBUTTON(button_aleft)); - ewl_radiobutton_checked_set(button_acenter, 1); - ewl_container_child_append(EWL_CONTAINER(avbox), button_acenter); - ewl_callback_append(button_acenter, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_alignment, notebook); - ewl_widget_show(button_acenter); - - button_aright = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_aright), "Right"); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_aright), - EWL_RADIOBUTTON(button_acenter)); - ewl_container_child_append(EWL_CONTAINER(avbox), button_aright); - ewl_callback_append(button_aright, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_alignment, notebook); - ewl_widget_show(button_aright); - - button_abottom = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_abottom), "Bottom"); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_abottom), - EWL_RADIOBUTTON(button_aright)); - ewl_container_child_append(EWL_CONTAINER(avbox), button_abottom); - ewl_callback_append(button_abottom, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_alignment, notebook); - ewl_widget_show(button_abottom); - - pvbox = ewl_vbox_new(); - ewl_object_alignment_set(EWL_OBJECT(pvbox), EWL_FLAG_ALIGN_CENTER); - ewl_container_child_append(EWL_CONTAINER(main_vbox), pvbox); - ewl_widget_show(pvbox); - - plabel = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(plabel), "Tabs Position"); - ewl_container_child_append(EWL_CONTAINER(pvbox), plabel); - ewl_widget_show(plabel); - - button_pleft = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_pleft), "Left"); - ewl_container_child_append(EWL_CONTAINER(pvbox), button_pleft); - ewl_callback_append(button_pleft, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_position, notebook); - ewl_widget_show(button_pleft); - - button_pright = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_pright), "Right"); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_pright), - EWL_RADIOBUTTON(button_pleft)); - ewl_container_child_append(EWL_CONTAINER(pvbox), button_pright); - ewl_callback_append(button_pright, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_position, notebook); - ewl_widget_show(button_pright); - - button_ptop = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_ptop), "Top"); - ewl_radiobutton_checked_set(button_ptop, 1); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_ptop), - EWL_RADIOBUTTON(button_pright)); - ewl_container_child_append(EWL_CONTAINER(pvbox), button_ptop); - ewl_callback_append(button_ptop, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_position, notebook); - ewl_widget_show(button_ptop); - - button_pbottom = ewl_radiobutton_new(); - ewl_button_label_set(EWL_BUTTON(button_pbottom), "Bottom"); - ewl_radiobutton_chain_set(EWL_RADIOBUTTON(button_pbottom), - EWL_RADIOBUTTON(button_ptop)); - ewl_container_child_append(EWL_CONTAINER(pvbox), button_pbottom); - ewl_callback_append(button_pbottom, EWL_CALLBACK_VALUE_CHANGED, - __notebook_change_position, notebook); - ewl_widget_show(button_pbottom); - - ewl_notebook_page_prepend(EWL_NOTEBOOK(notebook), tab, main_vbox); + 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_generate_page(Ewl_Widget *notebook, int type) +notebook_append_page(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, + void *data __UNUSED__) { - Ewl_Widget *main_vbox, *hbox; - Ewl_Widget *tab; - Ewl_Widget *text; - Ewl_Widget *button[3]; - static int num = 1; - char label[20]; - - snprintf(label, 20, "Page %i", num++); - - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), label); - ewl_widget_show(tab); - - main_vbox = ewl_vbox_new(); - ewl_box_spacing_set(EWL_BOX(main_vbox), 10); - ewl_widget_show(main_vbox); - - text = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(text), label); - ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER); - ewl_container_child_append(EWL_CONTAINER(main_vbox), text); - ewl_widget_show(text); - - hbox = ewl_hbox_new(); - ewl_box_spacing_set(EWL_BOX(hbox), 5); - ewl_object_padding_set(EWL_OBJECT(hbox), 0, 0, 20, 0); - ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER); - ewl_container_child_append(EWL_CONTAINER(main_vbox), hbox); - ewl_widget_show(hbox); - - button[0] = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(button[0]), "Append Page"); - ewl_container_child_append(EWL_CONTAINER(hbox), button[0]); - ewl_callback_append(button[0], EWL_CALLBACK_CLICKED, - __notebook_append_page, notebook); - ewl_widget_show(button[0]); - - button[1] = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(button[1]), "Prepend Page"); - ewl_container_child_append(EWL_CONTAINER(hbox), button[1]); - ewl_callback_append(button[1], EWL_CALLBACK_CLICKED, - __notebook_prepend_page, notebook); - ewl_widget_show(button[1]); - - button[2] = ewl_button_new(); - ewl_button_label_set(EWL_BUTTON(button[2]), "Remove This Page"); - ewl_object_alignment_set(EWL_OBJECT(button[2]), EWL_FLAG_ALIGN_CENTER); - ewl_container_child_append(EWL_CONTAINER(main_vbox), button[2]); - ewl_callback_append(button[2], EWL_CALLBACK_CLICKED, - __notebook_remove_visible_page, notebook); - ewl_widget_show(button[2]); - - if (!type) - ewl_notebook_page_append(EWL_NOTEBOOK(notebook), tab, main_vbox); - else - ewl_notebook_page_prepend(EWL_NOTEBOOK(notebook), tab, main_vbox); + Ewl_Widget *o2, *o, *vis, *n; + char buf[10]; + int idx; + + 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); + + 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); } static void -__notebook_append_page(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data) +notebook_prepend_page(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, + void *data __UNUSED__) { - __notebook_generate_page(user_data, 0); + Ewl_Widget *n, *o2, *o, *vis; + char buf[10]; + int idx; + + 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); + + 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); } static void -__notebook_prepend_page(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data) +notebook_delete_page(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, + void *data) { - __notebook_generate_page(user_data, 1); + Ewl_Widget *n; + + n = ewl_widget_name_find("notebook"); + ewl_container_child_remove(EWL_CONTAINER(n), EWL_WIDGET(data)); } -static void -__notebook_remove_visible_page(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data) +static Ewl_Widget * +create_main_page(void) { - ewl_notebook_visible_page_remove(EWL_NOTEBOOK(user_data)); + 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_text_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_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_radiobutton_checked_set(EWL_RADIOBUTTON(o), TRUE); + + ewl_widget_show(o); + + o2 = o; + } + + /* box to hold position list */ + border = ewl_border_new(); + ewl_border_text_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_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_radiobutton_checked_set(EWL_RADIOBUTTON(o), TRUE); + + ewl_widget_show(o); + + o2 = o; + } + + o = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(o), "Toggle 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_toggle_clicked, NULL); + 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; } void -__create_notebook_test_window(Ewl_Widget * w, void *ev_data __UNUSED__, +__create_notebook_test_window(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { - Ewl_Widget *notebook_win; - Ewl_Widget *notebook_box; - Ewl_Widget *notebook; - - notebook_button = w; - - notebook_win = ewl_window_new(); - ewl_window_title_set(EWL_WINDOW(notebook_win), "Notebook Test"); - ewl_window_name_set(EWL_WINDOW(notebook_win), "EWL Test Application"); - ewl_window_class_set(EWL_WINDOW(notebook_win), "EFL Test Application"); + Ewl_Widget *win, *box, *n, *o, *o2; + char buf[10]; + + nb2_button = w; + + win = ewl_window_new(); + ewl_window_title_set(EWL_WINDOW(win), "Notebook Test"); + ewl_window_name_set(EWL_WINDOW(win), "EWL Test Application"); + ewl_window_class_set(EWL_WINDOW(win), "EFL Test Application"); if (w) { ewl_callback_del(w, EWL_CALLBACK_CLICKED, - __create_notebook_test_window); - ewl_callback_append(notebook_win, EWL_CALLBACK_DELETE_WINDOW, - __destroy_notebook_test_window, NULL); + __create_notebook_test_window); + ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, + __destroy_notebook_test_window, NULL); } else - ewl_callback_append(notebook_win, EWL_CALLBACK_DELETE_WINDOW, - __close_main_window, NULL); - ewl_widget_show(notebook_win); - - /* - * Create the main box for holding the widgets - */ - notebook_box = ewl_vbox_new(); - ewl_container_child_append(EWL_CONTAINER(notebook_win), notebook_box); - ewl_box_spacing_set(EWL_BOX(notebook_box), 10); - ewl_widget_show(notebook_box); - - notebook = ewl_notebook_new(); - ewl_notebook_tabs_position_set(EWL_NOTEBOOK(notebook), - EWL_POSITION_LEFT); - ewl_container_child_append(EWL_CONTAINER(notebook_box), notebook); - ewl_widget_show(notebook); - - __notebook_append_page(NULL, NULL, notebook); - __notebook_append_page(NULL, NULL, notebook); - __notebook_append_page(NULL, NULL, notebook); + ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, + __close_main_window, NULL); + ewl_widget_show(win); + + box = ewl_hbox_new(); + ewl_container_child_append(EWL_CONTAINER(win), box); + ewl_widget_show(box); + + 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); - __notebook_create_main_page(notebook); + ewl_notebook_visible_page_set(EWL_NOTEBOOK(n), o); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_test.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- ewl_test.c 3 Feb 2006 06:00:12 -0000 1.25 +++ ewl_test.c 4 Feb 2006 05:58:48 -0000 1.26 @@ -208,14 +208,6 @@ "between using tab labels along one\nedge" }, { - "Notebook2", - __create_notebook2_test_window, - "ewl_notebook2_test.c", - "Provides a container whose children\n" - "are pages that can be switched\n" - "between using tab labels along one\nedge" - }, - { "Paned", __create_paned_test_window, "ewl_paned_test.c", =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_test.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- ewl_test.h 3 Feb 2006 06:00:12 -0000 1.19 +++ ewl_test.h 4 Feb 2006 05:58:48 -0000 1.20 @@ -50,7 +50,6 @@ void __create_menu_test_window (Ewl_Widget * w, void *ev_data, void *user_data); void __create_menubar_test_window (Ewl_Widget * w, void *ev_data, void *user_data); void __create_notebook_test_window (Ewl_Widget * w, void *ev_data, void *user_data); -void __create_notebook2_test_window (Ewl_Widget * w, void *ev_data, void *user_data); void __create_paned_test_window (Ewl_Widget * w, void *ev_data, void *user_data); void __create_password_test_window (Ewl_Widget * w, void *ev_data, void *user_data); void __create_progressbar_test_window (Ewl_Widget * w, void *ev_data, void *user_data); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_theme_test.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ewl_theme_test.c 28 Dec 2005 22:25:46 -0000 1.13 +++ ewl_theme_test.c 4 Feb 2006 05:58:48 -0000 1.14 @@ -1,411 +1,339 @@ #include "ewl_test.h" -static Ewl_Widget *notebook; -static char *theme_list_dir = PACKAGE_DATA_DIR "/themes/"; +#define THEME_DIR PACKAGE_DATA_DIR"/themes/" +#define THEME_TEST_NOTEBOOK "notebook" static void -__destroy_theme_test_window(Ewl_Widget * w, void *ev_data __UNUSED__, +__destroy_theme_test_window(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { - ewl_widget_destroy (w); + ewl_widget_destroy(w); } static void -__select_theme (Ewl_Widget * w, void *ev_data __UNUSED__, - void *user_data __UNUSED__) +__select_theme(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, + void *user_data) { - Ewl_Widget *cell; - Ewl_Widget *text; - char *theme_name; - char *theme_filename; - char *ext; - int len1; - int len2; - int i; - - ewl_container_child_iterate_begin (EWL_CONTAINER (w)); - cell = ewl_container_child_next (EWL_CONTAINER (w)); - - ewl_container_child_iterate_begin (EWL_CONTAINER (cell)); - text = ewl_container_child_next (EWL_CONTAINER (cell)); - - theme_name = ewl_label_text_get (EWL_LABEL (text)); - ext = ".edj"; - - len1 = strlen (theme_list_dir); - len2 = strlen (theme_name); - theme_filename = (char *)malloc (sizeof (char) * (len1 + len2 + 5)); - for (i = 0 ; i < len1 ; i++) - theme_filename[i] = theme_list_dir[i]; - for (i = 0 ; i < len2 ; i++) - theme_filename[i + len1] = theme_name[i]; - for (i = 0 ; i < 4 ; i++) - theme_filename[i + len1 + len2] = ext[i]; - theme_filename[len1 + len2 + 4] = '\0'; + Ewl_Widget *n; + char theme_filename[PATH_MAX]; - ewl_theme_data_str_set (notebook, - "/file", theme_filename); - - free (theme_filename); + n = ewl_widget_name_find(THEME_TEST_NOTEBOOK); + snprintf(theme_filename, sizeof(theme_filename), THEME_DIR "/%s", + (char *)user_data); + ewl_theme_data_str_set(n, "/file", theme_filename); } -static void +static Ewl_Widget * widgets_build(void) { - Ewl_Widget *misc; - Ewl_Widget *item; - Ewl_Widget *tab; - Ewl_Widget *vbox; - char *str; - char *str_col[2]; - - /* Notebook */ - notebook = ewl_notebook_new (); - ewl_object_fill_policy_set(EWL_OBJECT(notebook), EWL_FLAG_FILL_ALL); - ewl_notebook_tabs_position_set (EWL_NOTEBOOK(notebook), - EWL_POSITION_TOP); - ewl_widget_appearance_set (notebook, "window"); - - /* First page: buttons */ - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), "Buttons"); - ewl_widget_show (tab); - - vbox = ewl_vbox_new (); - ewl_widget_show (vbox); + Ewl_Widget *misc, *item, *vbox, *notebook; + char *str, *str_col[2]; + 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, THEME_TEST_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); + 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); + 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); - - ewl_notebook_page_append (EWL_NOTEBOOK(notebook), tab, vbox); - - /* Second page: numerical/text entries */ - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), "Numerical & text entries"); - ewl_widget_show (tab); - - vbox = ewl_vbox_new (); - ewl_widget_show (vbox); + 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); + 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 (); + misc = ewl_password_new(); ewl_password_text_set(EWL_PASSWORD(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_spinner_min_val_set (EWL_SPINNER (misc), 0); - ewl_spinner_max_val_set (EWL_SPINNER (misc), 1024); - ewl_spinner_step_set (EWL_SPINNER (misc), 1.0); - ewl_spinner_value_set (EWL_SPINNER (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_seeker_range_set (EWL_SEEKER (misc), 10); - ewl_seeker_step_set (EWL_SEEKER (misc), 1.0); - ewl_seeker_value_set (EWL_SEEKER (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); - - ewl_notebook_page_append (EWL_NOTEBOOK(notebook), tab, vbox); - - /* Third page: menus */ - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), "Menus"); - ewl_widget_show (tab); - - vbox = ewl_vbox_new (); - ewl_widget_show (vbox); + 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_spinner_min_val_set(EWL_SPINNER(misc), 0); + ewl_spinner_max_val_set(EWL_SPINNER(misc), 1024); + ewl_spinner_step_set(EWL_SPINNER(misc), 1.0); + ewl_spinner_value_set(EWL_SPINNER(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_seeker_range_set(EWL_SEEKER(misc), 10); + ewl_seeker_step_set(EWL_SEEKER(misc), 1.0); + ewl_seeker_value_set(EWL_SEEKER(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_imenu_new (); + misc = ewl_imenu_new(); ewl_menu_item_text_set(EWL_MENU_ITEM(misc), "Imenu"); - ewl_container_child_append (EWL_CONTAINER (vbox), misc); - ewl_widget_show (misc); + 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_menu_item_text_set(EWL_MENU_ITEM(item), menus[i].name); + + if (menus[i].image) + ewl_menu_item_image_set(EWL_MENU_ITEM(item), menus[i].image); + + ewl_container_child_append(EWL_CONTAINER(misc), item); + ewl_widget_show(item); + } - item = ewl_menu_item_new (); - ewl_menu_item_text_set(EWL_MENU_ITEM(item), "dia-diagram.png"); - ewl_menu_item_image_set(EWL_MENU_ITEM(item), "image"); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - item = ewl_separator_new (); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - item = ewl_menu_item_new (); - ewl_menu_item_text_set(EWL_MENU_ITEM(item), "label"); - 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_hseparator_new(); + ewl_container_child_append(EWL_CONTAINER(vbox), misc); + ewl_widget_show(misc); - misc = ewl_menu_new (); + misc = ewl_menu_new(); ewl_menu_item_text_set(EWL_MENU_ITEM(misc), "Menu"); - ewl_container_child_append (EWL_CONTAINER (vbox), misc); - ewl_widget_show (misc); + 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_menu_item_text_set(EWL_MENU_ITEM(item), menus[i].name); + + if (menus[i].image) + ewl_menu_item_image_set(EWL_MENU_ITEM(item), menus[i].image); + + ewl_container_child_append(EWL_CONTAINER(misc), item); + ewl_widget_show(item); + } - item = ewl_menu_item_new (); - ewl_menu_item_image_set(EWL_MENU_ITEM(item), "dia-diagram.png"); - ewl_menu_item_text_set(EWL_MENU_ITEM(item), "image"); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - item = ewl_separator_new (); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - item = ewl_menu_item_new (); - ewl_menu_item_text_set(EWL_MENU_ITEM(item), "label"); - 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_combo_new ("Combo entry"); - ewl_container_child_append (EWL_CONTAINER (vbox), misc); - ewl_widget_show (misc); - - item = ewl_menu_item_new (); - ewl_menu_item_image_set(EWL_MENU_ITEM(item), "dia-diagram.png"); - ewl_menu_item_text_set(EWL_MENU_ITEM(item), "image"); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - item = ewl_separator_new (); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - item = ewl_menu_item_new (); - ewl_menu_item_text_set(EWL_MENU_ITEM(item), "label"); - ewl_container_child_append (EWL_CONTAINER (misc), item); - ewl_widget_show (item); - - ewl_notebook_page_append (EWL_NOTEBOOK(notebook), tab, vbox); - - /* Fourth page: List/tree */ - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), "List & tree"); - ewl_widget_show (tab); + misc = ewl_hseparator_new(); + ewl_container_child_append(EWL_CONTAINER(vbox), misc); + ewl_widget_show(misc); + + 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_menu_item_text_set(EWL_MENU_ITEM(item), menus[i].name); + + if (menus[i].image) + ewl_menu_item_image_set(EWL_MENU_ITEM(item), menus[i].image); + + ewl_container_child_append(EWL_CONTAINER(misc), item); + ewl_widget_show(item); + } - vbox = ewl_vbox_new (); - ewl_widget_show (vbox); + /* 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); - - ewl_notebook_page_append (EWL_NOTEBOOK(notebook), tab, vbox); - - /* Fifth page: Misc */ - tab = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(tab), "Misc"); - ewl_widget_show (tab); + item = ewl_tree_text_row_add(EWL_TREE(misc), EWL_ROW(item), str_col); - vbox = ewl_vbox_new (); - ewl_widget_show (vbox); - - misc = ewl_hpaned_new (); - ewl_container_child_append (EWL_CONTAINER (vbox), misc); - ewl_widget_show (misc); + /* 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); + 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); + ewl_widget_show(item); - misc = ewl_hseparator_new (); - 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_button_new(); ewl_button_label_set(EWL_BUTTON(misc), "Tooltip"); - ewl_container_child_append (EWL_CONTAINER (vbox), misc); - ewl_widget_show (misc); - - ewl_notebook_page_append (EWL_NOTEBOOK(notebook), tab, vbox); + ewl_container_child_append(EWL_CONTAINER(vbox), misc); + ewl_attach_tooltip_text_set(misc, "blah blah blah"); + ewl_widget_show(misc); + + return notebook; } void __create_theme_test_window(Ewl_Widget * w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { - Ewl_Widget *theme_win; - Ewl_Widget *hbox; - Ewl_Widget *vbox; - Ewl_Widget *list; - Ewl_Widget *row; - Ewl_Widget *misc; - DIR *rep; + Ewl_Widget *theme_win, *hbox, *vbox, *list, *misc; + DIR *rep; struct dirent *lecture; - char *name; - char *list_header; - int len; - - theme_win = ewl_window_new (); - ewl_window_title_set (EWL_WINDOW(theme_win), "Theme Viewer Test"); - ewl_window_name_set (EWL_WINDOW(theme_win), "EWL Test Application"); - ewl_window_class_set (EWL_WINDOW(theme_win), "EFL Test Application"); - ewl_callback_append (theme_win, - EWL_CALLBACK_DELETE_WINDOW, - EWL_CALLBACK_FUNCTION (__destroy_theme_test_window), - NULL); + + theme_win = ewl_window_new(); + ewl_window_title_set(EWL_WINDOW(theme_win), "Theme Viewer Test"); + ewl_window_name_set(EWL_WINDOW(theme_win), "EWL Test Application"); + ewl_window_class_set(EWL_WINDOW(theme_win), "EFL Test Application"); + ewl_callback_append(theme_win, EWL_CALLBACK_DELETE_WINDOW, + __destroy_theme_test_window, NULL); + ewl_widget_show(theme_win); if (w) - ewl_callback_append (theme_win, - EWL_CALLBACK_DELETE_WINDOW, - EWL_CALLBACK_FUNCTION (__destroy_theme_test_window), - NULL); + ewl_callback_append(theme_win, EWL_CALLBACK_DELETE_WINDOW, + __destroy_theme_test_window, NULL); else - ewl_callback_append (theme_win, - EWL_CALLBACK_DELETE_WINDOW, - EWL_CALLBACK_FUNCTION (__close_main_window), - NULL); - - hbox = ewl_hbox_new (); - ewl_object_fill_policy_set (EWL_OBJECT(hbox), - EWL_FLAG_FILL_SHRINK); - ewl_container_child_append (EWL_CONTAINER (theme_win), hbox); - ewl_widget_show (hbox); - - list_header = "Theme name"; - list = ewl_tree_new (1); - ewl_tree_headers_set (EWL_TREE (list), &list_header); - ewl_object_padding_set (EWL_OBJECT (list), 6, 3, 6, 6); - ewl_object_fill_policy_set (EWL_OBJECT(list), - EWL_FLAG_FILL_SHRINK); - ewl_container_child_append (EWL_CONTAINER (hbox), list); - ewl_widget_show (list); + ewl_callback_append(theme_win, EWL_CALLBACK_DELETE_WINDOW, + __close_main_window, NULL); + + hbox = ewl_hpaned_new(); + ewl_container_child_append(EWL_CONTAINER(theme_win), hbox); + ewl_widget_show(hbox); + + /* the theme list tree */ + list = ewl_border_new(); + ewl_border_text_set(EWL_BORDER(list), "Theme name"); + ewl_container_child_append(EWL_CONTAINER(hbox), list); + ewl_widget_show(list); - rep = opendir (theme_list_dir); + rep = opendir(THEME_DIR); while ((lecture = readdir(rep))) { + char *name; + int len; + name = lecture->d_name; - len = strlen (name); - if ((len >= 4) && (strcmp (name + len - 4, ".edj") == 0)) { - char *str; - - str = malloc(len - 3); - if (str) { - snprintf(str, len - 3, "%s", name); - row = ewl_tree_text_row_add(EWL_TREE (list), - NULL, &str); - ewl_callback_append(row, - EWL_CALLBACK_CLICKED, - EWL_CALLBACK_FUNCTION(__select_theme), - NULL); - free (str); - } + 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, + __select_theme, strdup(name)); + ewl_container_child_append(EWL_CONTAINER(list), w); + ewl_widget_show(w); } } - misc = ewl_vseparator_new (); - ewl_container_child_append (EWL_CONTAINER (hbox), misc); - ewl_widget_show (misc); - - vbox = ewl_vbox_new (); - ewl_object_padding_set (EWL_OBJECT (vbox), 3, 6, 6, 6); - ewl_container_child_append (EWL_CONTAINER (hbox), vbox); - ewl_widget_show (vbox); - - misc = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(misc), "Theme Visualization"); - ewl_object_alignment_set (EWL_OBJECT (misc), EWL_FLAG_ALIGN_CENTER); - ewl_object_fill_policy_set(EWL_OBJECT (misc), EWL_FLAG_FILL_NONE); - ewl_container_child_append (EWL_CONTAINER (vbox), misc); - ewl_widget_show (misc); - - widgets_build (); - ewl_container_child_append (EWL_CONTAINER (vbox), notebook); - ewl_widget_show (notebook); - - ewl_widget_show (theme_win); + vbox = ewl_border_new(); + ewl_border_text_set(EWL_BORDER(vbox), "Theme Visualization"); + ewl_container_child_append(EWL_CONTAINER(hbox), vbox); + ewl_widget_show(vbox); + + misc = widgets_build(); + ewl_container_child_append(EWL_CONTAINER(vbox), misc); + ewl_widget_show(misc); } ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs