/* Insert a row sorted in the tree */ static int _etk_test_tree_insert_sorted_button_cb(Etk_Object *object, void *data) { Etk_Tree *tree = data; Etk_Tree_Row *row; Etk_Tree_Col *col1, *col2, *col3, *col4, *col5, *col6; const char *stock_key; col1 = etk_tree_nth_col_get(tree, 0); col2 = etk_tree_nth_col_get(tree, 1); col3 = etk_tree_nth_col_get(tree, 2); col4 = etk_tree_nth_col_get(tree, 3); col5 = etk_tree_nth_col_get(tree, 4); col6 = etk_tree_nth_col_get(tree, 5); stock_key = etk_stock_key_get(ETK_STOCK_PLACES_USER_HOME, ETK_STOCK_SMALL); row = etk_tree_row_insert_sorted(ETK_TREE(tree), NULL, col1, etk_theme_icon_path_get(), stock_key, "Sorted Row", col2, 0.42, col3, rand(), col4, PACKAGE_DATA_DIR "/images/1star.png", NULL, col5, ETK_TRUE, col6, 0.42, "42 %", NULL); etk_tree_row_select(row); etk_tree_row_scroll_to(row, ETK_TRUE); return 0; }
void tree_populate(void) { Eina_List *parts, *pp; Eina_List *progs; etk_tree_freeze(ETK_TREE(UI_PartsTree)); etk_tree_clear(ETK_TREE(UI_PartsTree)); parts = pp = edje_edit_parts_list_get(edje_o); while(pp) { printf(" P: %s\n", (char*)pp->data); tree_part_add((char*)pp->data, NULL); pp = pp->next; } edje_edit_string_list_free(parts); progs = pp = edje_edit_programs_list_get(edje_o); while(pp) { tree_program_add((char*)pp->data); pp = pp->next; } edje_edit_string_list_free(progs); etk_tree_row_select(etk_tree_first_row_get (ETK_TREE(UI_PartsTree))); etk_tree_thaw(ETK_TREE(UI_PartsTree)); }
static Etk_Widget *_etk_prefs_other_tab_create() { Eina_List *engines; Eina_List *l; char *engine; Etk_Widget *engine_list; Etk_Widget *frame; Etk_Widget *vbox; Etk_Tree_Col *col1; Etk_Tree_Row *row; /* main vbox */ vbox = etk_vbox_new(ETK_FALSE, 0); /* tree to hold the engines list */ engine_list = etk_tree_new(); etk_widget_size_request_set(engine_list, 180, 240); etk_tree_mode_set(ETK_TREE(engine_list), ETK_TREE_MODE_LIST); etk_tree_multiple_select_set(ETK_TREE(engine_list), ETK_FALSE); etk_tree_rows_height_set(ETK_TREE(engine_list), 45); etk_tree_headers_visible_set(ETK_TREE(engine_list), ETK_FALSE); etk_signal_connect("row-selected", ETK_OBJECT(engine_list), ETK_CALLBACK(_etk_prefs_engine_row_selected_cb), NULL); col1 = etk_tree_col_new(ETK_TREE(engine_list), "Engines", 150, 0.0); etk_tree_col_model_add(col1, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(engine_list)); /* scan for engines and add them to the list */ engines = etk_engine_list_get(); for(l = engines; l; l = l->next) { const char *engine_current = etk_config_engine_get(); engine = l->data; row = etk_tree_row_append(ETK_TREE(engine_list), NULL, col1, engine, NULL); if (engine_current) if (!strcmp(engine, engine_current)) etk_tree_row_select(row); } /* pack tree */ etk_box_append(ETK_BOX(vbox), engine_list, ETK_BOX_START, ETK_BOX_NONE, 0); etk_container_border_width_set(ETK_CONTAINER(vbox), 5); frame = etk_frame_new(_("Engines")); etk_container_add(ETK_CONTAINER(frame), vbox); return frame; }
void midi_change_rack(live_plugin_t * lp, int state, Etk_Tree_Row *trow){ rack_hide(); if(lp->id = live_plugin->id){ set_state(state); }else{ Unpatch_Jack(); live_plugin = lp; Repatch_Jack(); set_state(state); } adjust_rack_ui_controls(); rack_show(); etk_tree_row_select(trow); }
static void _etk_layout_row_clicked(Etk_Object *object, Etk_Tree_Row *row, Etk_Event_Mouse_Down *event, void *data) { entropy_gui_component_instance* instance = data; entropy_layout_gui* gui = instance->data; Entropy_Config_Structure* structure; structure = ecore_hash_get(_etk_layout_row_reference, row); if (event->button == 3 && structure) { gui->delete_row = row; etk_tree_row_select(row); etk_menu_popup(ETK_MENU(gui->popup)); } }
Etk_Bool _data_add_button_click_cb(Etk_Button *button, void *data) { char buf[64]; int i = 0; Etk_Tree_Row *last_row; do snprintf(buf, sizeof(buf), "New data %d", ++i); while (!edje_edit_data_add(edje_o, buf, "New value") && i < 100); data_window_populate(); last_row = etk_tree_last_row_get(ETK_TREE(UI_DataList)); etk_tree_row_select(last_row); etk_tree_row_scroll_to(last_row, 1); return ETK_TRUE; }
Etk_Bool _data_del_button_click_cb(Etk_Button *button, void *data) { const char *name; Etk_Tree_Row *row, *next_row; name = etk_entry_text_get(ETK_ENTRY(UI_DataNameEntry)); if (!name) return ETK_TRUE; row = etk_tree_selected_row_get(ETK_TREE(UI_DataList)); next_row = etk_tree_row_next_get(row); edje_edit_data_del(edje_o, name); etk_tree_row_delete(row); if (!next_row) next_row = etk_tree_last_row_get(ETK_TREE(UI_DataList)); etk_tree_row_select(next_row); return ETK_TRUE; }
/* 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; }