static int test_constructor(char *buf, int len) { Ewl_Widget *notebook; int ret = 0; notebook = ewl_notebook_new(); if (!EWL_NOTEBOOK_IS(notebook)) LOG_FAILURE(buf, len, "returned widget is not of the type " EWL_NOTEBOOK_TYPE); else if (ewl_notebook_tabbar_alignment_get(EWL_NOTEBOOK(notebook)) != EWL_FLAG_ALIGN_CENTER) LOG_FAILURE(buf, len, "tabbar is not center aligned"); else if (ewl_notebook_tabbar_position_get(EWL_NOTEBOOK(notebook)) != EWL_POSITION_TOP) LOG_FAILURE(buf, len, "tabbar is not on the top"); else if (!ewl_notebook_tabbar_visible_get(EWL_NOTEBOOK(notebook))) LOG_FAILURE(buf, len, "tabbar is not visible"); else if (ewl_notebook_tabbar_homogeneous_get(EWL_NOTEBOOK(notebook))) LOG_FAILURE(buf, len, "tabbar is homogeneous"); else ret = 1; ewl_widget_destroy(notebook); return ret; }
general_panel* generalpanel_create(main_window *win) { Ewl_Widget *vbox, *label; general_panel* pnl; pnl=malloc(sizeof(general_panel)); pnl->win = win; vbox = ewl_vbox_new(); pnl->frame = vbox; pnl->notebook = ewl_notebook_new(); ewl_container_child_append(EWL_CONTAINER(vbox), pnl->notebook); pnl->dns = dnspanel_create(); pnl->boot = bootpanel_create(win); pnl->about = aboutpanel_create(); label = ewl_label_new(); ewl_label_text_set(EWL_LABEL(label), _("DNS (Dynamic Name Server)")); ewl_widget_show(label); ewl_container_child_append(EWL_CONTAINER(pnl->notebook), pnl->dns->frame); ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(pnl->notebook) ,pnl->dns->frame, label); label = ewl_label_new(); ewl_label_text_set(EWL_LABEL(label), _("Boot process")); ewl_widget_show(label); ewl_container_child_append(EWL_CONTAINER(pnl->notebook), pnl->boot->frame); ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(pnl->notebook) ,pnl->boot->frame, label); label = ewl_label_new(); ewl_label_text_set(EWL_LABEL(label), _("About")); ewl_widget_show(label); ewl_container_child_append(EWL_CONTAINER(pnl->notebook), pnl->about->frame); ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(pnl->notebook) ,pnl->about->frame, label); ewl_widget_show(pnl->frame); ewl_widget_show(pnl->notebook); ewl_widget_show(pnl->about->frame); ewl_widget_show(label); return pnl; }
void eke_gui_ewl_create(Eke *eke) { Ewl_Widget *box, *body; eke->gui.ewl.win = ewl_window_new(); ewl_window_title_set(EWL_WINDOW(eke->gui.ewl.win), PACKAGE); ewl_window_class_set(EWL_WINDOW(eke->gui.ewl.win), PACKAGE); ewl_window_name_set(EWL_WINDOW(eke->gui.ewl.win), PACKAGE); ewl_object_size_request(EWL_OBJECT(eke->gui.ewl.win), EKE_GUI_WIDTH, EKE_GUI_HEIGHT); ewl_callback_append(eke->gui.ewl.win, EWL_CALLBACK_DELETE_WINDOW, eke_gui_ewl_exit_cb, NULL); ewl_widget_show(eke->gui.ewl.win); box = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(eke->gui.ewl.win), box); ewl_widget_show(box); eke->gui.ewl.menubar = ewl_hmenubar_new(); ewl_container_child_append(EWL_CONTAINER(box), eke->gui.ewl.menubar); ewl_widget_show(eke->gui.ewl.menubar); eke_gui_ewl_menu_setup(eke); body = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(box), body); ewl_widget_show(body); eke->gui.ewl.notebook = ewl_notebook_new(); ewl_container_child_append(EWL_CONTAINER(body), eke->gui.ewl.notebook); ewl_notebook_tabs_position_set(EWL_NOTEBOOK(eke->gui.ewl.notebook), EWL_POSITION_LEFT); ewl_notebook_tabs_alignment_set(EWL_NOTEBOOK(eke->gui.ewl.notebook), EWL_FLAG_ALIGN_TOP); ewl_widget_show(eke->gui.ewl.notebook); eke->gui.ewl.statusbar = ewl_statusbar_new(); ewl_container_child_append(EWL_CONTAINER(box), eke->gui.ewl.statusbar); ewl_widget_show(eke->gui.ewl.statusbar); }
void ecrin_ewl_window_create (void) { Ewl_Widget *window; Ewl_Widget *hbox; Ewl_Widget *notebook; Ewl_Widget *tab; Ewl_Widget *vbox; Ewl_Widget *separator; /* We order the list */ sorted_keys = _list_keys_order (ecrin_hash_keys_get ()); window = ewl_window_new (); ewl_object_size_request (EWL_OBJECT (window), 400, 400); ewl_window_title_set (EWL_WINDOW (window), "Ecrin"); ewl_window_name_set (EWL_WINDOW (window), "Ecrin"); ewl_window_class_set (EWL_WINDOW (window), "Ecrin"); ewl_callback_append (window, EWL_CALLBACK_DELETE_WINDOW, _main_window_close, NULL); hbox = ewl_hbox_new (); ewl_container_child_append (EWL_CONTAINER (window), hbox); ewl_widget_show (hbox); notebook = ewl_notebook_new (); ewl_container_child_append (EWL_CONTAINER (hbox), notebook); ewl_widget_show (notebook); tab = ewl_label_new ("EFL package"); ewl_widget_show (tab); tree = ewl_tree_new (1); ewl_tree_headers_visible_set (EWL_TREE (tree), 0); ewl_notebook_page_append (EWL_NOTEBOOK (notebook), tab, tree); ewl_widget_show (tree); tab = ewl_label_new ("Search"); ewl_widget_show (tab); vbox = ewl_vbox_new (); ewl_box_homogeneous_set (EWL_BOX (vbox), 0); ewl_notebook_page_append (EWL_NOTEBOOK (notebook), tab, vbox); ewl_widget_show (vbox); entry = ewl_entry_new (""); ewl_object_fill_policy_set(EWL_OBJECT(entry), EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL); ewl_container_child_append (EWL_CONTAINER (vbox), entry); ewl_callback_append (entry, EWL_CALLBACK_VALUE_CHANGED, _list_display_cb, NULL); ewl_widget_show (entry); separator = ewl_hseparator_new (); ewl_container_child_append (EWL_CONTAINER (vbox), separator); ewl_widget_show (separator); list = ewl_tree_new (1); ewl_tree_headers_visible_set (EWL_TREE (list), 0); ewl_container_child_append (EWL_CONTAINER (vbox), list); ewl_widget_show (list); separator = ewl_vseparator_new (); ewl_container_child_append (EWL_CONTAINER (hbox), separator); ewl_widget_show (separator); text = ewl_text_new (""); ewl_container_child_append (EWL_CONTAINER (hbox), text); ewl_widget_show (text); ecrin_ewl_tree_fill_package (); ecrin_ewl_list_fill_package (""); ewl_widget_show (window); }
static int test_visible_page(char *buf, int len) { Ewl_Widget *notebook; Ewl_Widget *w1, *w2, *w3; int ret = 0; notebook = ewl_notebook_new(); /* before every thing the visible page has to be NULL */ if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook))) { LOG_FAILURE(buf, len, "there is a visible page, although" " there is no page"); goto CLEANUP; } /* append the first widget */ w1 = ewl_cell_new(); ewl_container_child_append(EWL_CONTAINER(notebook), w1); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w1) { LOG_FAILURE(buf, len, "the visible page is not the newly " "added widget"); goto CLEANUP; } /* append the second widget */ w2 = ewl_cell_new(); ewl_container_child_append(EWL_CONTAINER(notebook), w2); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w1) { LOG_FAILURE(buf, len, "the visible page is not the first " "added widget"); goto CLEANUP; } /* prepend the third widget */ w3 = ewl_cell_new(); ewl_container_child_append(EWL_CONTAINER(notebook), w3); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w1) { LOG_FAILURE(buf, len, "the visible page is not the first " "added widget"); goto CLEANUP; } ewl_widget_destroy(w2); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w1) { LOG_FAILURE(buf, len, "the visible page is not the first " "added widget"); goto CLEANUP; } ewl_widget_destroy(w3); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w1) { LOG_FAILURE(buf, len, "the visible page is not the first " "added widget"); goto CLEANUP; } ewl_widget_destroy(w1); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook))) { LOG_FAILURE(buf, len, "there is a visible page, although " "the notebook is empty"); goto CLEANUP; } /* and now test the set function */ w1 = ewl_cell_new(); ewl_container_child_append(EWL_CONTAINER(notebook), w1); w2 = ewl_cell_new(); ewl_container_child_prepend(EWL_CONTAINER(notebook), w2); w3 = ewl_cell_new(); ewl_container_child_append(EWL_CONTAINER(notebook), w3); ewl_notebook_visible_page_set(EWL_NOTEBOOK(notebook), w2); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w2) { LOG_FAILURE(buf, len, "the visible page is not the second " "added widget"); goto CLEANUP; } ewl_notebook_visible_page_set(EWL_NOTEBOOK(notebook), w3); if (ewl_notebook_visible_page_get(EWL_NOTEBOOK(notebook)) != w3) { LOG_FAILURE(buf, len, "the visible page is not the third " "added widget"); goto CLEANUP; } ret = 1; CLEANUP: ewl_widget_destroy(notebook); return ret; }