/** * @param b: the border container to initialize * @return Returns TRUE on success, FALSE on failure. * @brief Initialize a border container to default values */ int ewl_border_init(Ewl_Border *b) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(b, FALSE); w = EWL_WIDGET(b); if (!ewl_box_init(EWL_BOX(w))) { DRETURN_INT(FALSE, DLEVEL_STABLE); } ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_VERTICAL); ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL); ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE); ewl_widget_inherit(EWL_WIDGET(b), EWL_BORDER_TYPE); b->label = ewl_label_new(); ewl_widget_internal_set(b->label, TRUE); ewl_container_child_append(EWL_CONTAINER(b), b->label); ewl_widget_show(b->label); b->body = ewl_vbox_new(); ewl_widget_internal_set(b->body, TRUE); ewl_container_child_append(EWL_CONTAINER(b), b->body); ewl_widget_show(b->body); b->label_position = EWL_POSITION_TOP; ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body)); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param n: The Ewl_Notebook widget to initialize * @return Returns TRUE on success or NULL on failure. * @brief Initialize a notebook to default values and callbacks */ int ewl_notebook_init(Ewl_Notebook *n) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(n, FALSE); if (!ewl_box_init(EWL_BOX(n))) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_box_orientation_set(EWL_BOX(n), EWL_ORIENTATION_VERTICAL); ewl_widget_appearance_set(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE); ewl_widget_inherit(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE); n->tabbar_position = EWL_POSITION_TOP; n->body.tabbar = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar); ewl_object_fill_policy_set(EWL_OBJECT(n->body.tabbar), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar), EWL_FLAG_ALIGN_CENTER); ewl_widget_internal_set(n->body.tabbar, TRUE); ewl_widget_appearance_set(n->body.tabbar, "top/tabbar"); ewl_widget_show(n->body.tabbar); n->body.pages = ewl_vbox_new(); ewl_object_fill_policy_set(EWL_OBJECT(n->body.pages), EWL_FLAG_FILL_ALL); ewl_container_child_append(EWL_CONTAINER(n), n->body.pages); ewl_widget_internal_set(n->body.pages, TRUE); ewl_widget_layer_priority_set(n->body.pages, -1); ewl_widget_appearance_set(n->body.pages, "pages"); ewl_widget_show(n->body.pages); ewl_container_redirect_set(EWL_CONTAINER(n), EWL_CONTAINER(n->body.pages)); ewl_container_show_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_show); ewl_container_hide_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_hide); ewl_container_add_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_add); ewl_container_remove_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_remove); DRETURN_INT(TRUE, DLEVEL_STABLE); }
static int test_constructor(char *buf, int len) { Ewl_Widget *b; int ret = 0; b = ewl_box_new(); if (!EWL_BOX_IS(b)) { LOG_FAILURE(buf, len, "returned box is not of the type box"); goto DONE; } if (!ewl_box_orientation_get(EWL_BOX(b)) == EWL_ORIENTATION_HORIZONTAL) { LOG_FAILURE(buf, len, "button has a stock type set"); goto DONE; } if (ewl_widget_focusable_get(b)) { LOG_FAILURE(buf, len, "box is not focusable"); goto DONE; } ret = 1; DONE: ewl_widget_destroy(b); return ret; }
/** * @param b: The Ewl_Border to set the label position on * @param pos: The Ewl_Position to set on for the label. * @return Returns no value. * @brief Sets the position of the label in the border container */ void ewl_border_label_position_set(Ewl_Border *b, Ewl_Position pos) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(b); DCHECK_TYPE(b, EWL_BORDER_TYPE); if (b->label_position == pos) DRETURN(DLEVEL_STABLE); b->label_position = pos; switch (b->label_position) { case EWL_POSITION_LEFT: case EWL_POSITION_RIGHT: ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_HORIZONTAL); break; case EWL_POSITION_TOP: case EWL_POSITION_BOTTOM: default: ewl_box_orientation_set(EWL_BOX(b), EWL_ORIENTATION_VERTICAL); break; } ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE); /* need to remove the redirect so the label gets added back into the * border and not into the body. We put the redirect back on after */ ewl_container_redirect_set(EWL_CONTAINER(b), NULL); ewl_container_child_remove(EWL_CONTAINER(b), b->label); if ((b->label_position == EWL_POSITION_LEFT) || (b->label_position == EWL_POSITION_TOP)) ewl_container_child_prepend(EWL_CONTAINER(b), b->label); else ewl_container_child_append(EWL_CONTAINER(b), b->label); ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body)); ewl_widget_configure(EWL_WIDGET(b)); DLEAVE_FUNCTION(DLEVEL_STABLE); }
/** * @param n: The Ewl_Notebook to check for homogeneous * @return Returns the homgeneous value of the notebook @a n * @brief Retrieves the homogeneous value of the notebook **/ unsigned int ewl_notebook_tabbar_homogeneous_get(Ewl_Notebook *n) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(n, 0); DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, 0); DRETURN_INT(ewl_box_homogeneous_get(EWL_BOX(n->body.tabbar)), DLEVEL_STABLE); }
/** * @param n: The Ewl_Notebook to make homogeneous * @param h: Boolean value to set the notebook's homogeneous value * @return Returns no value * @brief Sets the tabs in the notebook to be the same size **/ void ewl_notebook_tabbar_homogeneous_set(Ewl_Notebook *n, unsigned int h) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(n); DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE); ewl_box_homogeneous_set(EWL_BOX(n->body.tabbar), !!h); DLEAVE_FUNCTION(DLEVEL_STABLE); }
/** * @param dialog: the icondialog to initialize. * @return Return TRUE on success, FALSE otherwise. * @brief Initialize an internal icondialog to starting values */ int ewl_icondialog_init(Ewl_Icondialog *dialog) { Ewl_Widget *w; Ewl_Widget *box; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(dialog, FALSE); w = EWL_WIDGET(dialog); if (!ewl_dialog_init(EWL_DIALOG(dialog))) { DRETURN_INT(FALSE, DLEVEL_STABLE); } ewl_widget_appearance_set(w, EWL_ICONDIALOG_TYPE); ewl_widget_inherit(w, EWL_ICONDIALOG_TYPE); /* get the parent vbox */ box = dialog->dialog.vbox; /* we need a hbox */ ewl_box_orientation_set(EWL_BOX(box), EWL_ORIENTATION_HORIZONTAL); /* * Setup a vertical box for the displayed window contents. */ dialog->vbox = ewl_vbox_new(); if (!dialog->vbox) { DRETURN_INT(FALSE, DLEVEL_STABLE); } ewl_container_child_append(EWL_CONTAINER(box), dialog->vbox); ewl_widget_internal_set(dialog->vbox, TRUE); ewl_object_fill_policy_set(EWL_OBJECT(dialog->vbox), EWL_FLAG_FILL_ALL); ewl_widget_show(dialog->vbox); ewl_container_redirect_set(EWL_CONTAINER(box), EWL_CONTAINER(dialog->vbox)); DRETURN_INT(TRUE, DLEVEL_STABLE); }
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); }
int main (int argc, char *argv[]) { Ecore_List *str_data = NULL; Ewl_Widget *window; Ewl_Widget *hbox; Ewl_Widget *list; Ewl_Model *model; Ewl_View *view; Ewl_Widget *dvi; Ewl_Widget *sp; const Edvi_Document *document; int page_count; int i; if (argc == 1) { printf ("Usage: %s dvi_file\n", argv[0]); return EXIT_FAILURE; } printf ("[DVI] version : %s\n", edvi_version_get ()); if (!edvi_init (300, "cx", 4, 1.0, 1.0, 0, 255, 255, 255, 0, 0, 0)) return EXIT_FAILURE; ewl_init (&argc, (char **)argv); str_data = ecore_list_new(); ecore_list_free_cb_set (str_data, free); /* We open the dvi file */ dvi = ewl_dvi_new (); if (!ewl_dvi_file_set (EWL_DVI (dvi), argv[1])) { printf ("Can not load the document %s\nExiting...", argv[1]); ecore_list_destroy (str_data); ewl_main_quit(); return EXIT_FAILURE; } window = ewl_window_new (); ewl_window_title_set (EWL_WINDOW (window), "Ewl Dvi Test Application"); ewl_callback_append (window, EWL_CALLBACK_DELETE_WINDOW, _quit_cb, str_data); hbox = ewl_hbox_new (); ewl_box_homogeneous_set (EWL_BOX (hbox), FALSE); ewl_container_child_append (EWL_CONTAINER (window), hbox); ewl_widget_show (hbox); sp = ewl_scrollpane_new (); ewl_container_child_append (EWL_CONTAINER (hbox), sp); ewl_widget_show (sp); document = ewl_dvi_dvi_document_get (EWL_DVI (dvi)); page_count = edvi_document_page_count_get (document); for (i = 0; i < page_count; i++) { char row_text[64]; char *txt; snprintf (row_text, 64, "%d", i + 1); txt = strdup (row_text); ecore_list_append(str_data, txt); } model = ewl_model_ecore_list_instance(); view = ewl_label_view_get(); list = ewl_list_new (); ewl_mvc_model_set(EWL_MVC(list), model); ewl_mvc_view_set(EWL_MVC(list), view); ewl_mvc_data_set(EWL_MVC(list), str_data); ewl_callback_append (list, EWL_CALLBACK_VALUE_CHANGED, EWL_CALLBACK_FUNCTION (_change_page_cb), dvi); ewl_container_child_append (EWL_CONTAINER (sp), list); ewl_widget_show (list); ewl_dvi_mag_set (EWL_DVI (dvi), 0.5); ewl_container_child_append (EWL_CONTAINER (hbox), dvi); ewl_widget_show (dvi); ewl_widget_show (window); ewl_main (); edvi_shutdown (); return EXIT_SUCCESS; }
/** * @param n: The Ewl_Notebook to set the tabbar position of * @param pos: The Ewl_Position to put the tabbar in * @return Returns no value. * @brief Set the position of the tabbar in the notebook widget */ void ewl_notebook_tabbar_position_set(Ewl_Notebook *n, Ewl_Position pos) { int t, pw, ph; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(n); DCHECK_TYPE(n, "notebook"); if (n->tabbar_position == pos) DRETURN(DLEVEL_STABLE); n->tabbar_position = pos; switch(pos) { case EWL_POSITION_LEFT: case EWL_POSITION_RIGHT: ewl_box_orientation_set(EWL_BOX(n), EWL_ORIENTATION_HORIZONTAL); ewl_box_orientation_set(EWL_BOX(n->body.tabbar), EWL_ORIENTATION_VERTICAL); t = ewl_object_preferred_w_get(EWL_OBJECT(n->body.tabbar)); ewl_object_preferred_size_get(EWL_OBJECT(n->body.pages), &pw, &ph); ewl_object_preferred_inner_size_set(EWL_OBJECT(n), t + pw, ph); break; case EWL_POSITION_TOP: case EWL_POSITION_BOTTOM: default: ewl_box_orientation_set(EWL_BOX(n), EWL_ORIENTATION_VERTICAL); ewl_box_orientation_set(EWL_BOX(n->body.tabbar), EWL_ORIENTATION_HORIZONTAL); t = ewl_object_preferred_h_get(EWL_OBJECT(n->body.tabbar)); ewl_object_preferred_size_get(EWL_OBJECT(n->body.pages), &pw, &ph); ewl_object_preferred_inner_size_set(EWL_OBJECT(n), pw, ph + t); break; } switch (pos) { case EWL_POSITION_LEFT: ewl_widget_appearance_set(n->body.tabbar, "left/tabbar"); break; case EWL_POSITION_RIGHT: ewl_widget_appearance_set(n->body.tabbar, "right/tabbar"); break; case EWL_POSITION_TOP: ewl_widget_appearance_set(n->body.tabbar, "top/tabbar"); break; case EWL_POSITION_BOTTOM: ewl_widget_appearance_set(n->body.tabbar, "bottom/tabbar"); break; } ewl_container_child_remove(EWL_CONTAINER(n), n->body.tabbar); /* remove the redirect so we can stick the tabbar back in */ ewl_container_redirect_set(EWL_CONTAINER(n), NULL); if ((n->tabbar_position == EWL_POSITION_RIGHT) || (n->tabbar_position == EWL_POSITION_BOTTOM)) ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar); else if ((n->tabbar_position == EWL_POSITION_LEFT) || (n->tabbar_position == EWL_POSITION_TOP)) ewl_container_child_prepend(EWL_CONTAINER(n), n->body.tabbar); ewl_container_redirect_set(EWL_CONTAINER(n), EWL_CONTAINER(n->body.pages)); DLEAVE_FUNCTION(DLEVEL_STABLE); }
* @return Returns no value * @brief The configure callback */ void ewl_menu_cb_configure(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { Ewl_Menu *menu; Ewl_Box *parent; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(w); DCHECK_TYPE(w, EWL_MENU_TYPE); menu = EWL_MENU(w); parent = EWL_BOX(menu->menubar_parent); if ((parent && (ewl_box_orientation_get(parent) == EWL_ORIENTATION_VERTICAL)) || EWL_MENU_ITEM(menu)->inmenu) ewl_popup_type_set(EWL_POPUP(menu->popup), EWL_POPUP_TYPE_MENU_HORIZONTAL); else ewl_popup_type_set(EWL_POPUP(menu->popup), EWL_POPUP_TYPE_MENU_VERTICAL); DLEAVE_FUNCTION(DLEVEL_STABLE); } /** * @internal
static int create_test(Ewl_Container *box) { Ewl_Widget *o, *o2, *hbox; hbox = ewl_hbox_new(); ewl_container_child_append(box, hbox); ewl_widget_show(hbox); o = ewl_icon_new(); ewl_box_orientation_set(EWL_BOX(o), EWL_ORIENTATION_HORIZONTAL); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_label_set(EWL_ICON(o), "Draw"); ewl_container_child_append(EWL_CONTAINER(hbox), o); ewl_widget_show(o); o = ewl_icon_new(); ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_label_set(EWL_ICON(o), "Fill None"); ewl_container_child_append(EWL_CONTAINER(hbox), o); ewl_widget_show(o); o = ewl_icon_new(); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_label_set(EWL_ICON(o), "Draw"); ewl_container_child_append(EWL_CONTAINER(hbox), o); ewl_widget_show(o); o = ewl_hseparator_new(); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_icon_new(); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)"); ewl_icon_editable_set(EWL_ICON(o), TRUE); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_hseparator_new(); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o2 = ewl_text_new(); ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set " "on it.\n\n That data is just \n" "text, but could\nbe any widget."); ewl_widget_show(o2); o = ewl_icon_new(); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_extended_data_set(EWL_ICON(o), o2); ewl_icon_label_set(EWL_ICON(o), "World"); ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_hseparator_new(); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_icon_new(); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed."); ewl_icon_label_compressed_set(EWL_ICON(o), TRUE); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_hseparator_new(); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_icon_new(); ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL); ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed."); ewl_icon_label_compressed_set(EWL_ICON(o), TRUE); ewl_icon_editable_set(EWL_ICON(o), TRUE); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_hseparator_new(); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); o = ewl_icon_new(); ewl_icon_alt_text_set(EWL_ICON(o), "Icon Alt Text"); ewl_container_child_append(EWL_CONTAINER(box), o); ewl_widget_show(o); return 1; }
int create_test(Ewl_Container *box) { Ewl_Widget *vbox[2], *hbox[3]; Ewl_Widget *vbox_button[2][3]; Ewl_Widget *hbox_button[2][3]; /* * Create the first horizontal box, this is positioned in the upper * left corner. */ hbox[0] = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(box), hbox[0]); ewl_widget_show(hbox[0]); /******************************************************************/ /* Create a box for holding the horizontal alignment test buttons */ /******************************************************************/ vbox[0] = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(hbox[0]), vbox[0]); ewl_widget_show(vbox[0]); /* * Create and setup the button that starts in the left position. */ vbox_button[0][0] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(vbox_button[0][0]), "Left"); ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][0]); ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][0]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][0]), EWL_FLAG_ALIGN_LEFT); ewl_callback_append(vbox_button[0][0], EWL_CALLBACK_CLICKED, toggle_child_horizontal_align, NULL); ewl_widget_show(vbox_button[0][0]); /* * Create and setup the button that starts in the center position. */ vbox_button[0][1] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(vbox_button[0][1]), "Center"); ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][1]); ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][1]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][1]), EWL_FLAG_ALIGN_CENTER); ewl_callback_append(vbox_button[0][1], EWL_CALLBACK_CLICKED, toggle_child_horizontal_align, NULL); ewl_widget_show(vbox_button[0][1]); /* * Create and setup the button that starts in the right position. */ vbox_button[0][2] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(vbox_button[0][2]), "Right"); ewl_container_child_append(EWL_CONTAINER(vbox[0]), vbox_button[0][2]); ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[0][2]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(vbox_button[0][2]), EWL_FLAG_ALIGN_RIGHT); ewl_callback_append(vbox_button[0][2], EWL_CALLBACK_CLICKED, toggle_child_horizontal_align, NULL); ewl_widget_show(vbox_button[0][2]); /****************************************************************/ /* Create a box for holding the Fill test buttons */ /****************************************************************/ vbox[1] = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(hbox[0]), vbox[1]); ewl_widget_show(vbox[1]); /* * Create and setup a button with no filling by default. */ vbox_button[1][0] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(vbox_button[1][0]), "None"); ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][0]); ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][0]), EWL_FLAG_FILL_NONE); ewl_box_orientation_set(EWL_BOX(vbox_button[1][0]), EWL_ORIENTATION_VERTICAL); ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][0])->label_object), EWL_FLAG_ALIGN_CENTER); ewl_callback_append(vbox_button[1][0], EWL_CALLBACK_CLICKED, toggle_child_fill, NULL); ewl_widget_show(vbox_button[1][0]); /* * Create and setup a button with filling by default. */ vbox_button[1][1] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(vbox_button[1][1]), "Fill"); ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][1]); ewl_box_orientation_set(EWL_BOX(vbox_button[1][1]), EWL_ORIENTATION_VERTICAL); ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][1]), EWL_FLAG_FILL_FILL); ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][1])->label_object), EWL_FLAG_ALIGN_CENTER); ewl_callback_append(vbox_button[1][1], EWL_CALLBACK_CLICKED, toggle_child_fill, NULL); ewl_widget_show(vbox_button[1][1]); /* * Create and setup a button with no filling by default. */ vbox_button[1][2] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(vbox_button[1][2]), "None"); ewl_container_child_append(EWL_CONTAINER(vbox[1]), vbox_button[1][2]); ewl_box_orientation_set(EWL_BOX(vbox_button[1][2]), EWL_ORIENTATION_VERTICAL); ewl_object_fill_policy_set(EWL_OBJECT(vbox_button[1][2]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(EWL_BUTTON(vbox_button[1][2])->label_object), EWL_FLAG_ALIGN_CENTER); ewl_callback_append(vbox_button[1][2], EWL_CALLBACK_CLICKED, toggle_child_fill, NULL); ewl_widget_show(vbox_button[1][2]); /****************************************************************/ /* Create a box for holding the vertical alignment test buttons */ /****************************************************************/ hbox[1] = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(box), hbox[1]); ewl_widget_show(hbox[1]); /* * Create and setup a button with top alignment by default. */ hbox_button[0][0] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(hbox_button[0][0]), "Top"); ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][0]); ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][0]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][0]), EWL_FLAG_ALIGN_TOP); ewl_callback_append(hbox_button[0][0], EWL_CALLBACK_CLICKED, toggle_child_vertical_align, NULL); ewl_widget_show(hbox_button[0][0]); /* * Create and setup a button with center alignment by default. */ hbox_button[0][1] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(hbox_button[0][1]), "Center"); ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][1]); ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][1]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][1]), EWL_FLAG_ALIGN_CENTER); ewl_callback_append(hbox_button[0][1], EWL_CALLBACK_CLICKED, toggle_child_vertical_align, NULL); ewl_widget_show(hbox_button[0][1]); /* * Create and setup a button with bottom alignment by default. */ hbox_button[0][2] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(hbox_button[0][2]), "Bottom"); ewl_container_child_append(EWL_CONTAINER(hbox[1]), hbox_button[0][2]); ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[0][2]), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(hbox_button[0][2]), EWL_FLAG_ALIGN_BOTTOM); ewl_callback_append(hbox_button[0][2], EWL_CALLBACK_CLICKED, toggle_child_vertical_align, NULL); ewl_widget_show(hbox_button[0][2]); /****************************************************************/ /* Create a box for holding the Shrink test buttons */ /****************************************************************/ hbox[2] = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(box), hbox[2]); ewl_object_fill_policy_set(EWL_OBJECT(hbox[2]), EWL_FLAG_FILL_HFILL); ewl_widget_show(hbox[2]); /* * Create and setup a button with no filling by default. */ hbox_button[1][0] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(hbox_button[1][0]), "Shrink This Box To Fit It's Parent"); ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][0]), EWL_FLAG_FILL_HSHRINK); ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][0]); ewl_callback_append(hbox_button[1][0], EWL_CALLBACK_CLICKED, toggle_child_shrink, NULL); ewl_widget_show(hbox_button[1][0]); /* * Create and setup a button with shrinking by default. */ hbox_button[1][1] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(hbox_button[1][1]), "Shrink This Box To Fit It's Parent"); ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][1]), EWL_FLAG_FILL_HSHRINK); ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][1]); ewl_callback_append(hbox_button[1][1], EWL_CALLBACK_CLICKED, toggle_child_shrink, NULL); ewl_widget_show(hbox_button[1][1]); /* * Create and setup a button with no filling by default. */ hbox_button[1][2] = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(hbox_button[1][2]), "Don't shrink this box at all"); ewl_object_fill_policy_set(EWL_OBJECT(hbox_button[1][2]), EWL_FLAG_FILL_NONE); ewl_container_child_append(EWL_CONTAINER(hbox[2]), hbox_button[1][2]); ewl_callback_append(hbox_button[1][2], EWL_CALLBACK_CLICKED, toggle_child_shrink, NULL); ewl_widget_show(hbox_button[1][2]); return 1; }