Enlightenment CVS committal Author : codewarrior Project : e17 Module : proto
Dir : e17/proto/etk/src/bin Modified Files: etk_tree_test.c Log Message: add ability for Etk_Tree to receive drops. once a drop is received, just fetch the current selected row in the drop cb. =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/etk/src/bin/etk_tree_test.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- etk_tree_test.c 14 Feb 2006 18:39:04 -0000 1.23 +++ etk_tree_test.c 20 Feb 2006 02:41:12 -0000 1.24 @@ -3,6 +3,7 @@ #include <stdlib.h> #include "config.h" +static void _etk_test_tree_drag_drop_cb(Etk_Object *object, void *event, void *data); static void _etk_test_tree_add_items(Etk_Tree *tree, int n); static void _etk_test_tree_row_selected(Etk_Object *object, Etk_Tree_Row *row, void *data); static void _etk_test_tree_row_unselected(Etk_Object *object, Etk_Tree_Row *row, void *data); @@ -81,6 +82,8 @@ etk_table_attach(ETK_TABLE(table), label, 1, 1, 0, 0, 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VFILL); tree = etk_tree_new(); + etk_widget_dnd_dest_set(tree, ETK_TRUE); + etk_signal_connect("drag_drop", ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_drag_drop_cb), NULL); etk_widget_size_request_set(tree, 320, 400); etk_table_attach_defaults(ETK_TABLE(table), tree, 1, 1, 1, 1); @@ -130,6 +133,20 @@ etk_widget_show_all(win); } +static void _etk_test_tree_drag_drop_cb(Etk_Object *object, void *event, void *data) +{ + Etk_Event_Selection_Request *ev; + Etk_Tree *tree; + Etk_Tree_Row *row; + char *col1_string, *col3_path; + int col2_value; + + tree = ETK_TREE(object); + row = etk_tree_selected_row_get(tree); + 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(_("Row dropped on %p: \"%s\" %d %s\n"), row, col1_string, col2_value, col3_path); +} + /* Adds n items to the tree */ static void _etk_test_tree_add_items(Etk_Tree *tree, int n) { ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs