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; }
/** * @internal * @param c: The container to work with * @param w: The widget to work with * @return Returns no value * @brief The child add callback */ void ewl_notebook_cb_child_add(Ewl_Container *c, Ewl_Widget *w) { Ewl_Notebook *n; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(c); DCHECK_PARAM_PTR(w); DCHECK_TYPE(c, EWL_CONTAINER_TYPE); DCHECK_TYPE(w, EWL_WIDGET_TYPE); n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent); /* stick a null tab in there so that it at least shows up */ ewl_notebook_page_tab_widget_set(n, w, NULL); /* we have no current page, make it this one */ if (!n->cur_page) { ewl_notebook_visible_page_set(n, w); ewl_widget_show(w); } DLEAVE_FUNCTION(DLEVEL_STABLE); }
/** * @param n: The Ewl_Notebook to set the tab text in * @param page: The page to associate the tab text too * @param text: The text to set in the tab * @return Returns no value. * @brief Set the text of the tab for the page @p page to the text @p text */ void ewl_notebook_page_tab_text_set(Ewl_Notebook *n, Ewl_Widget *page, const char *text) { Ewl_Widget *t = NULL; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(n); DCHECK_PARAM_PTR(page); DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE); DCHECK_TYPE(page, EWL_WIDGET_TYPE); if (text) { t = ewl_label_new(); ewl_label_text_set(EWL_LABEL(t), text); ewl_widget_show(t); } ewl_notebook_page_tab_widget_set(n, page, t); DLEAVE_FUNCTION(DLEVEL_STABLE); }