# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1049329786 0 # Node ID 83edbd751da9c7b5e2bd0860199ddf9c085e44c2 # Parent a07e08f708d6e56bc09005d37e574c1cd31d1682 Added dw_tree_get_data() to get a tree item's data. diff -r a07e08f708d6 -r 83edbd751da9 dw.def --- a/dw.def Wed Apr 02 11:31:38 2003 +0000 +++ b/dw.def Thu Apr 03 00:29:46 2003 +0000 @@ -217,8 +217,9 @@ dw_tree_item_select @377 dw_tree_set_data @378 dw_tree_insert_after @379 + dw_tree_get_data @380 - dw_font_text_extents @380 + dw_font_text_extents @385 dw_slider_new @390 dw_slider_query_pos @391 diff -r a07e08f708d6 -r 83edbd751da9 dw.h --- a/dw.h Wed Apr 02 11:31:38 2003 +0000 +++ b/dw.h Thu Apr 03 00:29:46 2003 +0000 @@ -839,6 +839,7 @@ void API dw_tree_collapse(HWND handle, HWND item); void API dw_tree_item_select(HWND handle, HWND item); void API dw_tree_set_data(HWND handle, HWND item, void *itemdata); +void * API dw_tree_get_data(HWND handle, HWND item); int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator); unsigned long API dw_icon_load(unsigned long module, unsigned long id); unsigned long API dw_icon_load_from_file(char *filename); diff -r a07e08f708d6 -r 83edbd751da9 dww.def --- a/dww.def Wed Apr 02 11:31:38 2003 +0000 +++ b/dww.def Thu Apr 03 00:29:46 2003 +0000 @@ -214,8 +214,9 @@ dw_tree_item_select @377 dw_tree_set_data @378 dw_tree_insert_after @379 + dw_tree_get_data @380 - dw_font_text_extents @380 + dw_font_text_extents @385 dw_slider_new @390 dw_slider_query_pos @391 diff -r a07e08f708d6 -r 83edbd751da9 gtk/dw.c --- a/gtk/dw.c Wed Apr 02 11:31:38 2003 +0000 +++ b/gtk/dw.c Thu Apr 03 00:29:46 2003 +0000 @@ -3946,6 +3946,42 @@ } /* + * Gets the item data of a tree item. + * Parameters: + * handle: Handle to the tree containing the item. + * item: Handle of the item to be modified. + */ +void *dw_tree_get_data(HWND handle, HWND item) +{ + void *ret = NULL; +#if GTK_MAJOR_VERSION > 1 + GtkWidget *tree; + GtkTreeStore *store; + int _locked_by_me = FALSE; + + if(!handle || !item) + return; + + DW_MUTEX_LOCK; + if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) + && GTK_IS_TREE_VIEW(tree) && + (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) + gtk_tree_model_get(store, (GtkTreeIter *)item, 2, &ret, -1); + DW_MUTEX_UNLOCK; +#else + int _locked_by_me = FALSE; + + if(!handle || !item) + return; + + DW_MUTEX_LOCK; + ret = (void *)gtk_object_get_data(GTK_OBJECT(item), "itemdata"); + DW_MUTEX_UNLOCK; +#endif + return ret; +} + +/* * Sets this item as the active selection. * Parameters: * handle: Handle to the tree window (widget) to be selected. diff -r a07e08f708d6 -r 83edbd751da9 os2/dw.c --- a/os2/dw.c Wed Apr 02 11:31:38 2003 +0000 +++ b/os2/dw.c Thu Apr 03 00:29:46 2003 +0000 @@ -5716,6 +5716,21 @@ } /* + * Gets the item data of a tree item. + * Parameters: + * handle: Handle to the tree containing the item. + * item: Handle of the item to be modified. + */ +void * API dw_tree_get_data(HWND handle, HWND item) +{ + PCNRITEM pci = (PCNRITEM)item; + + if(!pci) + return NULL; + return pci->user; +} + +/* * Sets this item as the active selection. * Parameters: * handle: Handle to the tree window (widget) to be selected. diff -r a07e08f708d6 -r 83edbd751da9 win/dw.c --- a/win/dw.c Wed Apr 02 11:31:38 2003 +0000 +++ b/win/dw.c Thu Apr 03 00:29:46 2003 +0000 @@ -5839,6 +5839,28 @@ } /* + * Gets the item data of a tree item. + * Parameters: + * handle: Handle to the tree containing the item. + * item: Handle of the item to be modified. + */ +void * API dw_tree_set_data(HWND handle, HWND item) +{ + TVITEM tvi; + void **ptrs; + + tvi.mask = TVIF_HANDLE; + tvi.hItem = (HTREEITEM)item; + + if(TreeView_GetItem(handle, &tvi)) + { + ptrs = (void **)tvi.lParam; + return ptrs[1]; + } + return NULL; +} + +/* * Sets this item as the active selection. * Parameters: * handle: Handle to the tree window (widget) to be selected.