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); }
/** * 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); }
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); }
return 1; } static void cb_clicked(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data __UNUSED__) { Ewl_Widget *fd; Ecore_List *filters; filters = ecore_list_new(); ecore_list_append(filters, strdup("image/jpeg")); ecore_list_append(filters, strdup("image/png")); ecore_list_append(filters, strdup("image/gif")); fd = ewl_filedialog_new(); ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "txt", "*.txt", NULL); ewl_filedialog_filter_add(EWL_FILEDIALOG(fd), "Images", NULL, filters); ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW, cb_fd_delete, NULL); ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, cb_open, NULL); ewl_widget_show(fd); } static void cb_fd_delete(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) { ewl_widget_destroy(w); } static void cb_open(Ewl_Widget *w, void *ev, void *data __UNUSED__)