static int test_label_set_get(char *buf, int len) { Ewl_Widget *border; int ret = 0; border = ewl_border_new(); if (ewl_border_label_get(EWL_BORDER(border))) LOG_FAILURE(buf, len, "default border label set"); else { const char *label; ewl_border_label_set(EWL_BORDER(border), "label value"); label = ewl_border_label_get(EWL_BORDER(border)); if (label && !strcmp(label, "label value")) ret = 1; else LOG_FAILURE(buf, len, "border label doesn't match"); } ewl_widget_destroy(border); return ret; }
static int test_label_position_set_get(char *buf, int len) { Ewl_Widget *border; unsigned int pos; int ret = 0; border = ewl_border_new(); pos = ewl_border_label_position_get(EWL_BORDER(border)); if (pos != EWL_POSITION_TOP) { LOG_FAILURE(buf, len, "default border label position wrong"); goto POSITION_ERROR; } ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_LEFT); pos = ewl_border_label_position_get(EWL_BORDER(border)); if (pos != EWL_POSITION_LEFT) { LOG_FAILURE(buf, len, "border label position not left"); goto POSITION_ERROR; } ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_RIGHT); pos = ewl_border_label_position_get(EWL_BORDER(border)); if (pos != EWL_POSITION_RIGHT) { LOG_FAILURE(buf, len, "border label position not right"); goto POSITION_ERROR; } ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_BOTTOM); pos = ewl_border_label_position_get(EWL_BORDER(border)); if (pos != EWL_POSITION_BOTTOM) { LOG_FAILURE(buf, len, "border label position not bottom"); goto POSITION_ERROR; } ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_TOP); pos = ewl_border_label_position_get(EWL_BORDER(border)); if (pos != EWL_POSITION_TOP) { LOG_FAILURE(buf, len, "border label position not top"); goto POSITION_ERROR; } ret = 1; POSITION_ERROR: ewl_widget_destroy(border); return ret; }
static int test_constructor(char *buf, int len) { Ewl_Widget *b; int ret = 0; b = ewl_border_new(); if (!EWL_BORDER_IS(b)) { LOG_FAILURE(buf, len, "returned border widget is not of the" " type border"); goto DONE; } if (!!strcmp(ewl_widget_appearance_get(b), EWL_BORDER_TYPE)) { LOG_FAILURE(buf, len, "border has wrong appearance"); goto DONE; } if (!ewl_border_label_position_get(EWL_BORDER(b)) == EWL_POSITION_TOP) { LOG_FAILURE(buf, len, "the label position of the border " "is wrong"); goto DONE; } if (ewl_widget_focusable_get(b)) { LOG_FAILURE(buf, len, "border widget is focusable"); goto DONE; } ret = 1; DONE: ewl_widget_destroy(b); return ret; }
static int create_test(Ewl_Container *box) { int i; const Freebox_Test fbtests[] = { { "Manual Placement", EWL_FREEBOX_LAYOUT_MANUAL, NULL }, { "Auto Placement", EWL_FREEBOX_LAYOUT_AUTO, NULL }, { "Comparator Placement (by name)", EWL_FREEBOX_LAYOUT_COMPARATOR, ewl_freebox_cb_compare }, { NULL, EWL_FREEBOX_LAYOUT_AUTO, NULL } }; srand(time(NULL)); ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_ALL); for (i = 0; fbtests[i].name != NULL; i++) { Ewl_Widget *border, *hbox, *fb, *pane, *o; border = ewl_border_new(); ewl_border_label_set(EWL_BORDER(border), (char *)fbtests[i].name); ewl_object_fill_policy_set(EWL_OBJECT(border), EWL_FLAG_FILL_FILL); ewl_container_child_append(EWL_CONTAINER(box), border); ewl_widget_show(border); /* nest the freebox in a scrollpane */ pane = ewl_scrollpane_new(); ewl_container_child_append(EWL_CONTAINER(border), pane); ewl_widget_show(pane); /* create a freebox of the type for this test */ fb = ewl_freebox_new(); ewl_freebox_layout_type_set(EWL_FREEBOX(fb), fbtests[i].type); if (fbtests[i].compare) { ewl_freebox_comparator_set(EWL_FREEBOX(fb), fbtests[i].compare); sort_fb = fb; } ewl_container_child_append(EWL_CONTAINER(pane), fb); ewl_widget_show(fb); /* pack controls for the freebox */ hbox = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(border), hbox); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_TOP); ewl_widget_show(hbox); o = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(o), "Add items"); ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP); ewl_container_child_append(EWL_CONTAINER(hbox), o); ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_freebox_cb_add, fb); ewl_widget_show(o); o = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(o), "Clear items"); ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP); ewl_container_child_append(EWL_CONTAINER(hbox), o); ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_freebox_cb_clear, fb); ewl_widget_show(o); } return 1; }
eth_panel* ethpanel_create(main_window* win) { Ewl_Widget *hbox,*grid; Ewl_Widget *label; eth_panel* pnl; pnl=(eth_panel*)malloc((unsigned int)sizeof(eth_panel)); pnl->interface = NULL; pnl->win = win; pnl->frame = ewl_border_new(); pnl->apply = 0; ewl_border_label_set(EWL_BORDER(pnl->frame),"hehe"); ewl_widget_show(pnl->frame); pnl->box_configuration = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(pnl->frame), pnl->box_configuration); ewl_widget_show(pnl->box_configuration); ewl_object_fill_policy_set(EWL_OBJECT(pnl->box_configuration), EWL_FLAG_FILL_HFILL); ewl_object_alignment_set(EWL_OBJECT(pnl->box_configuration),EWL_FLAG_ALIGN_LEFT); //######################################### //## box_configuration: box_activate ## //######################################### pnl->box_activate = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), pnl->box_activate); pnl->btn_activate = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(pnl->btn_activate),_("Activate")); ewl_object_fill_policy_set(EWL_OBJECT(pnl->btn_activate), EWL_FLAG_FILL_SHRINK); pnl->btn_deactivate = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(pnl->btn_deactivate),_("Deactivate")); ewl_object_fill_policy_set(EWL_OBJECT(pnl->btn_deactivate), EWL_FLAG_FILL_SHRINK); ewl_container_child_append(EWL_CONTAINER(pnl->box_activate), pnl->btn_deactivate); ewl_container_child_append(EWL_CONTAINER(pnl->box_activate), pnl->btn_activate); ewl_widget_show(pnl->btn_activate); ewl_widget_show(pnl->btn_deactivate); ewl_widget_show(pnl->box_activate); ewl_callback_append(pnl->btn_activate, EWL_CALLBACK_CLICKED, ethpanel_btn_activate_clicked_cb, pnl); ewl_callback_append(pnl->btn_deactivate, EWL_CALLBACK_CLICKED, ethpanel_btn_deactivate_clicked_cb, pnl); //################################################### //## box_configuration: check list (static / dhcp) ## //################################################### hbox = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), hbox); pnl->check_static = ewl_radiobutton_new(); ewl_button_label_set(EWL_BUTTON(pnl->check_static),_("Static address")); pnl->check_dhcp = ewl_radiobutton_new(); ewl_button_label_set(EWL_BUTTON(pnl->check_dhcp),_("DHCP (Automatic configuration)")); ewl_radiobutton_chain_set(EWL_RADIOBUTTON(pnl->check_dhcp), EWL_RADIOBUTTON(pnl->check_static)); ewl_container_child_append(EWL_CONTAINER(hbox), pnl->check_static); ewl_container_child_append(EWL_CONTAINER(hbox), pnl->check_dhcp); ewl_widget_show(hbox); ewl_widget_show(pnl->check_dhcp); ewl_widget_show(pnl->check_static); ewl_callback_append(pnl->check_static, EWL_CALLBACK_CLICKED, ethpanel_set_static_dhcp_clicked_cb, pnl); ewl_callback_append(pnl->check_dhcp, EWL_CALLBACK_CLICKED, ethpanel_set_static_dhcp_clicked_cb, pnl); //################################### //## box_configuration: Entry list ## //################################### pnl->entry_ip = ewl_entry_new(); ewl_object_fill_policy_set(EWL_OBJECT(pnl->entry_ip), EWL_FLAG_FILL_FILL); ewl_object_alignment_set(EWL_OBJECT(pnl->entry_ip),EWL_FLAG_ALIGN_LEFT); pnl->entry_mask = ewl_entry_new(); pnl->entry_gateway = ewl_entry_new(); pnl->entry_cmd = ewl_entry_new(); ewl_callback_append(pnl->entry_ip, EWL_CALLBACK_KEY_UP, ethpanel_textchanged_entry_cb, pnl); ewl_callback_append(pnl->entry_mask, EWL_CALLBACK_KEY_UP, ethpanel_textchanged_entry_cb, pnl); ewl_callback_append(pnl->entry_gateway, EWL_CALLBACK_KEY_UP, ethpanel_textchanged_entry_cb, pnl); grid = ewl_grid_new(); ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), grid); ewl_object_fill_policy_set(EWL_OBJECT(grid), EWL_FLAG_FILL_HFILL); ewl_grid_dimensions_set(EWL_GRID(grid), 2, 5); ewl_grid_column_relative_w_set(EWL_GRID(grid), 0, 0.20); label = ewl_label_new(); ewl_label_text_set(EWL_LABEL(label),_("Ip address: ")); ewl_container_child_append(EWL_CONTAINER(grid), label); ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_ip); ewl_widget_show(label); ewl_widget_show(pnl->entry_ip); label = ewl_label_new(); ewl_label_text_set(EWL_LABEL(label),_("Network mask: ")); ewl_container_child_append(EWL_CONTAINER(grid), label); ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_mask); ewl_widget_show(label); ewl_widget_show(pnl->entry_mask); label = ewl_label_new(); ewl_label_text_set(EWL_LABEL(label),_("Gateway: ")); ewl_container_child_append(EWL_CONTAINER(grid), label); ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_gateway); ewl_widget_show(label); ewl_widget_show(pnl->entry_gateway); pnl->lbl_cmd = ewl_label_new(); ewl_label_text_set(EWL_LABEL(pnl->lbl_cmd),_("Command: ")); ewl_container_child_append(EWL_CONTAINER(grid), pnl->lbl_cmd); ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_cmd); ewl_widget_show(pnl->lbl_cmd); ewl_widget_show(pnl->entry_cmd); ewl_widget_show(grid); //##################################### //## box_configuration: Apply button ## //##################################### hbox = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), hbox); pnl->btn_apply = ewl_button_new(); ewl_stock_type_set(EWL_STOCK(pnl->btn_apply), EWL_STOCK_APPLY); ewl_object_fill_policy_set(EWL_OBJECT(pnl->btn_apply), EWL_FLAG_FILL_SHRINK); ewl_container_child_append(EWL_CONTAINER(hbox), pnl->btn_apply); ewl_widget_show(pnl->btn_apply); ewl_widget_show(hbox); ewl_callback_append(pnl->btn_apply, EWL_CALLBACK_CLICKED, ethpanel_btn_apply_clicked_cb, pnl); //######################################## //## box_configuration: hbox_pbar ## //######################################## pnl->hbox_pbar = ewl_hbox_new(); pnl->pbar = ewl_progressbar_new(); ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), pnl->hbox_pbar); ewl_container_child_append(EWL_CONTAINER(pnl->hbox_pbar), pnl->pbar); ewl_progressbar_label_set(EWL_PROGRESSBAR(pnl->pbar), APPLY_TEXT); ewl_range_unknown_set(EWL_RANGE(pnl->pbar), TRUE); ewl_widget_show(pnl->pbar); ewl_widget_show(pnl->hbox_pbar); return pnl; }
void ewl_frontend_dialog_config_open(Eli_App * eap) { Ewl_Widget * o; Ewl_Widget * border_box; Ewl_Widget * hbox; Ewl_Widget * vbox; Ewl_Widget * main_box; Ewl_Widget * radio_b[2]; /* one open config dialog should be enough */ if (conf_win) return; /* Setup and show the configuration window */ conf_win = ewl_dialog_new(); ewl_dialog_action_position_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM); ewl_window_title_set(EWL_WINDOW(conf_win), _("Configuration")); ewl_window_name_set(EWL_WINDOW(conf_win), "Elitaire"); ewl_window_class_set(EWL_WINDOW(conf_win), "Elitaire"); ewl_window_leader_foreign_set(EWL_WINDOW(conf_win), EWL_EMBED_WINDOW(eap->main_win)); ewl_callback_append(conf_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL); ewl_dialog_has_separator_set(EWL_DIALOG(conf_win), 1); ewl_object_fill_policy_set(EWL_OBJECT(conf_win), EWL_FLAG_FILL_NONE); ewl_widget_show(conf_win); /* the main_box contain the border_boxes */ ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP); main_box = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(conf_win), main_box); ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER); ewl_widget_show(main_box); /* Setup and show the stock icons */ ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM); o = ewl_button_new(); ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL); ewl_container_child_append(EWL_CONTAINER(conf_win), o); ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb, conf_win); ewl_widget_show(o); o = ewl_button_new(); ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY); ewl_container_child_append(EWL_CONTAINER(conf_win), o); ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb, conf_win); ewl_widget_show(o); o = ewl_button_new(); ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK); ewl_container_child_append(EWL_CONTAINER(conf_win), o); ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb, conf_win); ewl_widget_show(o); /* *** Graphic Box *** */ /* Setup and show the border box */ border_box = ewl_border_new(); ewl_border_label_set(EWL_BORDER(border_box), _("Graphic")); ewl_container_child_append(EWL_CONTAINER(main_box), border_box); //ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_HFILL); ewl_widget_show(border_box); /* Setup and show the checkbuttons */ o = ewl_checkbutton_new(); ewl_button_label_set(EWL_BUTTON(o), _("animated movements")); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT); ewl_widget_show(o); config.animations = ecore_config_boolean_get("/graphic/animations"); ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.animations); ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL); o = ewl_checkbutton_new(); ewl_button_label_set(EWL_BUTTON(o), _("shadows")); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT); ewl_widget_show(o); config.shadows = ecore_config_boolean_get("/graphic/shadows"); ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.shadows); ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL); /* Setup and show the velocity label and seeker */ hbox = ewl_grid_new(); ewl_container_child_append(EWL_CONTAINER(border_box), hbox); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL); ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1); ewl_widget_show(hbox); o = ewl_label_new(); ewl_label_text_set(EWL_LABEL(o), _("velocity:")); 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_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_widget_show(o); config.vel_label = o; o = ewl_hseeker_new(); config.velocity = ecore_config_int_get("velocity"); ewl_range_minimum_value_set(EWL_RANGE(o), 200.0); ewl_range_maximum_value_set(EWL_RANGE(o), 800.0); ewl_range_step_set(EWL_RANGE(o), 60.0); ewl_range_value_set(EWL_RANGE(o), (double) config.velocity); ewl_widget_name_set(o, "velocity"); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL); _hseeker_cb(o, NULL, NULL); ewl_widget_show(o); /* Setup and show the frame_rate label and seeker */ hbox = ewl_grid_new(); ewl_container_child_append(EWL_CONTAINER(border_box), hbox); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL); ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1); ewl_widget_show(hbox); o = ewl_label_new(); ewl_label_text_set(EWL_LABEL(o), _("frame rate:")); 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_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_widget_show(o); config.frt_label = o; o = ewl_hseeker_new(); config.frame_rate = ecore_config_int_get("frame_rate"); ewl_range_minimum_value_set(EWL_RANGE(o), 10.0); ewl_range_maximum_value_set(EWL_RANGE(o), 100.0); ewl_range_step_set(EWL_RANGE(o), 10.0); ewl_range_value_set(EWL_RANGE(o), (double) config.frame_rate); ewl_widget_name_set(o, "frame_rate"); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL); _hseeker_cb(o, NULL, NULL); ewl_widget_show(o); /* *** Lazy Box *** */ vbox = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(main_box), vbox); ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_NORMAL); ewl_widget_show(vbox); border_box = ewl_border_new(); ewl_container_child_append(EWL_CONTAINER(vbox), border_box); ewl_border_label_set(EWL_BORDER(border_box), _("Laziness")); ewl_widget_show(border_box); /* the radio buttons */ config.lazy = ecore_config_int_get("lazy"); radio_b[0] = ewl_radiobutton_new(); ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("normal mode")); ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT); ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]); ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected, NULL); ewl_widget_show(radio_b[0]); radio_b[1] = ewl_radiobutton_new(); ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("lazy mode")); ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]); ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT); ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]), EWL_RADIOBUTTON(radio_b[0])); ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected, NULL); ewl_widget_show(radio_b[1]); if (config.lazy) ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1); else ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1); /* *** Render Box *** */ /* Setup and show the border box */ border_box = ewl_border_new(); ewl_border_label_set(EWL_BORDER(border_box), _("Render Engine")); ewl_container_child_append(EWL_CONTAINER(vbox), border_box); ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL); ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER); ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP); ewl_widget_show(border_box); o = ewl_text_new(); ewl_text_text_set(EWL_TEXT(o), _("Changes only affect after new start")); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_widget_show(o); /* the radio buttons */ config.gl = ecore_config_boolean_get("/graphic/gl"); radio_b[0] = ewl_radiobutton_new(); ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("Software")); ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]); ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT); ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected, NULL); ewl_widget_show(radio_b[0]); radio_b[1] = ewl_radiobutton_new(); ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("OpenGL (testing)")); ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]); ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT); ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]), EWL_RADIOBUTTON(radio_b[0])); ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected, NULL); ewl_widget_show(radio_b[1]); if (config.gl) ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1); else ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1); }
static int test_label_alignment_set_get(char *buf, int len) { Ewl_Widget *border; int align; int req_align; int ret = 0; border = ewl_border_new(); align = ewl_border_label_alignment_get(EWL_BORDER(border)); if (align != EWL_FLAG_ALIGN_LEFT) { LOG_FAILURE(buf, len, "default border label alignment wrong"); goto POSITION_ERROR; } req_align = (EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_RIGHT | EWL_FLAG_ALIGN_BOTTOM | EWL_FLAG_ALIGN_TOP | EWL_FLAG_ALIGN_CENTER); while (req_align >= 0) { ewl_border_label_alignment_set(EWL_BORDER(border), req_align); align = ewl_border_label_alignment_get(EWL_BORDER(border)); if (align != req_align) { LOG_FAILURE(buf, len, "border label alignment %x does not " "match requested %x", align, req_align); goto POSITION_ERROR; } --req_align; } ewl_border_label_alignment_set(EWL_BORDER(border), EWL_FLAG_ALIGN_RIGHT); align = ewl_border_label_alignment_get(EWL_BORDER(border)); if (align != EWL_FLAG_ALIGN_RIGHT) { LOG_FAILURE(buf, len, "border label alignment not right"); goto POSITION_ERROR; } ewl_border_label_alignment_set(EWL_BORDER(border), EWL_FLAG_ALIGN_BOTTOM); align = ewl_border_label_alignment_get(EWL_BORDER(border)); if (align != EWL_FLAG_ALIGN_BOTTOM) { LOG_FAILURE(buf, len, "border label alignment not bottom"); goto POSITION_ERROR; } ewl_border_label_alignment_set(EWL_BORDER(border), EWL_FLAG_ALIGN_TOP); align = ewl_border_label_alignment_get(EWL_BORDER(border)); if (align != EWL_FLAG_ALIGN_TOP) { LOG_FAILURE(buf, len, "border label alignment not top"); goto POSITION_ERROR; } ret = 1; POSITION_ERROR: ewl_widget_destroy(border); return ret; }