Example #1
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 #2
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 #3
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);
}
Ewl_Widget *
ewl_io_manager_plugin_uri_read(const char *uri)
{
        Ewl_Widget *ret = NULL;
        FILE *file;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(uri, NULL);

        if (!key1)
                setup_hash();


        file = fopen(uri, "r");
        if (file)
        {
                struct stat buf;
                char *str;

                ret = ewl_text_new();
                ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");

                stat(uri, &buf);
                str = malloc(sizeof(char) * (buf.st_size + 1));
                fread(str, buf.st_size, 1, file);
                str[buf.st_size] = '\0';
                fclose(file);

                text_set(EWL_TEXT(ret), str);
                FREE(str);
        }

        DRETURN_PTR(ret, DLEVEL_STABLE);
}
Ewl_Widget *
ewl_io_manager_plugin_string_read(const char *string)
{
        Ewl_Widget *ret = NULL;
        char *txt;

        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!key1)
                setup_hash();

        ret = ewl_text_new();
        ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");
        txt = strdup(string);
        text_set(EWL_TEXT(ret), txt);
        free(txt);

        DRETURN_PTR(ret, DLEVEL_STABLE);
}
Example #6
0
/**
 * update the view of this project based on its contents
 */
void
project_update( void )
{
	Ewl_Widget *w;
	Ecore_List *names;
	Ecore_Sheap *snames;
	int i, nodes;
	char *name;

	ewl_tree_selected_clear(EWL_TREE(file_tree));
	ewl_container_reset(EWL_CONTAINER(file_tree));

	if( !active_project->files->nodes )
		return;

	names = ecore_hash_keys(active_project->files);
	nodes = ecore_list_count(names);
	snames = ecore_sheap_new(ecore_str_compare, nodes);

	while( (name = ecore_list_remove(names)) )
		ecore_sheap_insert(snames, name);

	ecore_sheap_sort(snames);

	for( i=0;i<nodes;i++ ) {
		Ewl_Widget *row;

		name = ecore_sheap_item(snames, i);

		w = ewl_text_new(name);
		row = ewl_tree_row_add(EWL_TREE(file_tree), NULL, &w);
		ewl_callback_append(row, EWL_CALLBACK_DOUBLE_CLICKED,
												form_open, name);
		ewl_callback_append(row, EWL_CALLBACK_CLICKED,
												project_file_menu, name);
		ewl_widget_show(w);
	}

	ecore_sheap_destroy(snames);
	ecore_list_destroy(names);
}
Example #7
0
static void
eke_gui_ewl_add_feed_cb(Ewl_Widget *w, void *ev, void *data)
{
    Eke *eke;
    Ewl_Widget *win, *box, *entry, *o, *name_entry;

    eke = data;

    win = ewl_widget_data_get(w, "manage_feed_win");
    ewl_widget_destroy(win);

    win = ewl_dialog_new(EWL_POSITION_BOTTOM);
    ewl_window_title_set(EWL_WINDOW(win), PACKAGE " -- add feed");
    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);

    o = ewl_text_new("Add Feed");
    ewl_container_child_append(EWL_CONTAINER(box), o);
    ewl_widget_show(o);

    o = ewl_text_new(" ");
    ewl_container_child_append(EWL_CONTAINER(box), o);
    ewl_widget_show(o);

    o = ewl_text_new("Feed Name");
    ewl_container_child_append(EWL_CONTAINER(box), o);
    ewl_widget_show(o);

    name_entry = ewl_entry_new("");
    ewl_container_child_append(EWL_CONTAINER(box), name_entry);
    ewl_widget_show(name_entry);

    o = ewl_text_new(" ");
    ewl_container_child_append(EWL_CONTAINER(box), o);
    ewl_widget_show(o);

    o = ewl_text_new("URI [http://<server>[:port]/path/to/file.rss");
    ewl_container_child_append(EWL_CONTAINER(box), o);
    ewl_widget_show(o);

    entry = ewl_entry_new("");
    ewl_container_child_append(EWL_CONTAINER(box), entry);
    ewl_widget_show(entry);
   
    o = ewl_button_stock_with_id_new(EWL_STOCK_OK, EWL_RESPONSE_OK);
    ewl_container_child_append(EWL_CONTAINER(win), o);
    ewl_widget_data_set(o, "entry", entry);
    ewl_widget_data_set(o, "name_entry", name_entry);
    ewl_widget_data_set(o, "win", win);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
                                eke_gui_ewl_add_feed_ok_cb, eke);
    ewl_widget_show(o);

    o = ewl_button_stock_with_id_new(EWL_STOCK_CANCEL, EWL_RESPONSE_CANCEL);
    ewl_container_child_append(EWL_CONTAINER(win), o);
    ewl_widget_data_set(o, "win", win);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED,
                                eke_gui_ewl_manage_feed_exit_cb, win);
    ewl_widget_show(o);

    return;
    ev = NULL;
}
Example #8
0
void
_icon_editor_gui_init()
{
  if (!editor) return;

  editor->win = ewl_window_new();
  ewl_window_title_set(EWL_WINDOW(editor->win), "Iconbar Icon Editor");
  ewl_window_name_set(EWL_WINDOW(editor->win), "Iconbar Icon Editor");
  ewl_callback_append(editor->win, EWL_CALLBACK_DELETE_WINDOW,
                      _editor_close_win, NULL);

  /* boxes */
  editor->main_vbox = ewl_vbox_new();
  ewl_container_child_append(EWL_CONTAINER(editor->win), editor->main_vbox);
  ewl_widget_show(editor->main_vbox);
  
  editor->top_hbox = ewl_hbox_new();
  ewl_container_child_append(EWL_CONTAINER(editor->main_vbox), editor->top_hbox);
  ewl_widget_show(editor->top_hbox);

  editor->bot_hbox = ewl_hbox_new();
  ewl_container_child_append(EWL_CONTAINER(editor->main_vbox), editor->bot_hbox);
  ewl_widget_show(editor->bot_hbox);

  /* image */
  editor->icon_image = ewl_image_new("test.png", NULL);
  ewl_container_child_append(EWL_CONTAINER(editor->top_hbox), editor->icon_image);
  ewl_object_padding_set(EWL_OBJECT(editor->icon_image), 5, 5, 5, 5);
  ewl_widget_show(editor->icon_image);
  ewl_callback_append(editor->icon_image, EWL_CALLBACK_REALIZE,
                      _editor_realize, NULL);
  ewl_callback_append(editor->icon_image, EWL_CALLBACK_MOUSE_UP,
                      _editor_icon_image_cb, NULL);

  /* vbox for entry hboxes */
  editor->right_vbox = ewl_vbox_new();
  ewl_container_child_append(EWL_CONTAINER(editor->top_hbox), editor->right_vbox);
  ewl_widget_show(editor->right_vbox);


  /* name */
  editor->name.hbox = ewl_hbox_new();
  ewl_container_child_append(EWL_CONTAINER(editor->right_vbox), editor->name.hbox);
  ewl_widget_show(editor->name.hbox);

  editor->name.label = ewl_text_new("Name: ");
  ewl_container_child_append(EWL_CONTAINER(editor->name.hbox), editor->name.label);
  ewl_widget_show(editor->name.label);

  editor->name.entry = ewl_entry_new("");
  ewl_container_child_append(EWL_CONTAINER(editor->name.hbox), editor->name.entry);
  ewl_widget_show(editor->name.entry);


  /* exec */
  editor->exec.hbox = ewl_hbox_new();
  ewl_container_child_append(EWL_CONTAINER(editor->right_vbox), editor->exec.hbox);
  ewl_widget_show(editor->exec.hbox);

  editor->exec.label = ewl_text_new("Exec:");
  ewl_container_child_append(EWL_CONTAINER(editor->exec.hbox), editor->exec.label);
  ewl_widget_show(editor->exec.label);

  editor->exec.entry = ewl_entry_new("");
  ewl_container_child_append(EWL_CONTAINER(editor->exec.hbox), editor->exec.entry);
  ewl_widget_show(editor->exec.entry);


  /* cancel and save buttons */
  editor->cancel_but = ewl_button_new("Cancel");
  ewl_object_fill_policy_set(EWL_OBJECT(editor->cancel_but), EWL_FLAG_FILL_NONE);
  ewl_object_padding_set(EWL_OBJECT(editor->cancel_but), 5, 5, 5, 5);
  ewl_object_alignment_set(EWL_OBJECT(editor->cancel_but), EWL_FLAG_ALIGN_RIGHT);
  ewl_container_child_append(EWL_CONTAINER(editor->bot_hbox), editor->cancel_but);
  ewl_widget_show(editor->cancel_but);
  ewl_callback_append(editor->cancel_but, EWL_CALLBACK_CLICKED,
                      _editor_button_cb, NULL);

  editor->ok_but = ewl_button_new("Save and Close");
  ewl_object_fill_policy_set(EWL_OBJECT(editor->ok_but), EWL_FLAG_FILL_NONE);
  ewl_object_padding_set(EWL_OBJECT(editor->ok_but), 5, 5, 5, 5);
  ewl_object_alignment_set(EWL_OBJECT(editor->ok_but), EWL_FLAG_ALIGN_RIGHT);
  ewl_container_child_append(EWL_CONTAINER(editor->bot_hbox), editor->ok_but);
  ewl_widget_show(editor->ok_but);
  ewl_callback_append(editor->ok_but, EWL_CALLBACK_CLICKED,
                      _editor_button_cb, NULL);

  editor->filesel.win = ewl_window_new();

  editor->filesel.dialog = ewl_filedialog_new(EWL_FILEDIALOG_TYPE_OPEN);
  ewl_container_child_append(EWL_CONTAINER(editor->filesel.win), editor->filesel.dialog);
  ewl_widget_show(editor->filesel.dialog);
  ewl_callback_append(editor->filesel.dialog, EWL_CALLBACK_VALUE_CHANGED, _editor_filesel_cb, NULL);
}
Example #9
0
/**
 * settings->options
 */
static EWL_CALLBACK_DEFN(options)
{
	Ewl_Widget *save, *cancel;
	Ewl_Widget *label_vbox, *entry_vbox, *hbox;
	Ewl_Widget *label, *entry;

	if( options_win )
		return;

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

	hbox = ewl_hbox_new();
	ewl_dialog_widget_add(EWL_DIALOG(options_win), hbox);
	ewl_widget_show(hbox);

	label_vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(hbox), label_vbox);
	ewl_widget_show(label_vbox);

	label = ewl_text_new("Project Path:");
	ewl_container_child_append(EWL_CONTAINER(label_vbox), label);
	ewl_widget_show(label);

	label = ewl_text_new("Project Name:");
	ewl_container_child_append(EWL_CONTAINER(label_vbox), label);
	ewl_widget_show(label);

	label = ewl_text_new("Project File:");
	ewl_container_child_append(EWL_CONTAINER(label_vbox), label);
	ewl_widget_show(label);

	entry_vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_vbox);
	ewl_widget_show(entry_vbox);

	entry = ewl_entry_new(active_project->path);
	ewl_container_child_append(EWL_CONTAINER(entry_vbox), entry);
	ewl_widget_show(entry);
	active_project_options.path_entry = entry;

	entry = ewl_entry_new(active_project->name);
	ewl_container_child_append(EWL_CONTAINER(entry_vbox), entry);
	ewl_widget_show(entry);
	active_project_options.name_entry = entry;

	entry = ewl_entry_new(active_project->filename);
	ewl_container_child_append(EWL_CONTAINER(entry_vbox), entry);
	ewl_widget_show(entry);
	active_project_options.filename_entry = entry;

	save = ewl_dialog_button_add(EWL_DIALOG(options_win),
															 EWL_STOCK_SAVE, EWL_RESPONSE_SAVE);
	ewl_callback_append(save, EWL_CALLBACK_VALUE_CHANGED, options_cb, NULL);
	ewl_widget_show(save);

	cancel = ewl_dialog_button_add(EWL_DIALOG(options_win),
																 EWL_STOCK_CANCEL, EWL_RESPONSE_CANCEL);
	ewl_callback_append(cancel, EWL_CALLBACK_VALUE_CHANGED, options_cb, NULL);
	ewl_widget_show(cancel);

	ewl_widget_show(options_win);
}
Example #10
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *o, *o2, *hbox;

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

        o = ewl_icon_new();
        ewl_box_orientation_set(EWL_BOX(o), EWL_ORIENTATION_HORIZONTAL);
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Fill None");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)");
        ewl_icon_editable_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o2 = ewl_text_new();
        ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set "
                                        "on it.\n\n That data is just \n"
                                        "text, but could\nbe any widget.");
        ewl_widget_show(o2);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_extended_data_set(EWL_ICON(o), o2);
        ewl_icon_label_set(EWL_ICON(o), "World");
        ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
        ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
        ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
        ewl_icon_editable_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_alt_text_set(EWL_ICON(o), "Icon Alt Text");
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        return 1;
}
Example #11
0
static EWL_CALLBACK_DEFN(entry_value_changed)
{
	Ewler_Widget_Elem *elem = user_data;
	char *text;

	text = ewl_text_text_get(EWL_TEXT(elem->entry));

	if( !text )
		return;

	switch( elem->spec->type ) {
		case EWLER_SPEC_ELEM_INT:
			elem->info.ivalue = strtol(text, NULL, 0);
			IF_FREE(text);

			if( !elem->changed ) {
				Ewl_Widget *parent;
				char *label = ewl_text_text_get(EWL_TEXT(elem->text));

				parent = elem->text->parent;
				ewl_widget_destroy(elem->text);

				elem->text = ewl_text_new("");
				ewl_text_color_set(EWL_TEXT(elem->text), 255, 0, 0, 255);
				ewl_text_text_append(EWL_TEXT(elem->text), label);
				ewl_container_child_append(EWL_CONTAINER(parent), elem->text);
				ewl_widget_show(elem->text);
				FREE(label);
			}

			elem->changed = true;
			if( elem->spec->set_func )
				elem->spec->set_func(elem->w->w, elem->info.ivalue);
			break;
		case EWLER_SPEC_ELEM_STRING:
			if( elem->spec == name_spec ) {
				if( ewl_widget_name_find(text) ) {
					ewler_error("A widget already exists with the name %s", text);
					FREE(text);
					ewl_text_text_set(EWL_TEXT(elem->entry), elem->info.svalue);
					return;
				}

				form_rename_widget(elem->info.svalue, text);
			}

			elem->info.svalue = text;

			if( !elem->changed ) {
				int len;

				len = ewl_text_length_get(EWL_TEXT(elem->text));
				ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
				ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
			}

			elem->changed = true;
			if( elem->spec->set_func )
				elem->spec->set_func(elem->w->w, elem->info.svalue);
			break;
		default: break;
	}
}
Example #12
0
void
inspector_update( Ecore_List *selected )
{
	Ewl_Widget *prow;
	Ecore_Sheap *slist, *sheap;
	Ecore_Hash *elems;
	Ecore_List *keys;
	Ecore_List *prow_stack, *sheap_stack, *elems_stack;
	Ewler_Widget *w;
	char *key;

	ewl_container_reset(EWL_CONTAINER(tree));

	if( !selected )
		return;
	/* add support for multiple selections later */
	w = ecore_list_first_goto(selected);

	if( !w )
		return;
	
	keys = ecore_hash_keys(w->elems);
	slist = ecore_sheap_new(ecore_str_compare, ecore_list_count(keys));

	while( (key = ecore_list_next(keys)) )
		ecore_sheap_insert(slist, key);

	ecore_list_destroy(keys);
	ecore_sheap_sort(slist);

	sheap = slist;
	elems = w->elems;

	sheap_stack = ecore_list_new();
	elems_stack = ecore_list_new();
	prow_stack = ecore_list_new();
	prow = NULL;

	while( (key = ecore_sheap_extract(sheap)) ) {
		Ewler_Widget_Elem *elem;
		Ewl_Widget *row_items[2], *row;
		Ewl_Widget *text, *entry;
		int len;

		elem = ecore_hash_get(elems, key);
		text = ewl_text_new(key);
		len = ewl_text_length_get(EWL_TEXT(text));
		ewl_text_cursor_position_set(EWL_TEXT(text), 0);
		if( elem->changed )
			ewl_text_color_apply(EWL_TEXT(text), 255, 0, 0, 255, len);

		switch( elem->spec->type ) {
			case EWLER_SPEC_ELEM_STRUCT: entry = NULL; break;
			case EWLER_SPEC_ELEM_ENUM:
				entry = ewl_combo_new(elem_to_s(elem));

				if( elem->items )
					ecore_hash_destroy(elem->items);

				elem->items = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
				
				keys = ecore_hash_keys(elem->spec->info.edata.map_rev);
				while( (key = ecore_list_next(keys)) ) {
					Ewl_Widget *combo_item;
					int value;

					value = (int) ecore_hash_get(elem->spec->info.edata.map_rev, key);

					combo_item = ewl_menu_item_new(NULL, key);
					ecore_hash_set(elem->items, (void *) value, combo_item);
					ewl_container_child_append(EWL_CONTAINER(entry), combo_item);
					ewl_widget_show(combo_item);
				}

				ecore_list_destroy(keys);

				ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
														combo_value_changed, elem);
				break;
			default:
				entry = ewl_entry_new(elem_to_s(elem));
				if( !elem->spec->modifiable )
					ewl_entry_editable_set(EWL_ENTRY(entry), false);

				ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
														entry_value_changed, elem);
				ewl_callback_append(entry, EWL_CALLBACK_DESELECT,
														entry_value_changed, elem);
				ewl_callback_append(entry, EWL_CALLBACK_FOCUS_OUT,
														entry_focus_out, elem);
				break;
		}

		elem->text = text;
		elem->entry = entry;

		row_items[0] = text;
		row_items[1] = entry;

		row = ewl_tree_row_add(EWL_TREE(tree), EWL_ROW(prow), row_items);
		ewl_widget_show(text);
		if( entry )
			ewl_widget_show(entry);

		if( elem->spec->type == EWLER_SPEC_ELEM_STRUCT ) {
			ecore_list_prepend(prow_stack, prow);
			ecore_list_prepend(sheap_stack, sheap);
			ecore_list_prepend(elems_stack, elems);

			prow = row;
			elems = elem->info.children;

			/* TODO: check for indexed struct */
			keys = ecore_hash_keys(elems);
			sheap = ecore_sheap_new(ecore_str_compare, ecore_list_count(keys));

			while( (key = ecore_list_next(keys)) )
				ecore_sheap_insert(sheap, key);

			ecore_list_destroy(keys);
			ecore_sheap_sort(sheap);
		}

		if( sheap->size == 0 && ecore_list_count(sheap_stack) ) {
			ecore_sheap_destroy(sheap);

			prow = ecore_list_first_remove(prow_stack);
			sheap = ecore_list_first_remove(sheap_stack);
			elems = ecore_list_first_remove(elems_stack);
		}
	}

	ecore_list_destroy(sheap_stack);
	ecore_list_destroy(elems_stack);
	ecore_sheap_destroy(slist);
}
entropy_gui_component_instance *
entropy_plugin_gui_instance_new (entropy_core * core,
		     entropy_gui_component_instance * layout)
{
  Ewl_Widget *context;

  entropy_gui_component_instance *instance =
    entropy_gui_component_instance_new ();
  entropy_icon_viewer *viewer = entropy_malloc (sizeof (entropy_icon_viewer));

  /*Save a reference to our local data */
  instance->data = viewer;
  instance->layout_parent = layout;

  viewer->iconbox = ewl_iconbox_new ();
  viewer->default_bg = 0;
  instance->gui_object = viewer->iconbox;
  ewl_widget_show (EWL_WIDGET (viewer->iconbox));


  /*Initialise the progress window */
  viewer->progress = entropy_malloc (sizeof (entropy_file_progress_window));

  /*Init the file wait list */
  viewer->file_wait_list =
    ecore_hash_new (ecore_direct_hash, ecore_direct_compare);


  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "New Directory");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_new_dir.png",
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  /*ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);*/
  ewl_widget_show (context);


  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Copy selection");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_copy.png",
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Paste");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_paste.png", 
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_paste_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_separator_new ();
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context),
			  "Set custom folder background...");
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_background_set_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context),
			  "Remove current custom background");
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_background_remove_cb, instance);
  ewl_widget_show (context);

	/*---------------Icon Menu---------------*/

  /*Copy */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Copy");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_copy.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);
  //

  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Cut");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_cut.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  //ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, icon_properties_cb, instance);


  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Rename");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_rename.png",
			   NULL);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_menu_rename_cb, instance);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);

  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Delete");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_delete.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_menu_delete_cb, instance);

  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Properties");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_properties.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED, icon_properties_cb,
		       instance);

  /*Properties hover */
  viewer->hover_properties = ewl_text_new ();
  ewl_callback_append (viewer->hover_properties, EWL_CALLBACK_SHOW,
		       icon_hover_properties_show_cb, instance);
  ewl_text_text_set (EWL_TEXT (viewer->hover_properties),
		     "Filename: ewl_text.c\nSize: 50kb\nType: text/c-src");
	/*------------------------*/

  /*FIXME remove the hardocded var */
  ewl_iconbox_icon_size_custom_set (EWL_ICONBOX (viewer->iconbox), 60, 60);


  /*Init the hash */
  viewer->gui_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare);
  viewer->icon_hash =
    ecore_hash_new (ecore_direct_hash, ecore_direct_compare);

  /*Set the core back reference */
  instance->core = core;

  /*Register out interest in receiving folder notifications */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS_EXTERNAL));

  /*Register our interest in receiving file mod/create/delete notifications */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_CHANGE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_CREATE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_REMOVE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_REMOVE_DIRECTORY));

  /*Register interest in getting stat events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE));

  /*We want to know about file transfer progress events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_PROGRESS));

  /*We want to know if the backend needs feedback */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT));

  /*We want to know about thumbnail available events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE));

  ewl_iconbox_controlled_key_callback_register (viewer->iconbox,
						ewl_icon_local_viewer_key_event_cb,
						instance);
  return instance;
}
Example #14
0
/*
 * Internal functions
 */
static Ewl_Widget *
help_reader_window_new(void)
{
    Ewl_Widget * win, * c, * w, * vbox;

    win = calloc(1, sizeof(Help_Reader_Window));
    ewl_window_init(EWL_WINDOW(win));
    ewl_object_size_request(EWL_OBJECT(win), 600, 500);
    ewl_window_name_set(EWL_WINDOW(win), "Elitaire Help");
    ewl_window_class_set(EWL_WINDOW(win), "Elitaire");
    ewl_callback_append(win, EWL_CALLBACK_DESTROY,
                        help_reader_window_cb_destroy, NULL);
    ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
                        help_reader_window_cb_delete, NULL);
    ewl_widget_show(win);

    /* vbox to hold the toolbar and the text view */
    vbox = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(win), vbox);
    ewl_widget_show(vbox);

    /* the toolbar */
    c = ewl_htoolbar_new();
    ewl_toolbar_icon_part_hide(EWL_TOOLBAR(c), EWL_ICON_PART_LABEL);
    ewl_container_child_append(EWL_CONTAINER(vbox), c);
    ewl_widget_show(c);

    /* the toolbar buttons */
    w = ewl_icon_simple_new();
    ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_ARROW_LEFT);
    ewl_callback_append(w, EWL_CALLBACK_CLICKED,
                        help_reader_prev_button_cb_clicked, win);
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_disable(w);
    ewl_widget_show(w);
    HELP_READER_WINDOW(win)->prev_button = w;

    w = ewl_icon_simple_new();
    ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_ARROW_RIGHT);
    ewl_callback_append(w, EWL_CALLBACK_CLICKED,
                        help_reader_next_button_cb_clicked, win);
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_disable(w);
    ewl_widget_show(w);
    HELP_READER_WINDOW(win)->next_button = w;

    w = ewl_icon_simple_new();
    ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_HOME);
    ewl_callback_append(w, EWL_CALLBACK_CLICKED,
                        help_reader_home_button_cb_clicked, win);
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_show(w);

    /* the text view */
    c = ewl_scrollpane_new();
    ewl_container_child_append(EWL_CONTAINER(vbox), c);
    ewl_widget_show(c);

    w = ewl_text_new();
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_show(w);

    HELP_READER_WINDOW(win)->text = w;

    /* the histroy */
    HELP_READER_WINDOW(win)->history = ecore_dlist_new();
    ecore_dlist_free_cb_set(HELP_READER_WINDOW(win)->history, free);

    return win;
}
void ewl_frontend_dialog_config_open(Eli_App * eap)
{
    Ewl_Widget * o;
    Ewl_Widget * border_box;
    Ewl_Widget * hbox;
    Ewl_Widget * vbox;
    Ewl_Widget * main_box;
    Ewl_Widget * radio_b[2];

    /* one open config dialog should be enough */
    if (conf_win) return;
    /* Setup and show the configuration window */
    conf_win = ewl_dialog_new();
    ewl_dialog_action_position_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);
    ewl_window_title_set(EWL_WINDOW(conf_win), _("Configuration"));
    ewl_window_name_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_class_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_leader_foreign_set(EWL_WINDOW(conf_win),
		    		EWL_EMBED_WINDOW(eap->main_win));
    ewl_callback_append(conf_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb,
                        NULL);
    ewl_dialog_has_separator_set(EWL_DIALOG(conf_win), 1);
    ewl_object_fill_policy_set(EWL_OBJECT(conf_win), EWL_FLAG_FILL_NONE);
    ewl_widget_show(conf_win);
    
    /* the main_box contain the border_boxes */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP);
    main_box = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(conf_win), main_box);
    ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER);
    ewl_widget_show(main_box);

    /* Setup and show the stock icons */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    /* *** Graphic Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Graphic"));
    ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
    //ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_HFILL);
    ewl_widget_show(border_box);

    /* Setup and show the checkbuttons */
    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("animated movements"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.animations = ecore_config_boolean_get("/graphic/animations");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.animations);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("shadows"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.shadows = ecore_config_boolean_get("/graphic/shadows");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.shadows);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    /* Setup and show the velocity label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("velocity:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);

    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.vel_label = o;

    o = ewl_hseeker_new();
    config.velocity = ecore_config_int_get("velocity");
    ewl_range_minimum_value_set(EWL_RANGE(o), 200.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 800.0);
    ewl_range_step_set(EWL_RANGE(o), 60.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.velocity);
    ewl_widget_name_set(o, "velocity");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
                          _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* Setup and show the frame_rate label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("frame rate:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    
    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.frt_label = o;

    o = ewl_hseeker_new();
    config.frame_rate = ecore_config_int_get("frame_rate");
    ewl_range_minimum_value_set(EWL_RANGE(o), 10.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 100.0);
    ewl_range_step_set(EWL_RANGE(o), 10.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.frame_rate);
    ewl_widget_name_set(o, "frame_rate");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
    _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* *** Lazy Box *** */
    vbox = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(main_box), vbox);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_NORMAL);
    ewl_widget_show(vbox);

    border_box = ewl_border_new();
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_border_label_set(EWL_BORDER(border_box), _("Laziness"));
    ewl_widget_show(border_box);
    /* the radio buttons */
    config.lazy = ecore_config_int_get("lazy");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("normal mode"));
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("lazy mode"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.lazy)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

    /* *** Render Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Render Engine"));
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL);
    ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER);
    ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP);
    ewl_widget_show(border_box);

    o = ewl_text_new();
    ewl_text_text_set(EWL_TEXT(o), _("Changes only affect after new start"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_widget_show(o);

    /* the radio buttons */
    config.gl = ecore_config_boolean_get("/graphic/gl");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("Software"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("OpenGL (testing)"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.gl)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

}
Example #16
0
File: gui_ewl.c Project: 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);
}
Example #17
0
void ewl_entropy_tip_window_display()
{
    Ewl_Widget* tip_window = ewl_window_new();
    Ewl_Widget* vbox = ewl_vbox_new();
    Ewl_Widget* hbox = ewl_hbox_new();
    Ewl_Widget* button;
    Ewl_Widget* image = ewl_image_new();

    ewl_entropy_tip_window_create_tips();
    tip_number = 0;

    ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_BOTTOM);
    ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_BOTTOM);
    ewl_object_alignment_set(EWL_OBJECT(tip_window), EWL_FLAG_ALIGN_BOTTOM);
    ewl_object_fill_policy_set(EWL_OBJECT(tip_window), EWL_FLAG_FILL_FILL);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL);

    ewl_container_child_append(EWL_CONTAINER(tip_window), vbox);
    ewl_container_child_append(EWL_CONTAINER(vbox), hbox);

    text_tip = ewl_text_new();
    ewl_object_minimum_h_set(EWL_OBJECT(text_tip), 80);
    ewl_container_child_append(EWL_CONTAINER(hbox), text_tip);

    ewl_image_file_set(EWL_IMAGE(image), PACKAGE_DATA_DIR "/icons/tip.png", NULL);
    ewl_container_child_append(EWL_CONTAINER(hbox), image);
    ewl_widget_show(hbox);

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

    button = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(button), "Prev Tip");
    ewl_object_custom_h_set(EWL_OBJECT(button), 15);
    ewl_widget_show(button);
    ewl_container_child_append(EWL_CONTAINER(hbox), button);

    button = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(button), "Next Tip");
    ewl_object_custom_h_set(EWL_OBJECT(button), 15);
    ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_entropy_tip_window_tip_next_cb, NULL);
    ewl_widget_show(button);
    ewl_container_child_append(EWL_CONTAINER(hbox), button);

    button = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(button), "Close");
    ewl_object_custom_h_set(EWL_OBJECT(button), 15);
    ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_entropy_tip_window_destroy_cb, tip_window);
    ewl_widget_show(button);
    ewl_container_child_append(EWL_CONTAINER(hbox), button);


    ewl_callback_append(tip_window, EWL_CALLBACK_DELETE_WINDOW, ewl_entropy_tip_window_destroy_cb, tip_window);

    ewl_widget_show(tip_window);
    ewl_widget_show(vbox);
    ewl_widget_show(text_tip);
    ewl_widget_show(image);

    ewl_entropy_tip_window_tip_next_cb(NULL,NULL,NULL);

}