boot_panel* bootpanel_create(main_window *win) { boot_panel* pnl; Etk_Widget *scroll,*vbox, *hbox,*text,*frame; pnl = malloc(sizeof(boot_panel)); pnl->win = win; vbox = etk_vbox_new(ETK_FALSE, 5); hbox = etk_hbox_new(ETK_FALSE, 5); pnl->frame = hbox; etk_box_append(ETK_BOX(hbox), vbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); scroll = etk_scrolled_view_new (); etk_box_append(ETK_BOX(vbox), scroll, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_widget_show(scroll); pnl->eth_list = etk_tree_new(); pnl->eth_col0 = etk_tree_col_new(ETK_TREE(pnl->eth_list), _("Interfaces"), 80, 0.0); etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_checkbox_new()); etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_text_new()); etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL, ETK_OBJECT(pnl->eth_col0), ETK_CALLBACK(bootpanel_ethlist_checkbox_change_cb), pnl); etk_tree_mode_set(ETK_TREE(pnl->eth_list), ETK_TREE_MODE_LIST); etk_tree_build(ETK_TREE(pnl->eth_list)); etk_container_add(ETK_CONTAINER(scroll), pnl->eth_list); text = etk_text_view_new(); etk_widget_size_request_set(text, -1, 150); etk_object_properties_set(ETK_OBJECT(text), "focusable", ETK_FALSE, NULL); etk_textblock_text_set(ETK_TEXT_VIEW(text)->textblock, _("<p align=\"center\"><style effect=glow color1=#fa14 color2=#fe87><b>Help!</b></style>" "\n<p>When your computer boot, exalt starts and configure yours networks interfaces in the background. If you use the DHCP, your interface will get a IP address after a while.</p>" "\n<p>You can have a problem if you use a daemon as nfs-client. If the daemon need a network connection when it starts and your interface has no IP address, the daemon will not work. To avoid this problem Exalt can configure your interface in the foreground. If you select the interface in the list, Exalt will wait until your interface gets a IP address.</p>" "\n<p>If the interface doesn't get a IP address before the timeout, your computer will continue the boot process.</p>" ), ETK_TRUE); etk_box_append(ETK_BOX(hbox), text, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); frame=etk_frame_new(_("Timeout")); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_FILL, 0); hbox = etk_hbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(frame), hbox); pnl->slider = etk_hslider_new(1,60,30,1,5); etk_box_append(ETK_BOX(hbox), pnl->slider, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_slider_label_set(ETK_SLIDER(pnl->slider), "%.0f"); etk_signal_connect_by_code(ETK_RANGE_VALUE_CHANGED_SIGNAL, ETK_OBJECT(pnl->slider), ETK_CALLBACK(bootpanel_slider_value_changed_cb), pnl); etk_slider_update_policy_set(ETK_SLIDER(pnl->slider), ETK_SLIDER_DELAYED); bootpanel_update_timeout(pnl); return pnl; }
/* Initializes the members */ static void _etk_dialog_constructor(Etk_Dialog *dialog) { if (!dialog) return; dialog->dialog_vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(dialog), dialog->dialog_vbox); etk_widget_show(dialog->dialog_vbox); dialog->main_area_vbox = etk_vbox_new(ETK_FALSE, 0); etk_widget_internal_set(dialog->main_area_vbox, ETK_TRUE); etk_box_append(ETK_BOX(dialog->dialog_vbox), dialog->main_area_vbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_widget_show(dialog->main_area_vbox); dialog->separator = etk_hseparator_new(); etk_widget_internal_set(dialog->separator, ETK_TRUE); etk_widget_theme_parent_set(dialog->separator, ETK_WIDGET(dialog)); etk_box_append(ETK_BOX(dialog->dialog_vbox), dialog->separator, ETK_BOX_START, ETK_BOX_FILL, 6); etk_widget_show(dialog->separator); dialog->action_area_alignment = etk_alignment_new(0.5, 0.5, 0.0, 0.0); etk_widget_internal_set(dialog->action_area_alignment, ETK_TRUE); etk_box_append(ETK_BOX(dialog->dialog_vbox), dialog->action_area_alignment, ETK_BOX_END, ETK_BOX_FILL, 0); etk_widget_show(dialog->action_area_alignment); dialog->action_area_hbox = etk_hbox_new(ETK_TRUE, 4); etk_widget_internal_set(dialog->action_area_hbox, ETK_TRUE); etk_container_add(ETK_CONTAINER(dialog->action_area_alignment), dialog->action_area_hbox); etk_widget_show(dialog->action_area_hbox); etk_widget_lower(dialog->separator); dialog->has_separator = ETK_TRUE; }
Entrance_Widget ew_group_new(const char *title, int direction) { Entrance_Widget ew = ew_new(); if(!ew) { return NULL; } ew_title_set(ew, title); if(title) { ew->owner = etk_frame_new(title); } else ew->owner = etk_vbox_new(ETK_FALSE, 0); if(direction) /*HORIZONTAL*/ ew->box = etk_hbox_new(ETK_FALSE, 0); else ew->box = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(ew->owner), ew->box); return ew; }
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); }
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; }/*}}}*/
static E_Widget * _e_widget_hbox_handle(Enhance *en, EXML_Node *node) { E_Widget *hbox; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; hbox = _e_widget_new(en, node, etk_hbox_new(ETK_FALSE, 0), id); return hbox; }
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); }
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); }
/** * @brief Sets the toolbar's orientation (horizontal or vertical) * @param toolbar a toolbar * @param orientation the orientation to set */ void etk_toolbar_orientation_set(Etk_Toolbar *toolbar, Etk_Toolbar_Orientation orientation) { Eina_List *children, *l; Etk_Widget *prev_box; if (!toolbar || toolbar->orientation == orientation) return; toolbar->reorientating = ETK_TRUE; prev_box = toolbar->box; toolbar->orientation = orientation; if (toolbar->orientation == ETK_TOOLBAR_VERT) toolbar->box = etk_vbox_new(ETK_FALSE, 0); else toolbar->box = etk_hbox_new(ETK_FALSE, 0); etk_widget_internal_set(toolbar->box, ETK_TRUE); etk_widget_show(toolbar->box); etk_signal_connect_by_code(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_added_cb), toolbar); etk_signal_connect_by_code(ETK_CONTAINER_CHILD_REMOVED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_removed_cb), NULL); children = etk_container_children_get(ETK_CONTAINER(prev_box)); for (l = children; l; l = l->next) etk_toolbar_append(toolbar, ETK_WIDGET(l->data), ETK_BOX_START); eina_list_free(children); etk_object_destroy(ETK_OBJECT(prev_box)); if (toolbar->orientation == ETK_TOOLBAR_VERT) etk_widget_theme_group_set(ETK_WIDGET(toolbar), "vtoolbar"); else etk_widget_theme_group_set(ETK_WIDGET(toolbar), "htoolbar"); etk_widget_parent_set(toolbar->box, ETK_WIDGET(toolbar)); toolbar->reorientating = ETK_FALSE; etk_object_notify(ETK_OBJECT(toolbar), "orientation"); }
/* Initializes the members and build the toolbar */ static void _etk_toolbar_constructor(Etk_Toolbar *toolbar) { if (!toolbar) return; toolbar->style = ETK_TOOLBAR_BOTH_VERT; toolbar->orientation = ETK_TOOLBAR_HORIZ; toolbar->stock_size = ETK_STOCK_MEDIUM; toolbar->reorientating = ETK_FALSE; ETK_WIDGET(toolbar)->size_request = _etk_toolbar_size_request; ETK_WIDGET(toolbar)->size_allocate = _etk_toolbar_size_allocate; ETK_CONTAINER(toolbar)->child_add = _etk_toolbar_child_add; ETK_CONTAINER(toolbar)->child_remove = _etk_toolbar_child_remove; ETK_CONTAINER(toolbar)->children_get = _etk_toolbar_children_get; toolbar->box = etk_hbox_new(ETK_FALSE, 0); etk_widget_parent_set(toolbar->box, ETK_WIDGET(toolbar)); etk_widget_internal_set(ETK_WIDGET(toolbar->box), ETK_TRUE); etk_widget_show(toolbar->box); etk_signal_connect_by_code(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_added_cb), toolbar); etk_signal_connect_by_code(ETK_CONTAINER_CHILD_REMOVED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_removed_cb), NULL); }
/* theme page */ static Etk_Widget *_etk_prefs_theme_tab_create() { Eina_List *themes; Eina_List *l; char *theme; Etk_Widget *preview; Etk_Widget *theme_list; Etk_Widget *preview_hbox; Etk_Widget *frame; Etk_Widget *vbox; Etk_Tree_Col *col1; Etk_Tree_Row *row; /* main vbox */ vbox = etk_vbox_new(ETK_FALSE, 0); /* hbox to hold tree and preview */ preview_hbox = etk_hbox_new(ETK_FALSE, 5); etk_box_append(ETK_BOX(vbox), preview_hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* the preview */ preview = etk_frame_new(_("Preview")); /* tree to hold the theme list */ theme_list = etk_tree_new(); etk_widget_size_request_set(theme_list, 180, 240); etk_tree_mode_set(ETK_TREE(theme_list), ETK_TREE_MODE_LIST); etk_tree_multiple_select_set(ETK_TREE(theme_list), ETK_FALSE); etk_tree_rows_height_set(ETK_TREE(theme_list), 45); etk_tree_headers_visible_set(ETK_TREE(theme_list), ETK_FALSE); etk_signal_connect("row-selected", ETK_OBJECT(theme_list), ETK_CALLBACK(_etk_prefs_theme_row_selected_cb), preview); col1 = etk_tree_col_new(ETK_TREE(theme_list), "Themes", 150, 0.0); etk_tree_col_model_add(col1, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(theme_list)); /* scan for themes and add them to the list */ themes = etk_theme_widget_available_themes_get(); for(l = themes; l; l = l->next) { const char *widget_theme = etk_config_widget_theme_get(); theme = l->data; row = etk_tree_row_append(ETK_TREE(theme_list), NULL, col1, theme, NULL); if (widget_theme) if (!strcmp(theme, widget_theme)) etk_tree_row_select(row); } /* pack tree + preview widget */ etk_box_append(ETK_BOX(preview_hbox), theme_list, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(preview_hbox), preview, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_container_border_width_set(ETK_CONTAINER(vbox), 5); /* add frame */ frame = etk_frame_new(_("Themes")); etk_container_add(ETK_CONTAINER(frame), vbox); return frame; }
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); }
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; }
/*** Implementation ***/ Etk_Widget* state_frame_create(void) { Etk_Widget *vbox; Etk_Widget *hbox; Etk_Widget *label; Etk_Combobox_Item *ComboItem; //vbox vbox = etk_vbox_new(ETK_FALSE, 0); // etk_container_add(ETK_CONTAINER(UI_DescriptionFrame), vbox); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); label = etk_label_new("<b>Name</b>"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //StateEntry UI_StateEntry = etk_entry_new(); UI_StateEntryImage = etk_image_new_from_stock(ETK_STOCK_DIALOG_OK, ETK_STOCK_SMALL); etk_entry_image_set(ETK_ENTRY(UI_StateEntry), ETK_ENTRY_IMAGE_SECONDARY, ETK_IMAGE(UI_StateEntryImage)); etk_box_append(ETK_BOX(hbox), UI_StateEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //UI_StateIndexSpinner //~ UI_StateIndexSpinner = etk_spinner_new(0.0, 1.0, 0.0, 0.1, 1.0); //~ etk_spinner_digits_set(ETK_SPINNER(UI_StateIndexSpinner), 1); //~ etk_widget_size_request_set(UI_StateIndexSpinner,45, 20); //~ etk_box_append(ETK_BOX(hbox),UI_StateIndexSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); label = etk_label_new("<b>Aspect</b>"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); label = etk_label_new("min:"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 1.0, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_AspectMinSpinner UI_AspectMinSpinner = etk_spinner_new(0.0, 100.0, 0.0, 0.1, 1.0); etk_spinner_digits_set(ETK_SPINNER(UI_AspectMinSpinner), 1); etk_widget_size_request_set(UI_AspectMinSpinner,45, 20); etk_box_append(ETK_BOX(hbox), UI_AspectMinSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("max:"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 1.0, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_AspectMaxSpinner UI_AspectMaxSpinner = etk_spinner_new(0.0, 100.0, 0.0, 0.1, 1.0); etk_spinner_digits_set(ETK_SPINNER(UI_AspectMaxSpinner), 1); etk_widget_size_request_set(UI_AspectMaxSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_AspectMaxSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_AspectCombo UI_AspectComboBox = etk_combobox_new(); etk_combobox_column_add(ETK_COMBOBOX(UI_AspectComboBox), ETK_COMBOBOX_LABEL, 30, ETK_COMBOBOX_NONE, 0.0); etk_combobox_build(ETK_COMBOBOX(UI_AspectComboBox)); etk_box_append(ETK_BOX(hbox), UI_AspectComboBox, ETK_BOX_START, ETK_BOX_NONE, 0); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "None"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_NONE); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "Vertical"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_VERTICAL); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "Horizontal"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_HORIZONTAL); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "Both"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_BOTH); //hbox 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("<b>Size</b> min"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateMinWSpinner UI_StateMinWSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMinWSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMinWSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("x"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateMinHSpinner UI_StateMinHSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMinHSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMinHSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("max"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 1.0, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //UI_StateMaxWSpinner UI_StateMaxWSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMaxWSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMaxWSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("x"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateMaxHspinner UI_StateMaxHSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMaxHSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMaxHSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateAlignHSpinner label = etk_label_new("<b>Align</b> H"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_StateAlignHSpinner = etk_spinner_new(0, 1, 0, 0.01, 0.1); etk_spinner_digits_set(ETK_SPINNER(UI_StateAlignHSpinner), 2); etk_widget_size_request_set(UI_StateAlignHSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateAlignHSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateAlignVSpinner label = etk_label_new("V"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_StateAlignVSpinner = etk_spinner_new(0, 1, 0, 0.01, 0.1); etk_spinner_digits_set(ETK_SPINNER(UI_StateAlignVSpinner), 2); etk_widget_size_request_set(UI_StateAlignVSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateAlignVSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateVisibleCheck UI_StateVisibleCheck = etk_check_button_new_with_label("Visible"); etk_widget_padding_set(UI_StateVisibleCheck, 20, 0, 0, 0); etk_box_append(ETK_BOX(hbox), UI_StateVisibleCheck, ETK_BOX_START, ETK_BOX_NONE, 0); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateCCEntry label = etk_label_new("Color Class"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_StateCCEntry = etk_entry_new(); etk_box_append(ETK_BOX(hbox), UI_StateCCEntry, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("key-down", ETK_OBJECT(UI_StateEntry), ETK_CALLBACK(_state_Entry_key_down_cb), NULL); etk_signal_connect("mouse-click", ETK_OBJECT(UI_StateEntryImage), ETK_CALLBACK(_state_EntryImage_clicked_cb), NULL); etk_signal_connect("text-changed", ETK_OBJECT(UI_StateEntry), ETK_CALLBACK(_group_NamesEntry_text_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_AspectMinSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_AspectMaxSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_connect("active-item-changed", ETK_OBJECT(UI_AspectComboBox), ETK_CALLBACK(_state_AspectComboBox_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMinWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMinHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMaxWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMaxHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateAlignVSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNV_SPINNER); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateAlignHSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNH_SPINNER); etk_signal_connect("toggled", ETK_OBJECT(UI_StateVisibleCheck), ETK_CALLBACK(_state_VisibleCheck_toggled_cb), NULL); etk_signal_connect("text-changed", ETK_OBJECT(UI_StateCCEntry), ETK_CALLBACK(_state_CCEntry_text_changed_cb), NULL); return vbox; }
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; }
/* 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); }