예제 #1
0
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;
}
예제 #2
0
/**
 * @internal
 * @param c: The container to work with
 * @param w: The widget to work with
 * @param rem_idx: UNUSED
 * @return Returns no value
 * @brief The child remove callback
 */
void
ewl_notebook_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx)
{
        Ewl_Widget *t;
        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);

        /* we still have a tab, delete it */
        t = ewl_attach_widget_association_get(w);
        if (t)
                ewl_widget_destroy(t);


        /* change visible pages if needed */
        if (w == n->cur_page)
        {
                Ewl_Widget *page, *new_tab;
                int count;

                count = ewl_container_child_count_get(
                                                EWL_CONTAINER(n->body.tabbar));

                if (count <= 0)
                        n->cur_page = NULL;
                else
                {
                        /* make sure we aren't off the end of the list */
                        if (idx >= count) idx = count - 1;

                        new_tab = ewl_container_child_get(
                                        EWL_CONTAINER(n->body.tabbar), idx);

                        if (new_tab)
                        {
                                page = ewl_attach_widget_association_get(
                                                                new_tab);
                                if (page)
                                        ewl_notebook_visible_page_set(
                                                        EWL_NOTEBOOK(n), page);
                        }
                }

        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
예제 #3
0
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;
}
예제 #4
0
/**
 * @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);
}
예제 #5
0
void
eke_gui_ewl_feed_change(Eke *eke, Eke_Feed *feed)
{
    Eke_Gui_Ewl_Feed *disp;
    Eke_Feed_Item *item;
    Ewl_Widget *o;

    disp = ecore_hash_get(eke->feeds, feed);
    if (!disp->tab) {
        Ewl_Widget *o;

        disp->tab = ewl_text_new(feed->title);
        ewl_widget_show(disp->tab);

        o = ewl_vbox_new();
        ewl_notebook_page_append(EWL_NOTEBOOK(eke->gui.ewl.notebook),
                                                        disp->tab, o);
        ewl_widget_show(o);

        disp->page = ewl_scrollpane_new();
        ewl_container_child_append(EWL_CONTAINER(o), disp->page);
        ewl_object_insets_set(EWL_OBJECT(disp->page), 5, 5, 5, 5);
        ewl_widget_show(disp->page);
    }
    ewl_container_reset(EWL_CONTAINER(disp->page));

    ecore_list_first_goto(feed->items);
    while ((item = ecore_list_next(feed->items)) != NULL) {
        o = ewl_text_new(NULL);
        ewl_text_wrap_set(EWL_TEXT(o), 1);
        ewl_text_style_set(EWL_TEXT(o), "soft_shadow");
        ewl_text_text_set(EWL_TEXT(o), item->title);
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);

        if (item->link) {
            o = ewl_text_new(item->link);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        if (item->desc) {
            o = ewl_text_new(item->desc);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        o = ewl_text_new(" ");
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);
    }
}
예제 #6
0
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);
}
예제 #7
0
/**
 * @internal
 * @param c: The container to work with
 * @param w: The widget to work with
 * @return Returns no value
 * @brief The child hide callback
 */
void
ewl_notebook_cb_child_hide(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);

        if (n->cur_page == w)
                ewl_widget_show(w);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
예제 #8
0
/**
 * @return Returns a newly allocated notebook on success. NULL on failure
 * @brief Create a new notebook widget
 */
Ewl_Widget *
ewl_notebook_new(void)
{
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);

        w = NEW(Ewl_Notebook, 1);
        if (!w)
                DRETURN_PTR(NULL, DLEVEL_STABLE);

        if (!ewl_notebook_init(EWL_NOTEBOOK(w)))
        {
                ewl_widget_destroy(w);
                DRETURN_PTR(NULL, DLEVEL_STABLE);
        }

        DRETURN_PTR(w, DLEVEL_STABLE);
}
예제 #9
0
/**
 * @internal
 * @param c: The container to work with
 * @param w: The widget to work with
 * @return Returns no value
 * @brief The child show callback
 */
void
ewl_notebook_cb_child_show(Ewl_Container *c, Ewl_Widget *w)
{
        Ewl_Notebook *n;
        int pw, ph;

        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);

        if (n->cur_page != w)
                ewl_widget_hide(w);

        ewl_object_preferred_size_get(EWL_OBJECT(n->cur_page), &pw, &ph);
        ewl_object_preferred_inner_size_set(EWL_OBJECT(n->body.pages), pw, ph);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
예제 #10
0
파일: gui_ewl.c 프로젝트: Limsik/e17
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);
}
예제 #11
0
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;
}