Ejemplo n.º 1
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);
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
/**
 * exit confirmation launcher, triggered by file->exit or window delete
 */
static EWL_CALLBACK_DEFN(project_exit)
{
	Ewl_Widget *text, *yes, *no;

	if( !active_project->dirty )
		ewler_shutdown();

	if( confirm_win )
		return;

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

	text = ewl_text_new("Project has not been saved, continue?");
	ewl_dialog_widget_add(EWL_DIALOG(confirm_win), text);
	ewl_widget_show(text);

	yes = ewl_dialog_button_add(EWL_DIALOG(confirm_win),
															EWL_STOCK_OK, EWL_RESPONSE_OK);
	ewl_button_label_set(EWL_BUTTON(yes), "Yes");
	ewl_callback_append(yes, EWL_CALLBACK_VALUE_CHANGED,
											project_exit_cb, NULL);
	ewl_widget_show(yes);

	no = ewl_dialog_button_add(EWL_DIALOG(confirm_win),
														 EWL_STOCK_CANCEL, EWL_RESPONSE_CANCEL);
	ewl_button_label_set(EWL_BUTTON(no), "No");
	ewl_callback_append(no, EWL_CALLBACK_VALUE_CHANGED,
											project_exit_cb, NULL);
	ewl_widget_show(no);

	ewl_widget_show(confirm_win);
}
Ejemplo n.º 5
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);
}
Ejemplo n.º 6
0
void ethpanel_update_advanced_mode(eth_panel *pnl)
{
    if(!pnl->win->advanced_mode)
    {
        ewl_widget_hide(pnl->entry_cmd);
        ewl_widget_hide(pnl->lbl_cmd);
    }
    else
    {
        ewl_widget_show(pnl->entry_cmd);
        ewl_widget_show(pnl->lbl_cmd);
    }
}
Ejemplo n.º 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;
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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);
}
Ejemplo n.º 10
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);
	}
}
Ejemplo n.º 11
0
void
icon_editor_show()
{
  if (!editor) return;

  ewl_widget_show(editor->win);
}
Ejemplo n.º 12
0
/**
 * @param e: The Ewl_Entry to set the editable status of
 * @param editable: The value to set for the editable flag
 * @return Returns no value
 * @brief Set if the entry is editable or not
 */
void
ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(e);
        DCHECK_TYPE(e, EWL_ENTRY_TYPE);

        if (e->editable == !!editable)
                DRETURN(DLEVEL_STABLE);

        e->editable = !!editable;

        if (e->editable)
        {
                ewl_callback_append(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
                                                ewl_entry_cb_key_down, NULL);

                if (ewl_widget_state_has(EWL_WIDGET(e), EWL_STATE_FOCUSED))
                        ewl_widget_show(e->cursor);

                ewl_widget_state_add(EWL_WIDGET(e), EWL_STATE_ON);
        }
        else
        {
                ewl_callback_del(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
                                                ewl_entry_cb_key_down);

                if (ewl_widget_state_has(EWL_WIDGET(e), EWL_STATE_FOCUSED))
                        ewl_widget_hide(e->cursor);

                ewl_widget_state_remove(EWL_WIDGET(e), EWL_STATE_ON);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Ejemplo n.º 13
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);
}
Ejemplo n.º 14
0
/**
 * @param menu: the menu to work with
 * @return Returns no value
 * @brief Expand the popup portion of the menu
 */
void
ewl_menu_expand(Ewl_Menu *menu)
{
        Ewl_Menu_Item *item;

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

        item = EWL_MENU_ITEM(menu);

        /* nothing to do if the popup is already visible */
        if (VISIBLE(menu->popup))
                DRETURN(DLEVEL_STABLE);

        ewl_widget_show(menu->popup);
        ewl_window_raise(EWL_WINDOW(menu->popup));

        if (item->inmenu) {
                Ewl_Context_Menu *cm;

                cm = EWL_CONTEXT_MENU(item->inmenu);
                cm->open_menu = EWL_WIDGET(menu);
        }
        else
                ewl_widget_focus_send(menu->popup);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Ejemplo n.º 15
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);
}
Ejemplo n.º 16
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);
}
Ejemplo n.º 17
0
static void
_editor_icon_image_cb (Ewl_Widget *widget, void *ev_data, void *user_data)
{
  if (!editor || !editor->icon_image) return;
  /* FIXME: use a file dialog */
  //ewl_image_set_file(EWL_IMAGE(editor->icon_image), "test.png");
  ewl_widget_show(editor->filesel.win);
}
Ejemplo n.º 18
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;
}
Ejemplo n.º 19
0
/**
 * file->open
 */
static EWL_CALLBACK_DEFN(open)
{
	Ewl_Widget *fd;

	if( open_project_win )
		return;

	open_project_win = ewl_window_new();

	fd = ewl_filedialog_new(EWL_FILEDIALOG_TYPE_OPEN);
	ewl_filedialog_path_set(EWL_FILEDIALOG(fd), active_project->path);
	ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, open_cb, NULL);
	ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW, open_cb, NULL);
	ewl_container_child_append(EWL_CONTAINER(open_project_win), fd);
	ewl_widget_show(fd);

	ewl_widget_show(open_project_win);
}
Ejemplo n.º 20
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *o, *o2;

        o2 = ewl_button_new();
        ewl_stock_type_set(EWL_STOCK(o2), EWL_STOCK_OPEN);
        ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_clicked, NULL);
        ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_NONE);
        ewl_container_child_append(box, o2);
        ewl_widget_show(o2);

        o = ewl_scrollpane_new();
        ewl_container_child_append(box, o);
        ewl_widget_name_set(o, "scroll");
        ewl_widget_show(o);

        return 1;
}
Ejemplo n.º 21
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *hscrollbar, *vscrollbar;

        hscrollbar = ewl_hscrollbar_new();
        ewl_object_padding_type_set(EWL_OBJECT(hscrollbar), EWL_PADDING_LARGE);
        ewl_object_padding_type_bottom_set(EWL_OBJECT(hscrollbar),
                        EWL_PADDING_DEFAULT);
        ewl_container_child_append(box, hscrollbar);
        ewl_widget_show(hscrollbar);

        vscrollbar = ewl_vscrollbar_new();
        ewl_object_padding_type_set(EWL_OBJECT(vscrollbar), EWL_PADDING_LARGE);
        ewl_container_child_append(box, vscrollbar);
        ewl_widget_show(vscrollbar);

        return 1;
}
Ejemplo n.º 22
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);
}
Ejemplo n.º 23
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;
}
Ejemplo n.º 24
0
void
ewl_iconbox_background_set_cb (Ewl_Widget * w, void *ev_data, void *user_data)
{
  entropy_gui_component_instance *instance = user_data;
  entropy_icon_viewer *viewer = instance->data;

  viewer->file_dialog = ewl_filedialog_new ();

  ewl_callback_append (viewer->file_dialog, EWL_CALLBACK_VALUE_CHANGED,
		       ewl_iconbox_background_set_file_cb, instance);
  ewl_widget_show (viewer->file_dialog);
}
Ejemplo n.º 25
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *hseeker, *vseeker;

        hseeker = ewl_hseeker_new();
        ewl_object_position_request(EWL_OBJECT(hseeker), 30, 0);
        ewl_callback_append(hseeker, EWL_CALLBACK_VALUE_CHANGED,
                                                cb_print_value, NULL);
        ewl_container_child_append(box, hseeker);
        ewl_widget_show(hseeker);

        vseeker = ewl_vseeker_new();
        ewl_object_position_request(EWL_OBJECT(vseeker), 0, 30);
        ewl_callback_append(vseeker, EWL_CALLBACK_VALUE_CHANGED,
                                                cb_print_value, NULL);
        ewl_container_child_append(box, vseeker);
        ewl_widget_show(vseeker);

        return 1;
}
Ejemplo n.º 26
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *vbox, *o;
        Ewl_Embed *emb;

        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), "button");
        ewl_container_child_append(EWL_CONTAINER(vbox), o);
        ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_click, NULL);
        ewl_widget_show(o);

        emb = ewl_embed_widget_find(EWL_WIDGET(box));
        ewl_window_fullscreen_set(EWL_WINDOW(emb), TRUE);

        return 1;
}
Ejemplo n.º 27
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;
}
Ejemplo n.º 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);
    }
}
Ejemplo n.º 29
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *o;

        o = ewl_button_new();
        ewl_button_label_set(EWL_BUTTON(o), "Launch window");
        ewl_container_child_append(box, o);
        ewl_callback_append(o, EWL_CALLBACK_CLICKED, run_window, NULL);
        ewl_widget_show(o);

        return 1;
}
Ejemplo n.º 30
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);
}