Mercurial > dwindows
diff gtk/dw.c @ 317:83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 03 Apr 2003 00:29:46 +0000 |
parents | a07e08f708d6 |
children | aed5d742896d |
line wrap: on
line diff
--- 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.