Enlightenment CVS committal Author : moom16 Project : e17 Module : proto
Dir : e17/proto/etk/src/bin Modified Files: etk_tree_test.c Log Message: * Adds functions to get back the data from a row =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/etk/src/bin/etk_tree_test.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- etk_tree_test.c 23 Oct 2005 22:05:36 -0000 1.8 +++ etk_tree_test.c 23 Oct 2005 23:27:50 -0000 1.9 @@ -7,12 +7,29 @@ return 1; } +static void _etk_test_tree_row_selected(Etk_Object *object, Etk_Tree_Row *row, void *data) +{ + Etk_Tree *tree; + char *col1_string, *col3_path; + int col2_value; + + tree = ETK_TREE(object); + printf(_("Row selected %p %p\n"), object, row); + etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, &col1_string, etk_tree_nth_col_get(tree, 1), &col2_value, etk_tree_nth_col_get(tree, 2), &col3_path, NULL); + printf("\"%s\" %d %s\n\n", col1_string, col2_value, col3_path); +} + +static void _etk_test_tree_row_unselected(Etk_Object *object, Etk_Tree_Row *row, void *data) +{ + printf(_("Row unselected %p %p\n"), object, row); +} + void etk_test_tree_window_create(void *data) { static Etk_Widget *win = NULL; Etk_Widget *tree; - Etk_Tree_Col *col1, *col2, *col3; Etk_Tree_Row *row; + Etk_Tree_Col *col1, *col2, *col3; Etk_Widget *table; Etk_Widget *label; int i; @@ -59,6 +76,8 @@ } etk_tree_thaw(ETK_TREE(tree)); + etk_signal_connect("row_selected", ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_row_selected), NULL); + etk_signal_connect("row_unselected", ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_row_unselected), NULL); /* The list: */ tree = etk_tree_new(); @@ -66,7 +85,8 @@ etk_table_attach_defaults(ETK_TABLE(table), tree, 1, 1, 1, 1); etk_tree_multiple_select_set(ETK_TREE(tree), TRUE); - col1 = etk_tree_col_new(ETK_TREE(tree), _("Column 1"), ETK_TREE_COL_TEXT, 100); + col1 = etk_tree_col_new(ETK_TREE(tree), _("Column 1"), ETK_TREE_COL_ICON_TEXT, 100); + printf("Col 1: %p\n", col1); col2 = etk_tree_col_new(ETK_TREE(tree), _("Column 2"), ETK_TREE_COL_INT, 100); col3 = etk_tree_col_new(ETK_TREE(tree), _("Column 3"), ETK_TREE_COL_IMAGE, 100); etk_tree_build(ETK_TREE(tree)); @@ -74,20 +94,23 @@ etk_tree_freeze(ETK_TREE(tree)); for (i = 0; i < 300; i++) { - etk_tree_append(ETK_TREE(tree), col1, _("Row1"), col2, 1, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row2"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row3"), col2, 3, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row4"), col2, 1, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row5"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row6"), col2, 3, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row7"), col2, 1, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row8"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row9"), col2, 3, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row10"), col2, 1, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row11"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); - etk_tree_append(ETK_TREE(tree), col1, _("Row12"), col2, 3, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row1"), col2, 1, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row2"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row3"), col2, 3, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row4"), col2, 1, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row5"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row6"), col2, 3, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row7"), col2, 1, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row8"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row9"), col2, 3, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row10"), col2, 1, col3, PACKAGE_DATA_DIR "/images/3stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row11"), col2, 2, col3, PACKAGE_DATA_DIR "/images/2stars.png", NULL); + etk_tree_append(ETK_TREE(tree), col1, PACKAGE_DATA_DIR "/images/1star.png", _("Row12"), col2, 3, col3, PACKAGE_DATA_DIR "/images/1star.png", NULL); } etk_tree_thaw(ETK_TREE(tree)); + + etk_signal_connect("row_selected", ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_row_selected), NULL); + etk_signal_connect("row_unselected", ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_row_unselected), NULL); etk_widget_show_all(win); } ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs