static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *statusbar = NULL, *button = NULL, *hbox = NULL;

        statusbar = ewl_statusbar_new();
        ewl_container_child_append(EWL_CONTAINER(box), statusbar);
        ewl_statusbar_left_hide(EWL_STATUSBAR(statusbar));
        ewl_widget_show(statusbar);

        button_push_cb(NULL, NULL, statusbar);

        hbox = ewl_hbox_new();
        ewl_container_child_append(EWL_CONTAINER(box), hbox);
        ewl_widget_show(hbox);

        button = ewl_button_new();
        ewl_button_label_set(EWL_BUTTON(button), "push");
        ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_push_cb,
                                                                statusbar);
        ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
        ewl_container_child_append(EWL_CONTAINER(hbox), button);
        ewl_widget_show(button);

        button = ewl_button_new();
        ewl_button_label_set(EWL_BUTTON(button), "pop");
        ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_pop_cb,
                                                                statusbar);
        ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE);
        ewl_container_child_append(EWL_CONTAINER(hbox), button);
        ewl_widget_show(button);

        return 1;
}
Example #2
0
/**
 * @param w: the overlay to be initialized to default values and callbacks
 * @return Returns TRUE or FALSE depending on if initialization succeeds.
 * @brief initialize a overlay to default values and callbacks
 *
 * Sets the values and callbacks of a overlay @a w to their defaults.
 */
int
ewl_overlay_init(Ewl_Overlay *w)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(w, FALSE);

        /*
         * Initialize the fields of the inherited container class
         */
        if (!ewl_container_init(EWL_CONTAINER(w)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_appearance_set(EWL_WIDGET(w), EWL_OVERLAY_TYPE);
        ewl_widget_inherit(EWL_WIDGET(w), EWL_OVERLAY_TYPE);

        ewl_container_show_notify_set(EWL_CONTAINER(w),
                                        ewl_overlay_cb_child_show);
        ewl_container_resize_notify_set(EWL_CONTAINER(w),
                                        ewl_overlay_cb_child_resize);

        ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);

        /*
         * Override the default configure callbacks since the overlay
         * has special needs for placement.
         */
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
                             ewl_overlay_cb_configure, NULL);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #3
0
/**
 * @param p: the popup to initialize
 * @return Returns TRUE on success, FALSE on failure.
 * @brief Initialize the popup and inherited fields
 *
 * Clears the contents of the popup and stores the
 * default values.
 */
int
ewl_popup_init(Ewl_Popup *p)
{
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(p, FALSE);

        w = EWL_WIDGET(p);
        if (!ewl_window_init(EWL_WINDOW(w)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_inherit(w, EWL_POPUP_TYPE);
        ewl_widget_appearance_set(w, EWL_POPUP_TYPE);
        ewl_object_fill_policy_set(EWL_OBJECT(p), EWL_FLAG_FILL_NONE);

        ewl_window_override_set(EWL_WINDOW(p), TRUE);

        ewl_container_show_notify_set(EWL_CONTAINER(p),
                                        ewl_popup_cb_child_show);
        ewl_container_resize_notify_set(EWL_CONTAINER(p),
                                        ewl_popup_cb_child_resize);

        /*
         * add the callbacks
         */
        ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_popup_cb_show, NULL);
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_popup_cb_show, NULL);
        ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, ewl_popup_cb_mouse_move,
                                                                        NULL);
        ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_popup_cb_destroy,
                                                                        NULL);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #4
0
/**
 * @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);
}
static int 
test_initial_size_after_remove_get(char *buf, int len)
{
        Ewl_Widget *paned;
        Ewl_Widget *child;
        int ret = 1;
        int val;

        /* use a hpaned here to cover this up */
        paned = ewl_hpaned_new();
        child = ewl_cell_new();

        ewl_container_child_append(EWL_CONTAINER(paned), child);
        ewl_paned_initial_size_set(EWL_PANED(paned), child, 240);
        ewl_container_child_remove(EWL_CONTAINER(paned), child);
        val = ewl_paned_initial_size_get(EWL_PANED(paned), child);

        if (val != 0) {
                LOG_FAILURE(buf, len, "get value is not zero");
                ret = 0;
        }

        ewl_widget_destroy(child);
        ewl_widget_destroy(paned);

        return ret;
}
Example #6
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);
}
Example #7
0
Ewl_Widget *
widget_new( char *name )
{
	Ewler_Widget *w;

	if( !name )
		return NULL;

	w = spec_new( name );
	if( !w || !w->w )
		return NULL;

	w->selected = false;
	
	ewl_callback_append(w->w, EWL_CALLBACK_REALIZE, realize, w);
	ewl_callback_append(w->w, EWL_CALLBACK_CONFIGURE, configure, w);
	ewl_widget_show(w->w);

	w->bg = ewl_vbox_new();
	w->bg->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
	ewl_widget_appearance_set(w->bg, "select_bg");
	ewl_theme_data_str_set(w->bg, "/select_bg/file", EWLER_EET);
	ewl_theme_data_str_set(w->bg, "/select_bg/group", "select_bg");
	ewl_object_fill_policy_set(EWL_OBJECT(w->bg), EWL_FLAG_FILL_NONE);
	ewl_widget_data_set(w->bg, "EWLER_WIDGET", w);
	ewl_container_child_append(EWL_CONTAINER(w->bg), w->w);
	ewl_widget_show(w->bg);

	w->fg = ewl_vbox_new();
	w->fg->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
	ewl_widget_appearance_set(w->fg, "select_fg");
	ewl_theme_data_str_set(w->fg, "/select_fg/file", EWLER_EET);
	ewl_theme_data_str_set(w->fg, "/select_fg/group", "select_fg");
	ewl_callback_append(w->fg, EWL_CALLBACK_CONFIGURE, fg_configure, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_REALIZE, fg_realize, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_FOCUS_IN, fg_mouse_in, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_FOCUS_OUT, fg_mouse_out, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_DOWN, fg_mouse_down, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_UP, fg_mouse_up, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_MOVE, fg_mouse_move, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_DESTROY, widget_destroy, w);
	ewl_object_fill_policy_set(EWL_OBJECT(w->fg), EWL_FLAG_FILL_NONE);
	ewl_widget_data_set(w->fg, "EWLER_WIDGET", w);
	ewl_container_child_append(EWL_CONTAINER(w->fg), w->bg);
	ewl_widget_show(w->fg);

	w->selectable = true;
	w->configured = false;

	return w->fg;
}
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;
}
Example #9
0
/**
 * popup menu for managing files in the project
 */
static EWL_CALLBACK_DEFN(project_file_menu)
{
	Ewl_Widget *item;
	Ewl_Event_Mouse_Up *ev = ev_data;

	if( file_menu ) {
		ewl_widget_destroy(file_menu);
		file_menu = NULL;
	} else if( ev->button == 3 ) {
		ewl_window_raise(EWL_WINDOW(project_win));

		file_menu = ewl_imenu_new(NULL, "File Options");
		ewl_object_position_request(EWL_OBJECT(file_menu), ev->x, ev->y);
		ewl_object_fill_policy_set(EWL_OBJECT(file_menu), EWL_FLAG_FILL_NONE);
		ewl_container_child_append(EWL_CONTAINER(project_win), file_menu);
		ewl_callback_append(file_menu, EWL_CALLBACK_CONFIGURE,
												project_file_menu_configure, NULL);
		ewl_callback_call(file_menu, EWL_CALLBACK_SELECT);
		ewl_widget_show(file_menu);

		item = ewl_menu_item_new(NULL, "Save");
		/* HACK FOR NON-STRING DATA HASHES */
		item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
		ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_SAVE);
		ewl_callback_append(item, EWL_CALLBACK_SELECT,
												project_file_menu_cb, user_data);
		ewl_container_child_append(EWL_CONTAINER(file_menu), item);
		ewl_widget_show(item);

		item = ewl_menu_item_new(NULL, "Settings...");
		/* HACK FOR NON-STRING DATA HASHES */
		item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
		ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_SETTINGS);
		ewl_callback_append(item, EWL_CALLBACK_SELECT,
												project_file_menu_cb, user_data);
		ewl_container_child_append(EWL_CONTAINER(file_menu), item);
		ewl_widget_show(item);

		item = ewl_menu_item_new(NULL, "Delete");
		/* HACK FOR NON-STRING DATA HASHES */
		item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
		ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_DELETE);
		ewl_callback_append(item, EWL_CALLBACK_SELECT,
												project_file_menu_cb, user_data);
		ewl_container_child_append(EWL_CONTAINER(file_menu), item);
		ewl_widget_show(item);
	}
}
static int 
test_initial_size_many_get(char *buf, int len)
{
        Ewl_Widget *paned;
        Ewl_Widget *w[4];
        int ret = 1, i;

        /* use a vpaned here to cover this up */
        paned = ewl_vpaned_new();

        /* build the children and set the initial size for them */
        for (i = 0; i < 4; i++) {
                w[i] = ewl_cell_new();
                ewl_container_child_append(EWL_CONTAINER(paned), w[i]);
                ewl_paned_initial_size_set(EWL_PANED(paned), w[i], 240 + i);
        }

        /* now check the set values */
        for (i = 0; i < 4; i++) {
                int val = ewl_paned_initial_size_get(EWL_PANED(paned), w[i]);

                if (val != 240 + i) {
                        LOG_FAILURE(buf, len, "get value is not zero");
                        ret = 0;
                        break;
                }
        }

        ewl_widget_destroy(paned);

        return ret;
}
Example #11
0
/**
 * @param t: the toolbar to initialize
 * @return Returns TRUE on success, FALSE on failure.
 * @brief Initialize the toolbar and inherited fields
 *
 * Clears the contents of the toolbar and stores the
 * default values.
 */
int
ewl_toolbar_init(Ewl_Toolbar *t)
{
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(t, FALSE);

        w = EWL_WIDGET(t);
        if (!ewl_menubar_init(EWL_MENUBAR(t)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_inherit(w, EWL_TOOLBAR_TYPE);
        ewl_widget_appearance_set(w, "htoolbar");

        ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL |
                                                  EWL_FLAG_FILL_SHRINKABLE);
        ewl_object_alignment_set(EWL_OBJECT(t), EWL_FLAG_ALIGN_LEFT |
                                                        EWL_FLAG_ALIGN_TOP);

        ewl_container_add_notify_set(EWL_CONTAINER(EWL_MENUBAR(t)->inner_box),
                                        ewl_toolbar_cb_child_add);
        t->hidden = EWL_ICON_PART_NONE;

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #12
0
/**
 * @param menu: The menu to setup
 * @param info: The info to set into the menu
 * @return Returns no value
 * @brief Initializes @a menu with @a info
 */
void
ewl_menu_from_info(Ewl_Menu *menu, Ewl_Menu_Info *info)
{
        int i;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(menu);
        DCHECK_PARAM_PTR(info);
        DCHECK_TYPE(menu, EWL_MENU_TYPE);

        for (i = 0; info[i].name != NULL; i++)
        {
                Ewl_Widget *item;

                item = ewl_menu_item_new();
                ewl_button_label_set(EWL_BUTTON(item), info[i].name);
                ewl_button_image_set(EWL_BUTTON(item), info[i].img, NULL);
                ewl_container_child_append(EWL_CONTAINER(menu), item);

                if (info[i].cb)
                        ewl_callback_append(item, EWL_CALLBACK_CLICKED,
                                                        info[i].cb, NULL);
                ewl_widget_show(item);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Example #13
0
int
inspector_init( void )
{
	char *header[] = {"Attribute", "Value"};

	if( inspector_win )
		return -1;

	name_spec = spec_elem_get("Ewl_Widget", "name");

	inspector_win = ewl_window_new();
	ewl_window_title_set(EWL_WINDOW(inspector_win), "Inspector");
	ewl_object_size_request(EWL_OBJECT(inspector_win), 200, 320);
	ewl_callback_append(inspector_win, EWL_CALLBACK_DELETE_WINDOW,
											inspector_toggle, NULL);

	tree = ewl_tree_new(2);
	ewl_tree_headers_set(EWL_TREE(tree), header);
	ewl_tree_mode_set(EWL_TREE(tree), EWL_TREE_MODE_NONE);
	ewl_container_child_append(EWL_CONTAINER(inspector_win), tree);
	ewl_widget_show(tree);

	ewl_widget_show(inspector_win);

	return 0;
}
Example #14
0
/**
 * @param n: The Ewl_Notebook to set the tab into
 * @param page: The page to associate the tab with
 * @param tab: The contents of the tab
 * @return Returns no value.
 * @brief Set the widget to use as the tab for the page @p page to widget @p tab
 */
void
ewl_notebook_page_tab_widget_set(Ewl_Notebook *n, Ewl_Widget *page,
                                                        Ewl_Widget *tab)
{
        Ewl_Widget *t;

        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 (!tab)
        {
                tab = ewl_label_new();
                ewl_widget_show(tab);
        }

        t = ewl_attach_widget_association_get(page);
        if (!t)
        {
                int idx = 0;

                t = ewl_hbox_new();
                ewl_widget_appearance_set(t, "tab");
                ewl_attach_widget_association_set(page, t);
                ewl_attach_widget_association_set(t, page);
                ewl_widget_show(t);

                ewl_callback_append(t, EWL_CALLBACK_CLICKED,
                                        ewl_notebook_cb_tab_clicked, n);

                idx = ewl_container_child_index_get(EWL_CONTAINER(n), page);
		ewl_container_child_insert(EWL_CONTAINER(n->body.tabbar), t,
                                idx);
        }
        else
                ewl_container_reset(EWL_CONTAINER(t));

        /* if this is the current page set it's tab to selected */
        if (n->cur_page == page)
                ewl_widget_state_add(t, EWL_STATE_SELECTED);

        ewl_container_child_append(EWL_CONTAINER(t), tab);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Example #15
0
/**
 * @param menu: the menu to initialize
 * @return Returns no value.
 * @brief Initialize an internal menu to starting values
 */
int
ewl_menu_init(Ewl_Menu *menu)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(menu, FALSE);

        /*
         * Initialize the defaults of the inherited fields.
         */
        if (!ewl_menu_item_init(EWL_MENU_ITEM(menu)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_appearance_set(EWL_WIDGET(menu), "menu_container");
        ewl_widget_inherit(EWL_WIDGET(menu), EWL_MENU_TYPE);

        /*
         * add the callbacks
         */
        ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_MOUSE_MOVE,
                            ewl_menu_cb_mouse_move, NULL);
        ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_FOCUS_IN,
                            ewl_menu_cb_expand, NULL);
        ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CLICKED,
                            ewl_menu_cb_expand, NULL);
        ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CONFIGURE,
                            ewl_menu_cb_configure, NULL);
        ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_DESTROY,
                                ewl_menu_cb_destroy, NULL);

        /*
         * Create the popup menu portion of the widget.
         */
        menu->popup = ewl_context_menu_new();
        ewl_popup_follow_set(EWL_POPUP(menu->popup), EWL_WIDGET(menu));
        ewl_popup_type_set(EWL_POPUP(menu->popup),
                                        EWL_POPUP_TYPE_MENU_VERTICAL);
        ewl_widget_internal_set(menu->popup, TRUE);
        ewl_widget_appearance_set(EWL_WIDGET(menu->popup), EWL_MENU_TYPE);

        /* redirect the menu container to the popup menu */
        ewl_container_redirect_set(EWL_CONTAINER(menu),
                                        EWL_CONTAINER(menu->popup));
        ewl_callback_prepend(menu->popup, EWL_CALLBACK_DESTROY,
                                ewl_menu_cb_popup_destroy, menu);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #16
0
/**
 * @param d: dialog to change the icon
 * @param theme_icon: the name of the theme icon
 * @return Returns no value.
 * @brief Changes the icon of the dialog. 
 *
 * Changes the icon to the given string. @p theme_icon can be any icon that
 * is defined in the ewl_theme_icon.h file.  If @p theme_icon is @c NULL
 * no icon will be create or an existing icon will be destroyed.
 */
void
ewl_icondialog_icon_set(Ewl_Icondialog *d, const char *theme_icon)
{
        const char *image;
        int size;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(d);
        DCHECK_TYPE(d, EWL_ICONDIALOG_TYPE);

        /* 
         * if there is no icon destroy the existing one and we are done
         */
        if (!theme_icon)
        {
                if (d->icon)
                        ewl_widget_destroy(d->icon);
                DRETURN(DLEVEL_STABLE);
        }

        /* get the size from the theme or set a default value */
        size = ewl_theme_data_int_get(EWL_WIDGET(d), "icon_size");
        if (!size) size = 64;

        /* get the file for the image */
        image = ewl_icon_theme_icon_path_get(theme_icon, size);
        if (!image)
                DRETURN(DLEVEL_STABLE);

        /* and finally create the icon */
        d->icon = ewl_image_new();
        ewl_image_file_set(EWL_IMAGE(d->icon), image, NULL);
        ewl_object_minimum_size_set(EWL_OBJECT(d->icon), size, size);
        
        /* we need to reset the container redirect before we can add the icon */
        ewl_container_redirect_set(EWL_CONTAINER(d->dialog.vbox), NULL);
        ewl_container_child_prepend(EWL_CONTAINER(d->dialog.vbox), d->icon);
        ewl_container_redirect_set(EWL_CONTAINER(d->dialog.vbox), 
                                        EWL_CONTAINER(d->vbox));

        ewl_widget_show(d->icon);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Example #17
0
int
tools_init( void )
{
	Ewl_Widget *vbox, *button, *image;

	if( tools_win )
		return -1;

	tools_win = ewl_window_new();
	ewl_window_title_set(EWL_WINDOW(tools_win), "Tools");
	ewl_object_size_request(EWL_OBJECT(tools_win), 200, 320);
	ewl_callback_append(tools_win, EWL_CALLBACK_DELETE_WINDOW,
											tools_toggle, NULL);

	vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(tools_win), vbox);

	button = ewl_button_new(NULL);
	ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
	ewl_object_insets_set(EWL_OBJECT(button), 0, 0, 0, 0);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, tools_click, "Ewl_Text");
	ewl_container_child_append(EWL_CONTAINER(vbox), button);

	image = ewl_image_new(EWLER_IMAGE_DIR"/text-small.png", "text");
	ewl_container_child_append(EWL_CONTAINER(button), image);
	ewl_widget_show(image);

	ewl_widget_show(button);

	button = ewl_button_new(NULL);
	ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
	ewl_object_insets_set(EWL_OBJECT(button), 0, 0, 0, 0);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, tools_click, "Ewl_Entry");
	ewl_container_child_append(EWL_CONTAINER(vbox), button);

	image = ewl_image_new(EWLER_IMAGE_DIR"/entry-small.png", "entry");
	ewl_container_child_append(EWL_CONTAINER(button), image);
	ewl_widget_show(image);

	ewl_widget_show(button);

	button = ewl_button_new(NULL);
	ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
	ewl_object_insets_set(EWL_OBJECT(button), 0, 0, 0, 0);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, tools_click, "Ewl_Border");
	ewl_container_child_append(EWL_CONTAINER(vbox), button);

	image = ewl_image_new(EWLER_IMAGE_DIR"/border-small.png", "border");
	ewl_container_child_append(EWL_CONTAINER(button), image);
	ewl_widget_show(image);

	ewl_widget_show(button);

	ewl_widget_show(vbox);
	
	ewl_widget_show(tools_win);

	return 0;
}
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *datepicker;

        datepicker = ewl_datepicker_new();
        ewl_container_child_append(EWL_CONTAINER(box), datepicker);
        ewl_widget_show(datepicker);

        return 1;
}
Example #19
0
/**
 * @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);
}
Example #20
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);
}
Example #21
0
/**
 * @param sp: The Ewl_Spectrum to init
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes an Ewl_Specturm widget to default values
 */
int
ewl_spectrum_init(Ewl_Spectrum *sp)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(sp, FALSE);

        if (!ewl_container_init(EWL_CONTAINER(sp)))
        {
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }

        ewl_widget_appearance_set(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE);
        ewl_widget_inherit(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE);
        ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_FILL);
        ewl_container_callback_intercept(EWL_CONTAINER(sp),
                                        EWL_CALLBACK_MOUSE_MOVE);
        ewl_container_callback_intercept(EWL_CONTAINER(sp),
                                        EWL_CALLBACK_MOUSE_DOWN);
        ewl_container_callback_intercept(EWL_CONTAINER(sp),
                                        EWL_CALLBACK_MOUSE_UP);

        ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_DOWN,
                                ewl_spectrum_cb_mouse_down, NULL);
        ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_UP,
                                ewl_spectrum_cb_mouse_up, NULL);

        sp->type = EWL_SPECTRUM_TYPE_SQUARE;

        /* create the canvas */
        sp->canvas = ewl_image_new();
        ewl_container_child_append(EWL_CONTAINER(sp), sp->canvas);
        ewl_object_fill_policy_set(EWL_OBJECT(sp->canvas), EWL_FLAG_FILL_FILL);
        ewl_widget_internal_set(sp->canvas, TRUE);
        ewl_callback_append(EWL_WIDGET(sp->canvas), EWL_CALLBACK_REVEAL,
                                ewl_spectrum_canvas_cb_reveal, sp);
        ewl_widget_show(sp->canvas);

        /* create the cross hairs to draw on the spectrum */
        sp->cross_hairs.horizontal = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.horizontal);
        ewl_widget_internal_set(sp->cross_hairs.horizontal, TRUE);
        ewl_widget_layer_priority_set(sp->cross_hairs.horizontal, 1);

        sp->cross_hairs.vertical = ewl_vseparator_new();
        ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.vertical);
        ewl_widget_internal_set(sp->cross_hairs.vertical, TRUE);
        ewl_widget_layer_priority_set(sp->cross_hairs.vertical, 1);

        ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_CONFIGURE,
                        ewl_spectrum_cb_configure, NULL);

        ewl_spectrum_rgb_set(sp, 255, 255, 255);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #22
0
static void
eke_gui_ewl_manage_feed_cb(Ewl_Widget *w, void *ev, void *data)
{
    Eke *eke;
    Ewl_Widget *win, *box, *button;

    eke = data;

    win = ewl_dialog_new(EWL_POSITION_BOTTOM);
    ewl_window_title_set(EWL_WINDOW(win), PACKAGE " -- manage feeds");
    ewl_window_name_set(EWL_WINDOW(win), PACKAGE);
    ewl_window_class_set(EWL_WINDOW(win), PACKAGE);
    ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
                            eke_gui_ewl_manage_feed_exit_cb, win);
    ewl_widget_show(win);

    box = ewl_vbox_new();
    ewl_dialog_widget_add(EWL_DIALOG(win), box);
    ewl_widget_show(box);

    button = ewl_button_new("add feed");
    ewl_widget_data_set(button, "manage_feed_win", win);
    ewl_container_child_append(EWL_CONTAINER(box), button);
    ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
    ewl_callback_append(button, EWL_CALLBACK_CLICKED,
                                eke_gui_ewl_add_feed_cb, eke);
    ewl_widget_show(button);

    button = ewl_button_stock_with_id_new(EWL_STOCK_CANCEL,
                                            EWL_RESPONSE_CANCEL);
    ewl_container_child_append(EWL_CONTAINER(win), button);
    ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
    ewl_callback_append(button, EWL_CALLBACK_VALUE_CHANGED,
                                eke_gui_ewl_manage_feed_exit_cb, win);
    ewl_widget_show(button);

    return;
    w = NULL;
    ev = NULL;
}
Example #23
0
/**
 * spawn a dialog to alter the settings on a particular file
 */
static void
project_file_settings( char *name )
{
	Ewl_Widget *hbox, *vbox;
	Ewl_Widget *label, *entry, *button;

	if( settings_win )
		return;

	settings_win = ewl_dialog_new(EWL_POSITION_BOTTOM);
	if( !settings_win )
		return;

	hbox = ewl_hbox_new();
	ewl_dialog_widget_add(EWL_DIALOG(settings_win), hbox);
	
	vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(hbox), vbox);

	label = ewl_text_new("Object Name");
	ewl_container_child_append(EWL_CONTAINER(vbox), label);
	ewl_widget_show(label);

	label = ewl_text_new("File Name");
	ewl_container_child_append(EWL_CONTAINER(vbox), label);
	ewl_widget_show(label);

	ewl_widget_show(vbox);

	vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(hbox), vbox);

	entry = ewl_entry_new(name);
	ewl_container_child_append(EWL_CONTAINER(vbox), entry);
	ewl_widget_show(entry);
	file_settings.name_entry = entry;

	entry = ewl_entry_new(project_file_get(name));
	ewl_container_child_append(EWL_CONTAINER(vbox), entry);
	ewl_widget_show(entry);
	file_settings.path_entry = entry;

	ewl_widget_show(vbox);
	ewl_widget_show(hbox);

	button = ewl_dialog_button_add(EWL_DIALOG(settings_win),
																 EWL_STOCK_SAVE, EWL_RESPONSE_SAVE);
	ewl_callback_append(button, EWL_CALLBACK_VALUE_CHANGED,
											project_file_settings_cb, name);
	ewl_widget_show(button);

	button = ewl_dialog_button_add(EWL_DIALOG(settings_win),
																 EWL_STOCK_CANCEL, EWL_RESPONSE_CANCEL);
	ewl_callback_append(button, EWL_CALLBACK_VALUE_CHANGED,
											project_file_settings_cb, name);
	ewl_widget_show(button);

	ewl_widget_show(settings_win);
}
Example #24
0
/**
 * @param t: The toolbar to set the hidden part
 * @param part: The Ewl_Icon_Part to hide
 * @return Returns no value
 * @brief Hide the given icon part
 */
void
ewl_toolbar_icon_part_hide(Ewl_Toolbar *t, Ewl_Icon_Part part)
{
        Ewl_Widget *child;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(t);
        DCHECK_TYPE(t, EWL_TOOLBAR_TYPE);

        if (t->hidden == part)
                DRETURN(DLEVEL_STABLE);

        t->hidden = part;

        ewl_container_child_iterate_begin(EWL_CONTAINER(t));
        while ((child = ewl_container_child_next(EWL_CONTAINER(t)))) {
                if (EWL_ICON_IS(child))
                        ewl_icon_part_hide(EWL_ICON(child), part);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Example #25
0
/**
 * @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);
}
Example #26
0
static void
eke_gui_ewl_menu_setup(Eke *eke)
{
    Ewl_Widget *feed, *o;

    feed = ewl_menubar_menu_add(EWL_MENUBAR(eke->gui.ewl.menubar), 
                                                    NULL, "feeds");

    o = ewl_menu_item_new(NULL, "manage feeds");
    ewl_container_child_append(EWL_CONTAINER(feed), o);
    ewl_callback_append(o, EWL_CALLBACK_SELECT,
                                eke_gui_ewl_manage_feed_cb, eke);
    ewl_widget_show(o);
}
Example #27
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *cal;

        cal = ewl_calendar_new();
        ewl_container_child_append(EWL_CONTAINER(box), cal);
        ewl_callback_append(EWL_WIDGET(cal),
                        EWL_CALLBACK_VALUE_CHANGED, ewl_calendar_test,
                        cal);
        ewl_widget_show(cal);

        return 1;
}
Example #28
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);
    }
}
Example #29
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *vbox, *o;

        vbox = ewl_vbox_new();
        ewl_container_child_append(box, vbox);
        ewl_widget_show(vbox);

        o = ewl_button_new();
        ewl_button_label_set(EWL_BUTTON(o), "Launch modal window");
        ewl_container_child_append(EWL_CONTAINER(vbox), o);
        ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_click, NULL);
        ewl_widget_show(o);

        return 1;
}
Example #30
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *overlay;
        Ewl_Widget *img;
        Ewl_Widget *hist;

        overlay = ewl_overlay_new();
        ewl_container_child_append(EWL_CONTAINER(box), overlay);
        ewl_object_fill_policy_set(EWL_OBJECT(overlay), EWL_FLAG_FILL_ALL);
         ewl_callback_append(EWL_WIDGET(overlay), EWL_CALLBACK_CONFIGURE,
                        ewl_histogram_test_cb_configure, NULL);
        ewl_widget_show(overlay);

        img = ewl_image_new();
        ewl_image_file_path_set(EWL_IMAGE(img),
                                ewl_test_image_get("entrance.png"));
        ewl_image_proportional_set(EWL_IMAGE(img), TRUE);
        ewl_container_child_append(EWL_CONTAINER(overlay), img);
        ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL);
        ewl_widget_show(img);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_Y);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        return 1;
}