void etk_file_cache_dialog_create() { Etk_Widget* window = NULL; Etk_Widget* tree = NULL; Etk_Tree_Col* tree_col; Etk_Widget* button; Etk_Widget* vbox; if (_etk_file_cache_dialog_running) return; _etk_file_cache_dialog_running = 1; window = etk_window_new(); etk_window_title_set(ETK_WINDOW(window), "File Cache"); etk_window_wmclass_set(ETK_WINDOW(window), "entropyfilecache", "entropyfilecache"); etk_widget_size_request_set(ETK_WIDGET(window), 450, 500); vbox = etk_vbox_new(ETK_FALSE,0); etk_container_add(ETK_CONTAINER(window), vbox); tree = etk_tree_new(); etk_box_append(ETK_BOX(vbox), tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_tree_mode_set(ETK_TREE(tree), ETK_TREE_MODE_LIST); tree_col = etk_tree_col_new(ETK_TREE(tree), _("Listeners"), 125,0.0); etk_tree_col_model_add(tree_col, etk_tree_model_text_new()); // Not yet implemented in Tree2 //etk_tree_col_sort_func_set(tree_col, _entropy_etk_file_cache_dialog_listener_compare_cb, NULL); tree_col = etk_tree_col_new(ETK_TREE(tree), _("Filename"), 150, 0.0); etk_tree_col_model_add(tree_col, etk_tree_model_text_new()); etk_tree_col_expand_set(tree_col, ETK_TRUE); etk_tree_build(ETK_TREE(tree)); etk_file_cache_dialog_refresh(tree); button = etk_button_new_with_label("Refresh"); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(_etk_file_cache_dialog_refresh_cb), tree); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_END, ETK_BOX_NONE, 0); etk_signal_connect ("delete_event", ETK_OBJECT (window), ETK_CALLBACK (_etk_file_cache_debug_dialog_delete_cb), window); etk_widget_show_all(window); }
main_window* mainwindow_create() {/*{{{*/ Etk_Widget *hbox,*scroll; main_window* win; win=(main_window*)malloc((unsigned int)sizeof(main_window)); win->win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win->win), _("Exalt: network manager")); etk_window_wmclass_set(ETK_WINDOW(win->win),"Exalt_network_manager","Exalt_network_manager"); etk_window_resize(ETK_WINDOW(win->win), 623,268); etk_signal_connect("delete-event", ETK_OBJECT(win->win), ETK_CALLBACK( mainWindow_close), win); hbox = etk_hbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(win->win), hbox); scroll = etk_scrolled_view_new (); etk_box_append(ETK_BOX(hbox), scroll, ETK_BOX_START, ETK_BOX_FILL, 0); etk_widget_show(scroll); win->eth_list = etk_tree_new(); etk_widget_size_request_set(win->eth_list, 120, 50); win->eth_col0 = etk_tree_col_new(ETK_TREE(win->eth_list), _("Interfaces"), 80, 0.0); etk_tree_col_model_add(win->eth_col0, etk_tree_model_image_new()); etk_tree_col_model_add(win->eth_col0, etk_tree_model_text_new()); etk_tree_rows_height_set(ETK_TREE(win->eth_list),40); etk_tree_mode_set(ETK_TREE(win->eth_list), ETK_TREE_MODE_LIST); etk_tree_build(ETK_TREE(win->eth_list)); etk_container_add(ETK_CONTAINER(scroll), win->eth_list); etk_signal_connect("row-clicked", ETK_OBJECT(win->eth_list),ETK_CALLBACK(mainWindow_ethList_row_clicked_cb), win); //add the general panel in the list etk_tree_row_append(ETK_TREE(win->eth_list), NULL, win->eth_col0,PACKAGE_DATA_DIR ICONS_NETWORK_CONFIG,NULL,_("General") , NULL); //attach the add callback function to exalt exalt_eth_set_cb(mainWindow_eth_cb, win); etk_widget_show_all(win->win); win->eth_panel = ethpanel_create(win); etk_box_append(ETK_BOX(hbox),win->eth_panel->frame , ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); win->wireless_panel = wirelesspanel_create(win); etk_box_append(ETK_BOX(hbox),win->wireless_panel->frame , ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); win->general_panel = generalpanel_create(); etk_box_append(ETK_BOX(hbox),win->general_panel->frame , ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //launch the timer to update the network state //win->eth_state_timer = ecore_timer_add(MAINWINDOW_ETH_STATE_TIME_MAX ,mainWindow_eth_state_timer,win); return win; }/*}}}*/
/* Creates the window for the mdi test */ void etk_test_mdi_window_window_create(void *data) { static Etk_Widget *win = NULL; Etk_Widget *mdi_area; Etk_Widget *mdi_window; Etk_Widget *down_image; Etk_Widget *next_image; Etk_Widget *prev_image; Etk_Widget *up_image; Etk_Widget *table; if (win) { etk_widget_show_all(ETK_WIDGET(win)); return; } win = etk_window_new(); etk_window_resize(ETK_WINDOW(win), 300, 300); etk_window_title_set(ETK_WINDOW(win), "Etk Mdi Window Test"); etk_container_border_width_set(ETK_CONTAINER(win), 5); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); down_image = etk_image_new_from_stock(ETK_STOCK_GO_DOWN, ETK_STOCK_BIG); next_image = etk_image_new_from_stock(ETK_STOCK_GO_NEXT, ETK_STOCK_BIG); prev_image = etk_image_new_from_stock(ETK_STOCK_GO_PREVIOUS, ETK_STOCK_BIG); up_image = etk_image_new_from_stock(ETK_STOCK_GO_UP, ETK_STOCK_BIG); table = etk_table_new(3, 3, ETK_TABLE_NOT_HOMOGENEOUS); etk_container_add(ETK_CONTAINER(win), table); etk_table_attach(ETK_TABLE(table), down_image, 0, 2, 0, 0, ETK_TABLE_NONE, 0, 0); etk_table_attach(ETK_TABLE(table), next_image, 0, 0, 1, 1, ETK_TABLE_NONE, 0, 0); etk_table_attach(ETK_TABLE(table), prev_image, 2, 2, 1, 1, ETK_TABLE_NONE, 0, 0); etk_table_attach(ETK_TABLE(table), up_image, 0, 2, 2, 2, ETK_TABLE_NONE, 0, 0); mdi_area = etk_mdi_area_new(); etk_table_attach_default(ETK_TABLE(table), mdi_area, 1, 1, 1, 1); mdi_window = etk_mdi_window_new(); etk_mdi_window_title_set(ETK_MDI_WINDOW(mdi_window), "Mdi Window 1"); etk_widget_size_request_set(ETK_WIDGET(mdi_window), 100, 100); etk_container_add(ETK_CONTAINER(mdi_area), mdi_window); mdi_window = etk_mdi_window_new(); etk_mdi_window_title_set(ETK_MDI_WINDOW(mdi_window), "Mdi Window 2"); etk_mdi_window_move(ETK_MDI_WINDOW(mdi_window), 100, 100); etk_widget_size_request_set(ETK_WIDGET(mdi_window), 100, 100); etk_container_add(ETK_CONTAINER(mdi_area), mdi_window); etk_widget_show_all(win); }
ELAPI void * el_about(void) { Etk_Widget *win, *vbox, *hbox; Etk_Widget *button, *label; Etk_Widget *about; Etk_Textblock *msg; Etk_Textblock_Iter *iter; char buf[4096]; win = etk_dialog_new(); etk_window_title_set(ETK_WINDOW(win), "About "PACKAGE_NAME); etk_window_wmclass_set(ETK_WINDOW(win), PACKAGE"_About", PACKAGE_NAME"_About"); etk_container_border_width_set(ETK_CONTAINER(win), 3); etk_signal_connect("delete_event", ETK_OBJECT(win), ETK_CALLBACK(_close_cb), NULL); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(win), vbox); label = etk_label_new("<h1>"PACKAGE_NAME"</h1>"); etk_label_alignment_set(ETK_LABEL(label), 0.5, 0.5); etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); snprintf(buf, sizeof(buf), "<b>%s is an Etk-based IRC client in development</b>\n\n" "Christopher 'devilhorns' Michael\n\n%s\n", PACKAGE_NAME, PACKAGE_BUGREPORT); about = etk_text_view_new(); etk_widget_size_request_set(about, 250, 150); etk_box_append(ETK_BOX(vbox), about, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); msg = etk_text_view_textblock_get(ETK_TEXT_VIEW(about)); etk_textblock_object_cursor_visible_set(ETK_TEXT_VIEW(about)->textblock_object, ETK_FALSE); iter = etk_textblock_iter_new(msg); etk_textblock_iter_forward_end(iter); etk_textblock_insert_markup(msg, iter, buf, -1); etk_box_append(ETK_BOX(vbox), etk_hseparator_new(), ETK_BOX_END, ETK_BOX_FILL, 5); hbox = etk_hbox_new(ETK_FALSE, 3); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_END, ETK_BOX_NONE, 0); button = etk_button_new_from_stock(ETK_STOCK_DIALOG_CLOSE); etk_signal_connect_swapped("clicked", ETK_OBJECT(button), ETK_CALLBACK(_close_cb), win); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_END, ETK_BOX_NONE, 0); return win; }
void show_midi_window_control(void *data){ Etk_Widget *vbox, *vbox1, *hbox; Etk_Widget *frame; Etk_Widget *button; Etk_Widget *label; Etk_Combobox_Item *item; control_port_t * control_port; control_port = (control_port_t *)data; mydata = data; midi_t * midibinding; printf("tenative midi connection to ** %s \n", control_port->control_port_name); if (midi_win_control){ etk_widget_show(ETK_WIDGET(midi_win_control)); return; } midi_win_control = etk_window_new(); etk_window_title_set(ETK_WINDOW(midi_win_control), "Set this controls Midi Properties"); etk_window_resize(ETK_WINDOW(midi_win_control), 200, 0); etk_signal_connect("delete-event", ETK_OBJECT(midi_win_control), ETK_CALLBACK(etk_window_hide_on_delete), NULL); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(midi_win_control), vbox); frame = etk_frame_new("Set Midi Binding for Control"); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5); hbox = etk_hbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), hbox); label = etk_label_new("select control change ch#"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 3); spinnerControl = etk_spinner_new(1.0, 16.0, 1, 1.0, 5.0); etk_box_append(ETK_BOX(hbox), spinnerControl, ETK_BOX_START, ETK_BOX_NONE, 7); etk_signal_connect("value-changed", ETK_OBJECT(spinnerControl), ETK_CALLBACK(_ex_changed_value_control), 3); button = etk_button_new_with_label("Add Binding"); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("clicked", ETK_OBJECT(button), _ex_Binding_Control, mydata); button = etk_button_new_with_label("Remove Binding"); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("clicked", ETK_OBJECT(button), _ex_Remove_Binding_Control, mydata); etk_widget_show_all(midi_win_control); }
/* Creates the window for the progress bar test */ void etk_test_progress_bar_window_create(void *data) { static Etk_Widget *win; Etk_Widget *vbox; Etk_Widget *pbar; Etk_Widget *pbar2; if (win) { etk_widget_show_all(ETK_WIDGET(win)); return; } win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win), "Etk Progress Bar Test"); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); vbox = etk_vbox_new(ETK_TRUE, 5); etk_container_add(ETK_CONTAINER(win), vbox); pbar = etk_progress_bar_new_with_text("0% done"); etk_box_append(ETK_BOX(vbox), pbar, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); pbar2 = etk_progress_bar_new_with_text("Loading..."); etk_progress_bar_pulse_step_set(ETK_PROGRESS_BAR(pbar2), 0.015); etk_box_append(ETK_BOX(vbox), pbar2, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_widget_show_all(win); _etk_test_progress_bar_timer = ecore_timer_add(0.05, _etk_test_progress_bar_update, pbar); _etk_test_progress_bar_timer2 = ecore_timer_add(0.025, _etk_test_progress_bar_update2, pbar2); etk_signal_connect_swapped_by_code(ETK_OBJECT_DESTROYED_SIGNAL, ETK_OBJECT(pbar), ETK_CALLBACK(ecore_timer_del), _etk_test_progress_bar_timer); etk_signal_connect_swapped_by_code(ETK_OBJECT_DESTROYED_SIGNAL, ETK_OBJECT(pbar2), ETK_CALLBACK(ecore_timer_del), _etk_test_progress_bar_timer2); }
void emphasis_init_configgui(Emphasis_Config_Gui *configgui) { Enhance *en; en = enhance_new(); if(en==NULL) { fprintf(stderr, "enhance new failed\n"); return; } configgui->en = en; _emphasis_enhance_callbacks(configgui); enhance_file_load(en, "Config", PACKAGE_DATA_DIR EMPHASIS_CONFIG_GLADE); configgui->window = enhance_var_get(en, "window"); configgui->hostname = enhance_var_get(en, "hostname"); configgui->port = enhance_var_get(en, "port"); configgui->password = enhance_var_get(en, "password"); configgui->xfade = enhance_var_get(en, "crossfade"); configgui->stop = enhance_var_get(en, "stop"); configgui->aspect = enhance_var_get(en, "aspect"); etk_window_wmclass_set(ETK_WINDOW(configgui->window), "emphasis", "Emphasis"); }
void etk_directory_add_dialog_create(entropy_generic_file* parent) { Etk_Widget* vbox; Etk_Widget* hbox; Etk_Widget* label; Etk_Widget* button; etk_directory_add_dialog* dialog = calloc(1, sizeof(etk_directory_add_dialog)); dialog->parent = parent; dialog->window = etk_window_new(); etk_window_title_set(ETK_WINDOW(dialog->window), "Create Directory.."); etk_window_wmclass_set(ETK_WINDOW(dialog->window), "dirdialog", "dirdialog"); etk_widget_size_request_set(ETK_WIDGET(dialog->window), 250, 80); vbox =etk_vbox_new(ETK_FALSE,0); etk_container_add(ETK_CONTAINER(dialog->window), vbox); hbox = etk_hbox_new(ETK_FALSE,0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("Directory Name"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); dialog->entry = etk_entry_new(); etk_box_append(ETK_BOX(hbox), dialog->entry, ETK_BOX_START, ETK_BOX_NONE, 0); hbox = etk_hbox_new(ETK_FALSE,0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); button = etk_button_new_with_label("Create"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_directory_add_dialog_create_cb), dialog); button = etk_button_new_with_label("Cancel"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_directory_add_dialog_cancel_cb), dialog); etk_widget_show_all(dialog->window); }
static void _emphasis_init_player_small(Emphasis_Player_Gui *player) { Etk_Widget *wid; /* controls */ wid = etk_window_new(); etk_window_wmclass_set(ETK_WINDOW(wid), "emphasis controls", "Emphasis"); etk_window_title_set(ETK_WINDOW(wid), "Controls"); etk_window_resize(ETK_WINDOW(wid), 10, 180); etk_widget_hide(wid); etk_signal_connect("delete-event", ETK_OBJECT(wid), ETK_CALLBACK(cb_pack_quit), player); //etk_signal_connect_after("delete-event", ETK_OBJECT(wid), // ETK_CALLBACK(etk_main_quit), NULL); player->small.ctr.window = wid; /* controls */ wid = etk_window_new(); etk_window_wmclass_set(ETK_WINDOW(wid), "emphasis cover", "Emphasis"); etk_window_title_set(ETK_WINDOW(wid), "Cover"); etk_window_resize(ETK_WINDOW(wid), 180, 180); etk_widget_hide(wid); etk_signal_connect("delete-event", ETK_OBJECT(wid), ETK_CALLBACK(cb_pack_quit), player); //etk_signal_connect_after("delete-event", ETK_OBJECT(wid), // ETK_CALLBACK(etk_main_quit), NULL); player->small.cov.window = wid; player->small.packed = ETK_TRUE; }
/* main etk_prefs dialog */ void etk_prefs_show() { Etk_Widget *dialog; // initialize some widgets Etk_Widget *switch_button; Etk_Widget *notebook; /* main dialog to hold everything */ dialog = etk_dialog_new(); etk_window_title_set(ETK_WINDOW(dialog), _("Etk Preferences")); // set title - translatable etk_window_wmclass_set(ETK_WINDOW(dialog), "Etk Preferences", "Etk Preferences"); etk_signal_connect_swapped_by_code(ETK_OBJECT_DESTROYED_SIGNAL, ETK_OBJECT(dialog), ETK_CALLBACK(_etk_prefs_quit_cb), NULL); /* this will hold the current pref's contents */ notebook = etk_notebook_new(); etk_notebook_tabs_visible_set(ETK_NOTEBOOK(notebook), ETK_FALSE); /* Some buttons */ etk_dialog_button_add_from_stock(ETK_DIALOG(dialog), ETK_STOCK_DIALOG_CLOSE, ETK_RESPONSE_CLOSE); etk_dialog_button_add_from_stock(ETK_DIALOG(dialog), ETK_STOCK_DIALOG_APPLY, ETK_RESPONSE_APPLY); etk_dialog_button_add_from_stock(ETK_DIALOG(dialog), ETK_STOCK_DIALOG_OK, ETK_RESPONSE_OK); etk_signal_connect("response", ETK_OBJECT(dialog), ETK_CALLBACK(_etk_prefs_response_cb), dialog); /* button for switching pages */ switch_button = etk_button_new_with_label(_("Go to Engines page")); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(switch_button), ETK_CALLBACK(_etk_prefs_switch_cb), notebook); /* add the button into dialog action area */ etk_dialog_pack_widget_in_action_area(ETK_DIALOG(dialog), switch_button, ETK_BOX_END, ETK_BOX_EXPAND, 0); etk_container_border_width_set(ETK_CONTAINER(dialog), 5); etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), notebook, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* create tabs */ etk_notebook_page_append(ETK_NOTEBOOK(notebook), "Theme", _etk_prefs_theme_tab_create()); etk_notebook_page_append(ETK_NOTEBOOK(notebook), "Engine", _etk_prefs_other_tab_create()); etk_widget_show_all(dialog); }
void image_browser_update(void) { const char *pi; char buf[4096]; Etk_Iconbox_Icon *icon; if (ImageBroserUpdate) { //window title snprintf(buf, 4096, "Choose image for part \"%s\" state: \"%s\"",Cur.part->string, Cur.state->string); etk_window_title_set(ETK_WINDOW(UI_ImageBrowserWin), buf); //iconbox etk_iconbox_unselect_all(ETK_ICONBOX(UI_ImageBrowserIconbox)); pi = edje_edit_state_image_get(edje_o, Cur.part->string, Cur.state->string); if (pi) { icon = etk_iconbox_icon_get_by_label( ETK_ICONBOX(UI_ImageBrowserIconbox), pi); etk_iconbox_icon_select(icon); } //preview //~ snprintf(buf, 4096, "images/%d", edje_edit_image_id_get(edje_o, pi)); //~ printf("IM: %s\n", buf); //~ etk_image_set_from_file(UI_ImageBrowserPreview, Cur.edj_temp_name->string, buf); //~ edje_edit_string_free(pi); //int w, h; //etk_image_size_get (etk_image_new_from_file(icon->filename, icon->edje_group), &w, &h); //printf("W: %d H: %d (%d)\n", w, h, etk_image_new_from_file(icon->filename, icon->edje_group)); //etk_label_set(UI_ImageBrowserSizeLabel, "ciccio"); } else { etk_window_title_set(ETK_WINDOW(UI_ImageBrowserWin), "Image Browser"); } }
void etk_test_evas_object_window_create(void *data) { Evas *evas; Evas_Object *edje_object; Evas_Object *evas_object; static Etk_Widget *window = NULL; Etk_Widget *vbox; Etk_Widget *frame; Etk_Widget *etk_evas_object; int w, h; if (window) { etk_widget_show_all(window); return; } window = etk_window_new(); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(window), ETK_CALLBACK(etk_window_hide_on_delete), NULL); etk_window_title_set(ETK_WINDOW(window), "Etk-Evas Object Test"); evas = etk_toplevel_evas_get(ETK_TOPLEVEL(window)); vbox = etk_vbox_new(ETK_FALSE, 5); /* Add an edje object */ frame = etk_frame_new("Edje Object"); edje_object = edje_object_add(evas); edje_object_file_set(edje_object, PACKAGE_DATA_DIR"/test/clock.edj", "icon"); edje_object_size_min_get(edje_object, &w, &h); edje_extern_object_min_size_set(edje_object, w, h); evas_object_resize(edje_object, w, h); etk_evas_object = etk_evas_object_new(); etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), edje_object); etk_container_add(ETK_CONTAINER(frame), etk_evas_object); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* Add an evas rectangle */ frame = etk_frame_new("Evas Object"); evas_object = evas_object_rectangle_add(evas); evas_object_resize(evas_object, 150, 150); evas_object_color_set(evas_object, 150, 100, 100, 255); etk_evas_object = etk_evas_object_new(); etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), evas_object); etk_container_add(ETK_CONTAINER(frame), etk_evas_object); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_END, ETK_BOX_EXPAND_FILL, 0); etk_container_add(ETK_CONTAINER(window), vbox); etk_widget_show_all(window); }
/* Called when mouse presses the resize grip and when the mouse is moved */ static Etk_Bool _etk_statusbar_mouse_move_cb(Etk_Object *object, Etk_Event_Mouse_Move *event, void *data) { Etk_Statusbar *statusbar; Etk_Toplevel *window; if (!(statusbar = ETK_STATUSBAR(object))) return ETK_TRUE; if (!(window = etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar))) || !ETK_IS_WINDOW(window)) return ETK_TRUE; statusbar->window_width += event->cur.widget.x - event->prev.widget.x; statusbar->window_height += event->cur.widget.y - event->prev.widget.y; etk_window_resize(ETK_WINDOW(window), statusbar->window_width, statusbar->window_height); return ETK_TRUE; }
/* Creates the window for the iconbox test */ void etk_test_iconbox_window_create(void *data) { Etk_Widget *iconbox; if (win) { etk_widget_show_all(ETK_WIDGET(win)); return; } win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win), "Etk Iconbox Test"); etk_window_resize(ETK_WINDOW(win), 600, 330); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); iconbox = etk_iconbox_new(); etk_iconbox_emblem_position_set(ETK_ICONBOX(iconbox), ETK_ICONBOX_EMBLEM_POSITION_TL); etk_container_add(ETK_CONTAINER(win), iconbox); etk_signal_connect_by_code(ETK_WIDGET_MOUSE_DOWN_SIGNAL, ETK_OBJECT(iconbox), ETK_CALLBACK(_etk_test_iconbox_mouse_down_cb), NULL); _etk_test_iconbox_folder_set(ETK_ICONBOX(iconbox), NULL); etk_widget_show_all(win); }
void entropy_etk_delete_dialog_new(entropy_gui_component_instance* instance, Ecore_List* files) { char buf[PATH_MAX]; Etk_Widget* window = etk_window_new(); Etk_Widget* vbox= etk_vbox_new(ETK_TRUE,5); Etk_Widget* hbox = etk_hbox_new(ETK_TRUE,5); Etk_Widget* button; Etk_Widget* label; if (ecore_list_count(files) == 1) { ecore_list_first_goto(files); entropy_generic_file* file = ((entropy_generic_file*)ecore_list_current(files)); snprintf(buf, PATH_MAX, "Are you sure you want to delete '%s/%s'? ", file->path, file->filename); } else { snprintf(buf, PATH_MAX, "Are you sure you want to delete these %d files'? ", ecore_list_count(files)); } etk_window_title_set(ETK_WINDOW(window), buf); etk_container_add(ETK_CONTAINER(window), vbox); label = etk_label_new(buf); etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5); button = etk_button_new_with_label("Yes"); etk_container_add(ETK_CONTAINER(hbox), button); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_delete_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_YES ); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_widget_show(button); button = etk_button_new(); etk_button_label_set(ETK_BUTTON(button), "No"); etk_container_add(ETK_CONTAINER(hbox), button); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_delete_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_NO ); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_widget_show(button); etk_object_data_set(ETK_OBJECT(window), "files", files); etk_object_data_set(ETK_OBJECT(window), "instance", instance); etk_widget_show_all(window); }
/* Creates the window for the canvas test */ void etk_test_canvas_window_create(void *data) { Etk_Widget *vbox; Etk_Widget *button; int i; if (win) { etk_widget_show_all(ETK_WIDGET(win)); return; } win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win), "Etk Canvas Test"); etk_container_border_width_set(ETK_CONTAINER(win), 5); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); vbox = etk_vbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(win), vbox); canvas = etk_canvas_new(); etk_widget_size_request_set(canvas, 500, 350); etk_box_append(ETK_BOX(vbox), canvas, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); button = etk_button_new_from_stock(ETK_STOCK_LIST_ADD); etk_button_label_set(ETK_BUTTON(button), "Add object"); etk_signal_connect_swapped_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_canvas_object_add), canvas); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); /* add some progess bars to the canvas */ for (i = 0; i < 3; i++) { _etk_test_canvas_progress_bars_create(50 + 50 * i, 50 + 50 * i); } etk_widget_show_all(win); }
/* Called when an event occurs on the resize grip of the statusbar */ static void _etk_statusbar_resize_grip_cb(void *data, Evas_Object *obj, const char *emission, const char *source) { Etk_Statusbar *statusbar; if (!(statusbar = ETK_STATUSBAR(data))) return; if (strcmp(emission, "mouse,in") == 0) etk_toplevel_pointer_push(etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar)), ETK_POINTER_RESIZE_BR); else if (strcmp(emission, "mouse,out") == 0) etk_toplevel_pointer_pop(etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar)), ETK_POINTER_RESIZE_BR); else if (strcmp(emission, "mouse,down,1") == 0) { Etk_Toplevel *window; if (!(window = etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar))) || !ETK_IS_WINDOW(window)) return; etk_window_geometry_get(ETK_WINDOW(window), NULL, NULL, &statusbar->window_width, &statusbar->window_height); etk_signal_connect_by_code(ETK_WIDGET_MOUSE_MOVE_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_mouse_move_cb), NULL); } else if (strcmp(emission, "mouse,up,1") == 0) etk_signal_disconnect_by_code(ETK_WIDGET_MOUSE_MOVE_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_mouse_move_cb), NULL); }
void _ex_file_download_dialog(char *url, char *file) { char string[PATH_MAX + 16]; snprintf(string, sizeof(string), "Downloading %s", url); dialog = etk_message_dialog_new(ETK_MESSAGE_DIALOG_INFO, ETK_MESSAGE_DIALOG_CANCEL, string); etk_signal_connect("response", ETK_OBJECT(dialog), ETK_CALLBACK(_ex_file_download_dialog_response), file); etk_container_border_width_set(ETK_CONTAINER(dialog), 4); etk_window_title_set(ETK_WINDOW(dialog), _("Exhibit - Download progress")); progressbar = etk_progress_bar_new(); etk_progress_bar_text_set(ETK_PROGRESS_BAR(progressbar), "0% done"); etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), progressbar, ETK_BOX_END, ETK_BOX_EXPAND_FILL, 2); etk_widget_show_all(dialog); }
/* TODO : documentation */ void emphasis_init_player(Emphasis_Player_Gui *player) { Enhance *en; en = enhance_new(); player->en = en; if(!en) { fprintf(stderr, "Enhance new failed"); exit(1); } player->state = EMPHASIS_SMALL; /* TODO : state toggle full */ _emphasis_enhance_callbacks(player); enhance_file_load(en, "Emphasis", PACKAGE_DATA_DIR EMPHASIS_GLADE); /* TODO : check widget? */ EN_VAR_GET(en, player, window); etk_widget_hide(player->small.window); etk_widget_hide(player->full.window); EN_VAR_GET(en, player, root); player->small.ctr.root = enhance_var_get(en, "small_root_ctrl"); player->small.cov.root = enhance_var_get(en, "small_root_cover"); _emphasis_init_player_small(player); EN_VAR_GET(en, player, cover); EN_VAR_GET(en, player, stop); EN_VAR_GET(en, player, prev); EN_VAR_GET(en, player, play); EN_VAR_GET(en, player, next); EN_VAR_GET(en, player, info); EN_VAR_GET(en, player, progress); //EN_VAR_GET(en, player, time); player->full.time = enhance_var_get(en, "full_time"); EN_VAR_GET(en, player, sound_slider); EN_VAR_GET(en, player, sound_low); EN_VAR_GET(en, player, sound_high); EN_VAR_GET(en, player, random); EN_VAR_GET(en, player, repeat); EN_VAR_GET(en, player, full); player->small.media = enhance_var_get(en, "small_media"); player->media.window = enhance_var_get(en, "media_window"); player->media.root = enhance_var_get(en, "media_root"); player->media.notebook = enhance_var_get(en, "media_notebook"); player->media.paned = enhance_var_get(en, "media_paned"); player->media.pls = enhance_var_get(en, "media_pls"); player->media.artist = enhance_var_get(en, "media_artist"); player->media.album = enhance_var_get(en, "media_album"); player->media.track = enhance_var_get(en, "media_track"); player->media.search_root = enhance_var_get(en, "search_page_root"); player->media.search_combo = enhance_var_get(en, "search_page_combo"); player->media.search_tree = enhance_var_get(en, "search_page_tree"); player->media.pls_list = enhance_var_get(en, "media_pls_list"); player->media.pls_content = enhance_var_get(en, "media_pls_content"); player->media.pls_entry_save = enhance_var_get(en, "media_pls_entry_save"); /* Mediabox buttons init */ player->media.toolbar = enhance_var_get(en, "media_toolbar"); player->media.button_lib = enhance_var_get(en, "media_button_lib"); player->media.button_search = enhance_var_get(en, "media_button_search"); player->media.button_playlists = enhance_var_get(en, "media_button_pls"); player->media.button_stats = enhance_var_get(en, "media_button_stats"); /* enhance completion : col def */ etk_tree_multiple_select_set(ETK_TREE(player->media.artist), ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(player->media.album) , ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(player->media.track) , ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(player->media.pls) , ETK_TRUE); Etk_Tree_Col *col; col = etk_tree_col_new(ETK_TREE(player->media.artist), "Artist", 60, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.artist)); col = etk_tree_col_new(ETK_TREE(player->media.album), "Album", 60, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.album)); col = etk_tree_col_new(ETK_TREE(player->media.track), "Track", 60, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.track)); /* pls */ col = etk_tree_col_new(ETK_TREE(player->media.pls), "Title", 140, 0.0); etk_tree_col_model_add(col, etk_tree_model_image_new()); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.pls), "Time", 30, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.pls), "Artist", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.pls), "Album", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.pls)); /* search page */ etk_tree_multiple_select_set(ETK_TREE(player->media.search_tree), ETK_TRUE); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Artist", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Album", 100, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Title", 200, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Filename", 200, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.search_tree)); /* playlists page */ col = etk_tree_col_new(ETK_TREE(player->media.pls_list), "Playlists", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.pls_list)); col = etk_tree_col_new(ETK_TREE(player->media.pls_content), "Preview", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.pls_content)); /**/ etk_object_data_set(ETK_OBJECT(player->media.artist), "title", "Artist"); etk_object_data_set(ETK_OBJECT(player->media.album) , "title", "Album" ); etk_object_data_set(ETK_OBJECT(player->media.track) , "title", "Track" ); etk_object_data_set(ETK_OBJECT(player->media.artist), "Emphasis_Type", (void*)EMPHASIS_ARTIST); etk_object_data_set(ETK_OBJECT(player->media.album), "Emphasis_Type", (void*)EMPHASIS_ALBUM); etk_object_data_set(ETK_OBJECT(player->media.track), "Emphasis_Type", (void*)EMPHASIS_TRACK); /* enhance completion : dnd */ etk_widget_dnd_source_set(ETK_WIDGET(player->media.artist), ETK_TRUE); etk_widget_dnd_source_set(ETK_WIDGET(player->media.album) , ETK_TRUE); etk_widget_dnd_source_set(ETK_WIDGET(player->media.track) , ETK_TRUE); etk_widget_dnd_dest_set(ETK_WIDGET(player->media.pls), ETK_TRUE); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.artist), ETK_CALLBACK(cb_tree_mlib_clicked), player); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.album ), ETK_CALLBACK(cb_tree_mlib_clicked), player); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.track ), ETK_CALLBACK(cb_tree_mlib_clicked), player); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.pls ), ETK_CALLBACK(cb_tree_pls_clicked), NULL); /* Media pls init */ etk_object_data_set(ETK_OBJECT(player->media.pls_content), "Emphasis_Type", (void*)EMPHASIS_TRACK); /* enhance complection : images */ emphasis_player_cover_set(player, NULL); emphasis_player_vol_image_set(player, 0, PACKAGE_DATA_DIR EMPHASIS_SOUNDL); emphasis_player_vol_image_set(player, 1, PACKAGE_DATA_DIR EMPHASIS_SOUNDR); player->small.cover_size_w = player->small.cover->requested_size.w; player->small.cover_size_h = player->small.cover->requested_size.h; player->full.cover_size_w = player->full.cover->requested_size.w; player->full.cover_size_h = player->full.cover->requested_size.h; /* TEMP configuration, need to add this to enhance */ etk_window_wmclass_set(ETK_WINDOW(player->full.window), "emphasis full", "Emphasis"); etk_window_wmclass_set(ETK_WINDOW(player->small.window), "emphasis small", "Emphasis"); etk_window_wmclass_set(ETK_WINDOW(player->media.window), "emphasis mlib", "Emphasis"); etk_container_border_width_set(ETK_CONTAINER(player->full.window), 5); }
entropy_gui_component_instance * entropy_plugin_layout_create (entropy_core * core) { Etk_Widget *window; entropy_layout_gui *gui; entropy_gui_component_instance *layout; void *(*local_plugin_init) (entropy_core * core, entropy_gui_component_instance *, void *data); entropy_plugin *local; entropy_plugin *meta; entropy_plugin *hover; entropy_plugin *trackback; entropy_gui_component_instance* meta_instance; entropy_gui_component_instance* hover_instance; Etk_Tree_Col* col; Etk_Widget* vbox; Etk_Widget* menubar; Etk_Widget* menu_item; Etk_Widget* menu; Eina_List* structures; Entropy_Config_Structure* structure; int local_viewer_selected = 0; /*Entropy related init */ layout = (entropy_gui_component_instance*)entropy_gui_component_instance_layout_new(); /*Create a component instance */ gui = entropy_malloc (sizeof (entropy_layout_gui)); layout->data = gui; layout->core = core; gui->progress_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); gui->properties_request_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); /*Global init for all layouts*/ if (!_etk_layout_global_init) { /*Request metadata groups from evfs*/ entropy_plugin_filesystem_metadata_groups_get(layout); _etk_layout_row_reference = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); _etk_layout_structure_plugin_reference = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); _etk_layout_global_init = 1; } /*Register this layout container with the core, so our children can get events */ entropy_core_layout_register (core, layout); /*Register this instance (the layout itself), to receive events that can be safely handled * by the layout (and reduce the clutter in the child plugins) * i.e. PROGRESS events, Stat for properties, Overwrite yes/no/etc events, etc*/ /*Handle progress events*/ entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_PROGRESS)); /*We want to know if the backend needs feedback */ entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT)); /*We want to know if a stat is an 'extended stat' - e.g. a properties dialog etc */ entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_EXTENDED_STAT)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_STAT)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_METADATA_GROUPS)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_PASTE_REQUEST)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_AUTH_REQUEST)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_META_ALL_REQUEST)); /*Etk related init */ window = etk_window_new (); layout->gui_object = window; etk_signal_connect("key-down", ETK_OBJECT(window), ETK_CALLBACK(_entropy_etk_layout_key_down_cb), layout); gui->paned = etk_hpaned_new(); etk_signal_connect ("delete-event", ETK_OBJECT (window), ETK_CALLBACK (_etk_window_deleted_cb), layout); etk_window_title_set(ETK_WINDOW(window), "Entropy"); etk_window_wmclass_set(ETK_WINDOW(window), "entropy", "Entropy"); vbox = etk_vbox_new(ETK_FALSE,0); etk_container_add(ETK_CONTAINER(window), vbox); /*Tree init*/ gui->tree = etk_tree_new(); gui->tree_shell = etk_vbox_new(ETK_FALSE,0); etk_box_append(ETK_BOX(gui->tree_shell), gui->tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_paned_child1_set(ETK_PANED(gui->paned), gui->tree_shell, ETK_FALSE); etk_tree_mode_set(ETK_TREE(gui->tree), ETK_TREE_MODE_TREE); col = etk_tree_col_new(ETK_TREE(gui->tree), _("Folders"), 60,0.0); etk_tree_col_model_add(col, etk_tree_model_image_new()); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_col_expand_set(col, ETK_TRUE); etk_tree_build(ETK_TREE(gui->tree)); etk_widget_size_request_set(ETK_WIDGET(gui->tree), ENTROPY_ETK_WINDOW_PANE_DEFAULT_X, 50); /*Register to receive events related to the treeview config*/ entropy_config_misc_callback_register("general.treeviewer", _entropy_layout_etk_simple_config_cb, gui); /*If we're configured not to show tree on start, don't show*/ if (!entropy_config_misc_is_set("general.treeviewer")) { entropy_etk_layout_tree_show(gui,0); } else { etk_paned_position_set(ETK_PANED(gui->paned), ENTROPY_ETK_WINDOW_PANE_DEFAULT_X); } /*LocalShell Init*/ gui->localshell = etk_vbox_new(ETK_TRUE,0); etk_paned_child2_set(ETK_PANED(gui->paned), gui->localshell, ETK_TRUE); /*Trackback container init*/ gui->trackback_shell = etk_vbox_new(ETK_TRUE,0); /*Popup init*/ gui->popup = etk_menu_new(); etk_signal_connect("row-clicked", ETK_OBJECT( gui->tree ), ETK_CALLBACK(_etk_layout_row_clicked), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Delete this location"), ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_etk_layout_location_delete_confirm_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add a new location"), ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL); for (structures = entropy_config_standard_structures_parse (layout, NULL); structures; ) { structure = structures->data; layout_etk_simple_add_header (layout,structure); structures = structures->next; } /*Initialise the list view*/ local = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "listviewer"); if (local) { local_plugin_init = dlsym (local->dl_ref, "entropy_plugin_gui_instance_new"); gui->list_viewer = (*local_plugin_init)(core, layout,NULL); gui->list_viewer->plugin = local; if (entropy_config_misc_is_set("general.listviewer")) { gui->list_viewer->active=1; local_viewer_selected = 1; etk_widget_show(gui->list_viewer->gui_object); etk_box_append(ETK_BOX(gui->localshell), gui->list_viewer->gui_object, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); } else { gui->list_viewer->active=0; etk_widget_show(gui->list_viewer->gui_object); } } /*Initialise the icon viewer*/ /*Initialise the list view*/ local = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "iconviewer"); if (local) { local_plugin_init = dlsym (local->dl_ref, "entropy_plugin_gui_instance_new"); gui->iconbox_viewer = (*local_plugin_init)(core, layout,NULL); gui->iconbox_viewer->plugin = local; if (entropy_config_misc_is_set("general.iconviewer")) { gui->iconbox_viewer->active=1; local_viewer_selected = 1; etk_widget_show(gui->iconbox_viewer->gui_object); etk_box_append(ETK_BOX(gui->localshell), gui->iconbox_viewer->gui_object, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); } else { gui->iconbox_viewer->active=0; etk_widget_show(gui->iconbox_viewer->gui_object); } } /*Initialise the metadata plugin*/ meta = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_INFO_PROVIDER); if (meta) { local_plugin_init = dlsym(meta->dl_ref, "entropy_plugin_gui_instance_new"); meta_instance = (*local_plugin_init)(core,layout,NULL); meta_instance->plugin = meta; } /*Initialise the hover viewer*/ hover = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_HOVER_PROVIDER); if (hover) { local_plugin_init = dlsym(hover->dl_ref, "entropy_plugin_gui_instance_new"); hover_instance = (*local_plugin_init)(core,layout,NULL); hover_instance->plugin = hover; } /*Initialise the trackback*/ trackback = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "trackback"); if (trackback) { local_plugin_init = dlsym (trackback->dl_ref, "entropy_plugin_gui_instance_new"); gui->trackback = (*local_plugin_init)(core, layout,NULL); gui->trackback->plugin = trackback; gui->trackback->active=1; if (entropy_config_misc_is_set("general.trackback")) { etk_box_append(ETK_BOX(gui->trackback_shell), gui->trackback->gui_object, ETK_BOX_START, ETK_BOX_NONE, 0); } entropy_config_misc_callback_register("general.trackback", _entropy_layout_etk_simple_config_cb, gui); } /*Menu setup*/ menubar = etk_menu_bar_new(); /*File menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("File"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Exit"), ETK_STOCK_SYSTEM_SHUTDOWN, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_layout_simple_exit_cb), layout); /*Edit menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Edit"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Cut"), ETK_STOCK_EDIT_CUT, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_cut_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Copy"), ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_copy_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Paste"), ETK_STOCK_EDIT_PASTE, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_paste_cb), layout); /*Tools menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Tools"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add Location"), ETK_STOCK_ADDRESS_BOOK_NEW, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_location_add_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("eFolder Wizard.."), ETK_STOCK_ADDRESS_BOOK_NEW, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_etk_efolder_dialog_show_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Program Associations.."), ETK_STOCK_EMBLEM_SYMBOLIC_LINK, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_mime_dialog_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Options.."), ETK_STOCK_EMBLEM_SYMBOLIC_LINK, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_options_dialog_cb), layout); /*View menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("View"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); gui->tree_view_menu = _entropy_etk_menu_check_item_new(_("Tree View"), ETK_MENU_SHELL(menu)); if (entropy_config_misc_is_set("general.treeviewer")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(gui->tree_view_menu),ETK_TRUE ); } etk_signal_connect("activated", ETK_OBJECT(gui->tree_view_menu), ETK_CALLBACK(entropy_etk_layout_tree_cb), layout); menu_item = _entropy_etk_menu_check_item_new(_("Trackback view"), ETK_MENU_SHELL(menu)); if (entropy_config_misc_is_set("general.trackback")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE); } etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_layout_trackback_cb), layout); _entropy_etk_menu_item_new(ETK_MENU_ITEM_SEPARATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL); menu_item = _entropy_etk_radio_item_new(_("List View (Alt-l)"), NULL, ETK_MENU_SHELL(menu)); etk_object_data_set(ETK_OBJECT(menu_item), "VISUAL", gui->list_viewer); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_local_viewer_cb), layout); if (entropy_config_misc_is_set("general.listviewer")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE); } menu_item = _entropy_etk_radio_item_new(_("Icon View (Alt-i)"), ETK_MENU_ITEM_RADIO(menu_item), ETK_MENU_SHELL(menu)); etk_object_data_set(ETK_OBJECT(menu_item), "VISUAL", gui->iconbox_viewer); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_local_viewer_cb), layout); if (entropy_config_misc_is_set("general.iconviewer")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE); } /*Debug menu*/ /*menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Debug"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("File Cache"), ETK_STOCK_PLACES_FOLDER_SAVED_SEARCH, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_file_cache_dialog_cb), layout);*/ /*Help menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Help"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("About.."), ETK_STOCK_HELP_BROWSER, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_about_dialog_cb), layout); etk_box_append(ETK_BOX(vbox), menubar, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(vbox), gui->trackback_shell, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(vbox), gui->paned, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /*---------------------------*/ gui->statusbar_box = etk_hbox_new(ETK_TRUE, 0); etk_box_append(ETK_BOX(vbox), gui->statusbar_box, ETK_BOX_START, ETK_BOX_NONE, 0); gui->statusbars[0] = etk_statusbar_new(); etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[0]), ETK_FALSE); etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[0], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); gui->statusbars[1] = etk_statusbar_new(); etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[1]), ETK_FALSE); etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[1], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); gui->statusbars[2] = etk_statusbar_new(); etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[2]), ETK_TRUE); etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[2], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_widget_show_all (window); /*Increment the window counter*/ _etk_layout_window_count++; etk_window_resize(ETK_WINDOW(window), ENTROPY_ETK_WINDOW_WIDTH, ENTROPY_ETK_WINDOW_HEIGHT); return layout; }
void show_midi_window(void *data){ Etk_Widget *vbox, *vbox1, *hbox; Etk_Widget *frame; Etk_Widget *button; Etk_Widget *label; Etk_Combobox_Item *item; midi_t * midibinding; if (midi_win){ etk_widget_show(ETK_WIDGET(midi_win)); return; } midibinding = (midi_t *)evas_list_nth(live_plugin->midi_data, (int)etk_tree_row_data_get(etk_tree_selected_row_get(rack_tree))-1); if(midibinding->channel != 0){ spinner_data = midibinding->channel; }else{ spinner_data = 1; } spinner1_data = midibinding->program; midi_win = etk_window_new(); etk_window_title_set(ETK_WINDOW(midi_win), "Set Midi Properties"); etk_window_resize(ETK_WINDOW(midi_win), 200, 0); etk_signal_connect("delete-event", ETK_OBJECT(midi_win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(midi_win), vbox); frame = etk_frame_new("Set Midi Binding for Rack State"); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5); hbox = etk_hbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), hbox); label = etk_label_new("ch#"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 3); spinner = etk_spinner_new(1.0, 16.0, midibinding->channel, 1.0, 5.0); etk_box_append(ETK_BOX(hbox), spinner, ETK_BOX_START, ETK_BOX_NONE, 7); etk_signal_connect("value-changed", ETK_OBJECT(spinner), ETK_CALLBACK(_ex_changed_value), 1); combobox = etk_combobox_new_default(); etk_box_append(ETK_BOX(hbox), combobox, ETK_BOX_START, ETK_BOX_NONE, 2); item = etk_combobox_item_append(ETK_COMBOBOX(combobox), "Program Change"); etk_combobox_item_data_set(item, 1); if(midibinding->type==1){ etk_combobox_active_item_set(combobox, item); } item = etk_combobox_item_append(ETK_COMBOBOX(combobox), "Control Change"); etk_combobox_item_data_set(item, 2); if(midibinding->type==2){ etk_combobox_active_item_set(combobox, item); } spinner1 = etk_spinner_new(0.0, 127.0, midibinding->program, 1.0, 5.0); etk_box_append(ETK_BOX(hbox), spinner1, ETK_BOX_START, ETK_BOX_NONE, 7); etk_signal_connect("value-changed", ETK_OBJECT(spinner1), ETK_CALLBACK(_ex_changed_value), 2); /* button = etk_button_new_with_label("Learn"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); */ button = etk_button_new_with_label("Add Binding"); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("clicked", ETK_OBJECT(button), _ex_Binding, data); etk_widget_show_all(midi_win); }
/* Creates the window for the tree test */ void etk_test_tree_window_create(void *data) { static Etk_Widget *win = NULL; Etk_Widget *vbox; Etk_Widget *hbox; Etk_Widget *tree; Etk_Widget *button; Etk_Tree_Col *col1, *col2, *col3, *col4, *col5, *col6; Etk_Tree_Row *row; Etk_Widget *statusbar; Etk_Color c_warn; char row_name[128]; const char *stock_key; int i, j; if (win) { etk_widget_show(ETK_WIDGET(win)); return; } /* Create the window and the vbox where the widgets will be packed into */ win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win), "Etk Tree Test"); etk_window_resize(ETK_WINDOW(win), 640, 500); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(win), vbox); /* Create the tree widget */ tree = etk_tree_new(); etk_tree_mode_set(ETK_TREE(tree), ETK_TREE_MODE_TREE); etk_scrolled_view_extra_vmargin_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), 250); etk_scrolled_view_drag_bouncy_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), ETK_BOUNCY_STOPTOOBJECT); etk_scrolled_view_dragable_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(tree), ETK_TRUE); etk_widget_padding_set(tree, 5, 5, 5, 5); etk_box_append(ETK_BOX(vbox), tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* We first create the columns of the tree, and then we "build" the tree with etk_tree_build() */ col1 = etk_tree_col_new(ETK_TREE(tree), "Column 1", 130, 0.0); etk_tree_col_model_add(col1, etk_tree_model_image_new()); etk_tree_col_model_add(col1, etk_tree_model_text_new()); col2 = etk_tree_col_new(ETK_TREE(tree), "Column 2", 60, 1.0); etk_tree_col_model_add(col2, etk_tree_model_double_new()); col3 = etk_tree_col_new(ETK_TREE(tree), "Column 3", 80, 0.75); etk_tree_col_model_add(col3, etk_tree_model_int_new()); col4 = etk_tree_col_new(ETK_TREE(tree), "Column 4", 60, 0.0); etk_tree_col_model_add(col4, etk_tree_model_image_new()); col5 = etk_tree_col_new(ETK_TREE(tree), "Column 5", 60, 0.5); etk_tree_col_model_add(col5, etk_tree_model_checkbox_new()); col6 = etk_tree_col_new(ETK_TREE(tree), "Column 6", 60, 0.0); etk_tree_col_model_add(col6, etk_tree_model_progress_bar_new()); etk_tree_build(ETK_TREE(tree)); /* Then we add the rows to the tree. etk_tree_freeze/thaw() is used to improve * the speed when you insert a lot of rows. It is not really important if you * insert only some thousands of rows (here, we insert 3000 rows) */ etk_tree_freeze(ETK_TREE(tree)); etk_theme_color_get(NULL, ETK_COLOR_WARNING_FG, &c_warn.r, &c_warn.g, &c_warn.b, &c_warn.a); for (i = 0; i < 1000; i++) { sprintf(row_name, "Row %d", (i * 3) + 1); stock_key = etk_stock_key_get(ETK_STOCK_PLACES_USER_HOME, ETK_STOCK_SMALL); row = etk_tree_row_append(ETK_TREE(tree), NULL, col1, etk_theme_icon_path_get(), stock_key, row_name, col2, 0.57, col3, rand(), col4, PACKAGE_DATA_DIR "/images/1star.png", NULL, col5, ETK_FALSE, col6, 0.57, "57 %", NULL); for (j = 0; j < 3; j++) { Etk_Tree_Row *current; sprintf(row_name, "Row %d", (i * 3) + 2); stock_key = etk_stock_key_get(ETK_STOCK_PLACES_FOLDER, ETK_STOCK_SMALL); current = etk_tree_row_append(ETK_TREE(tree), row, col1, etk_theme_icon_path_get(), stock_key, row_name, col2, 20.0, col3, rand(), col4, PACKAGE_DATA_DIR "/images/2stars.png", NULL, col5, ETK_TRUE, col6, 0.20, "20 %", NULL); if (j == 2) row = current; } sprintf(row_name, "<font color=#%.2X%.2X%.2X%.2X>Row %d</font>", c_warn.r, c_warn.g, c_warn.b, c_warn.a, (i * 3) + 3); stock_key = etk_stock_key_get(ETK_STOCK_TEXT_X_GENERIC, ETK_STOCK_SMALL); etk_tree_row_append(ETK_TREE(tree), row, col1, etk_theme_icon_path_get(), stock_key, row_name, col2, 300.0, col3, 257, col4, PACKAGE_DATA_DIR "/images/3stars.png", NULL, col5, ETK_TRUE, NULL); } etk_tree_thaw(ETK_TREE(tree)); etk_tree_col_sort_set(col3, _etk_test_tree_compare_cb, NULL); hbox = etk_hbox_new(ETK_TRUE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_FILL, 0); button = etk_button_new_with_label("Sort the tree"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_sort_button_cb), col3); button = etk_button_new_with_label("Insert a sorted row"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_insert_sorted_button_cb), ETK_TREE(tree)); button = etk_button_new_with_label("Select all"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_select_all_cb), ETK_TREE(tree)); button = etk_button_new_with_label("Unselect all"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_unselect_all_cb), ETK_TREE(tree)); /* Finally we create the statusbar used to display the events on the tree */ statusbar = etk_statusbar_new(); etk_box_append(ETK_BOX(vbox), statusbar, ETK_BOX_START, ETK_BOX_FILL, 0); etk_signal_connect_by_code(ETK_WIDGET_KEY_DOWN_SIGNAL, ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_key_down_cb), NULL); etk_signal_connect_by_code(ETK_TREE_ROW_CLICKED_SIGNAL, ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_row_clicked_cb), statusbar); etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL, ETK_OBJECT(col5), ETK_CALLBACK(_etk_test_tree_checkbox_toggled_cb), statusbar); etk_widget_show_all(win); }
Etk_Widget* image_browser_create(void) { Etk_Widget *hbox, *vbox, *vbox2; Etk_Widget *button; Etk_Widget *frame; Etk_Widget *label; Etk_Widget *image; //ImageBrowserWin UI_ImageBrowserWin = etk_window_new(); etk_window_title_set(ETK_WINDOW(UI_ImageBrowserWin), "Image Browser"); etk_window_resize(ETK_WINDOW(UI_ImageBrowserWin), 590, 370); etk_signal_connect("delete-event", ETK_OBJECT(UI_ImageBrowserWin), ETK_CALLBACK(etk_window_hide_on_delete), NULL); etk_container_border_width_set(ETK_CONTAINER(UI_ImageBrowserWin), 5); hbox = etk_hbox_new(ETK_FALSE, 0); etk_container_add (ETK_CONTAINER(UI_ImageBrowserWin), hbox); //ImageBrowserIconbox UI_ImageBrowserIconbox = etk_iconbox_new(); etk_signal_connect("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox), ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL); etk_box_append(ETK_BOX(hbox), UI_ImageBrowserIconbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox = etk_vbox_new(ETK_FALSE, 0); etk_box_append (ETK_BOX(hbox), vbox, ETK_BOX_START, ETK_BOX_NONE, 5); //AddImageButton button = etk_button_new_from_stock(ETK_STOCK_DOCUMENT_OPEN); etk_object_properties_set(ETK_OBJECT(button), "label","Import image",NULL); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_window_all_button_click_cb), (void*)TOOLBAR_IMAGE_FILE_ADD); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); //DeleteImageButton button = etk_button_new_from_stock(ETK_STOCK_EDIT_DELETE); etk_object_properties_set(ETK_OBJECT(button), "label","Remove image",NULL); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_widget_disabled_set(button, 1); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); //EditImageButton button = etk_button_new_with_label("Edit Image"); image = etk_image_new_from_edje(EdjeFile, "GIMP.PNG"); etk_button_image_set(ETK_BUTTON(button), ETK_IMAGE(image)); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_widget_disabled_set(button, 1); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); //ImageInfo frame = etk_frame_new("Image Info"); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 10); vbox2 = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), vbox2); label = etk_label_new("<b>name:</b>"); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("Unknow"); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new(" "); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_ImageBrowserSizeLabel = etk_label_new("<b>size:</b> Unknow"); etk_object_properties_set(ETK_OBJECT(UI_ImageBrowserSizeLabel), "xalign", 0, NULL); etk_box_append(ETK_BOX(vbox2), UI_ImageBrowserSizeLabel, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("<b>comp:</b> Unknow"); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); //CloseButton button = etk_button_new_from_stock(ETK_STOCK_DIALOG_CLOSE); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_BROWSER_CLOSE); etk_box_append(ETK_BOX(vbox), button, 0, ETK_BOX_NONE, 0); return UI_ImageBrowserWin; }
/* Sets the folder displayed in the iconbox */ static void _etk_test_iconbox_folder_set(Etk_Iconbox *iconbox, const char *folder) { Eina_List *files; Eina_List *l; char *filename; char file_path[PATH_MAX]; Etk_Iconbox_Icon *iicon; if (!iconbox) return; if (!folder && !(folder = getenv("HOME"))) return; if (!(files = ecore_file_ls(folder))) return; etk_iconbox_clear(iconbox); etk_iconbox_append(iconbox, etk_theme_icon_path_get(), "actions/go-up_48", ".."); /* First, add the folders */ EINA_LIST_FOREACH(files, l, filename) { if (filename[0] == '.') continue; snprintf(file_path, PATH_MAX, "%s/%s", folder, filename); if (!ecore_file_is_dir(file_path)) continue; iicon = etk_iconbox_append(iconbox, etk_theme_icon_path_get(), "places/folder_48", filename); if (!ecore_file_can_read(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "unreadable"); else if (!ecore_file_can_write(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "readonly"); } /* Then the files */ EINA_LIST_FOREACH(files, l, filename) { const char *ext; char *icon = NULL; int i; if (filename[0] == '.') continue; snprintf(file_path, PATH_MAX, "%s/%s", folder, filename); if (ecore_file_is_dir(file_path)) continue; if ((ext = strrchr(filename, '.')) && (ext = ext + 1)) { for (i = 0; i < _etk_test_iconbox_num_types; i++) { if (strcasecmp(ext, _etk_test_iconbox_types[i].extension) == 0) { icon = _etk_test_iconbox_types[i].icon; break; } } } iicon = etk_iconbox_append(iconbox, etk_theme_icon_path_get(), icon ? icon : "mimetypes/text-x-generic_48", filename); if (!ecore_file_can_read(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "unreadable"); else if (!ecore_file_can_write(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "readonly"); else if (ecore_file_can_exec(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "system"); } EINA_LIST_FREE(files, filename) free(filename); if (!_etk_test_iconbox_current_folder) _etk_test_iconbox_current_folder = etk_string_new(NULL); etk_string_set(_etk_test_iconbox_current_folder, folder); etk_window_title_set(ETK_WINDOW(win), folder); }
int main (int argc, char *argv[]) { Etk_Widget *window; Etk_Widget *hpaned, *vpaned; Etk_Widget *tree; Etk_Widget *list; Etk_Widget *pdf; Etk_Tree_Col *col; Etk_Tree_Row *row; Ecore_List *index; Epdf_Document *document; int page_count; int i; if (argc == 1) { printf ("Usage: %s pdf_file\n", argv[0]); return -1; } etk_init (argc, argv); /* We open the pdf file */ pdf = etk_pdf_new (); etk_pdf_file_set (ETK_PDF (pdf), argv[1]); document = ETK_PDF (pdf)->pdf_document; if (!document) { printf ("The file %s can't be opened\n", argv[1]); etk_shutdown (); return -1; } window = etk_window_new (); etk_window_title_set (ETK_WINDOW (window), "Etk Pdf Test Application"); etk_signal_connect ("delete-event", ETK_OBJECT (window), ETK_CALLBACK(_quit_cb), NULL); hpaned = etk_hpaned_new(); etk_container_add (ETK_CONTAINER (window), hpaned); etk_widget_show (hpaned); vpaned = etk_vpaned_new(); etk_paned_child1_set (ETK_PANED (hpaned), vpaned, 0); etk_widget_show (vpaned); index = etk_pdf_pdf_index_get (ETK_PDF (pdf)); if (index) { Etk_Tree_Col *col; tree = etk_tree_new (); etk_tree_mode_set (ETK_TREE (tree), ETK_TREE_MODE_TREE); etk_tree_multiple_select_set (ETK_TREE (tree), ETK_FALSE); /* column */ col = etk_tree_col_new (ETK_TREE (tree), "Index", 130, 0.0); etk_tree_col_model_add (col, etk_tree_model_text_new()); etk_tree_build (ETK_TREE (tree)); /* rows */ _tree_fill (ETK_PDF (pdf), ETK_TREE (tree), col, NULL, index); epdf_index_delete (index); /* change page */ etk_signal_connect ("row-clicked", ETK_OBJECT (tree), ETK_CALLBACK(_change_page_cb), pdf); /* we attach and show */ etk_paned_child1_set (ETK_PANED (vpaned), tree, 0); etk_widget_show (tree); } list = etk_tree_new (); etk_tree_headers_visible_set (ETK_TREE (list), ETK_FALSE); etk_tree_mode_set (ETK_TREE (list), ETK_TREE_MODE_LIST); etk_tree_multiple_select_set (ETK_TREE (list), ETK_FALSE); /* column */ col = etk_tree_col_new (ETK_TREE (list), "", 60, 0.0); etk_tree_col_model_add (col, etk_tree_model_int_new()); etk_tree_build (ETK_TREE (list)); /* rows */ page_count = epdf_document_page_count_get (ETK_PDF (pdf)->pdf_document); for (i = 0; i < page_count; i++) { int *num; row = etk_tree_row_append (ETK_TREE (list), NULL, col, i + 1, NULL); num = (int *)malloc (sizeof (int)); *num = i; etk_tree_row_data_set_full (row, num, free); } /* change page */ etk_signal_connect ("row-clicked", ETK_OBJECT (list), ETK_CALLBACK(_change_page_cb), pdf); /* we attach and show */ etk_paned_child2_set (ETK_PANED (vpaned), list, 0); etk_widget_show (list); etk_pdf_scale_set (ETK_PDF (pdf), 0.5, 0.5); etk_paned_child2_set (ETK_PANED (hpaned), pdf, 1); etk_widget_show (pdf); etk_widget_show (window); etk_main (); etk_shutdown (); return 0; }
void entropy_etk_user_interaction_dialog_new(entropy_file_operation* interact) { char buf[PATH_MAX]; Etk_Widget* window = etk_window_new(); Etk_Widget* vbox= etk_vbox_new(ETK_TRUE,5); Etk_Widget* hbox = etk_hbox_new(ETK_TRUE,5); Etk_Widget* button; Etk_Widget* label; snprintf(buf, PATH_MAX, "Confirm overwrite for '%s'? ", interact->file); etk_window_title_set(ETK_WINDOW(window), buf); etk_container_add(ETK_CONTAINER(window), vbox); label = etk_label_new(buf); etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5); button = etk_button_new_with_label("Yes"); etk_container_add(ETK_CONTAINER(hbox), button); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_object_data_set(ETK_OBJECT(button), "operation", (long*)interact->id); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_user_interaction_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_YES ); etk_widget_show(button); button = etk_button_new_with_label("Yes to all"); etk_container_add(ETK_CONTAINER(hbox), button); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_object_data_set(ETK_OBJECT(button), "operation", (long*)interact->id); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_user_interaction_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_YES_TO_ALL ); etk_widget_show(button); button = etk_button_new(); etk_button_label_set(ETK_BUTTON(button), "No"); etk_container_add(ETK_CONTAINER(hbox), button); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_object_data_set(ETK_OBJECT(button), "operation", (long*)interact->id); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_user_interaction_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_NO ); etk_widget_show(button); button = etk_button_new_with_label("No to all"); etk_container_add(ETK_CONTAINER(hbox), button); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_object_data_set(ETK_OBJECT(button), "operation", (long*)interact->id); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_user_interaction_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_NO_TO_ALL ); etk_widget_show(button); button = etk_button_new(); etk_button_label_set(ETK_BUTTON(button), "Abort"); etk_container_add(ETK_CONTAINER(hbox), button); etk_object_data_set(ETK_OBJECT(button), "window", window); etk_object_data_set(ETK_OBJECT(button), "operation", (long*)interact->id); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_user_interaction_dialog_cb), (int*)ENTROPY_USER_INTERACTION_RESPONSE_ABORT ); etk_widget_show(button); etk_widget_show_all(window); etk_widget_show(vbox); etk_widget_show(hbox); }
/*** Implementation ***/ Etk_Widget* data_window_create(void) { Etk_Widget *hbox, *vbox, *hbox2, *vbox2, *vbox3; Etk_Tree_Col *col; Etk_Widget *button; Etk_Widget *frame; Etk_Widget *label; //DataWin UI_DataWin = etk_window_new(); etk_window_title_set(ETK_WINDOW(UI_DataWin), "Data Browser"); etk_window_resize(ETK_WINDOW(UI_DataWin), 400, 370); etk_signal_connect("delete-event", ETK_OBJECT(UI_DataWin), ETK_CALLBACK(etk_window_hide_on_delete), NULL); etk_container_border_width_set(ETK_CONTAINER(UI_DataWin), 5); vbox = etk_vbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(UI_DataWin), vbox); //Description label label = etk_label_new("Data stored inside the edje file that can be accessed by the application."); etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_NONE, 7); hbox = etk_hbox_new(ETK_TRUE, 5); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox2 = etk_vbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(hbox), vbox2, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //UI_DataList UI_DataList = etk_tree_new(); etk_tree_mode_set(ETK_TREE(UI_DataList), ETK_TREE_MODE_LIST); etk_widget_size_request_set(UI_DataList, 225, 200); etk_tree_headers_visible_set(ETK_TREE(UI_DataList), ETK_TRUE); etk_tree_column_separators_visible_set(ETK_TREE(UI_DataList), ETK_TRUE); etk_tree_alternating_row_colors_set(ETK_TREE(UI_DataList), ETK_TRUE); col = etk_tree_col_new(ETK_TREE(UI_DataList), "Name", 100, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(UI_DataList), "Value", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(UI_DataList)); etk_box_append(ETK_BOX(vbox2), UI_DataList, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_signal_connect("row-selected", ETK_OBJECT(UI_DataList), ETK_CALLBACK(_data_list_row_selected_cb), NULL); hbox2 = etk_hbox_new(ETK_TRUE, 0); etk_box_append(ETK_BOX(vbox2), hbox2, ETK_BOX_START, ETK_BOX_NONE, 0); //AddDataButton button = etk_button_new_from_stock(ETK_STOCK_LIST_ADD); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_data_add_button_click_cb), NULL); etk_box_append(ETK_BOX(hbox2), button, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //DelDataButton button = etk_button_new_from_stock(ETK_STOCK_LIST_REMOVE); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_data_del_button_click_cb), NULL); etk_box_append(ETK_BOX(hbox2), button, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox2 = etk_vbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(hbox), vbox2, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //Data Editor frame = etk_frame_new("Data Editor"); etk_box_append(ETK_BOX(vbox2), frame, ETK_BOX_START, ETK_BOX_FILL, 0); vbox3 = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), vbox3); //Name Entry label = etk_label_new("<b>Name</b>"); etk_box_append(ETK_BOX(vbox3), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_DataNameEntry = etk_entry_new(); //etk_widget_disabled_set(UI_DataNameEntry, ETK_TRUE); etk_box_append(ETK_BOX(vbox3), UI_DataNameEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //Value Entry label = etk_label_new("<b>Value</b>"); etk_box_append(ETK_BOX(vbox3), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_DataValueEntry = etk_entry_new(); etk_box_append(ETK_BOX(vbox3), UI_DataValueEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //Apply button UI_DataApplyButton =etk_button_new_from_stock(ETK_STOCK_DIALOG_APPLY); etk_signal_connect("clicked", ETK_OBJECT(UI_DataApplyButton), ETK_CALLBACK(_data_apply_button_click_cb), NULL); etk_box_append(ETK_BOX(vbox3), UI_DataApplyButton, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); return UI_DataWin; }