#include "window9.bi"

Sub Expandtreeviewitem(iGadget As Long  , iItem As Integer , iFlagAll As Long)
	
	Dim As Any Ptr treeview = Gadgetid(iGadget)
	
	Dim As Any Ptr treestore = Cast(Any Ptr , gtk_tree_view_get_model(treeview))
	
	Dim As GtkTreeIter iter , iterfirst
	
	Dim As GtkTreePath Ptr path
	
	If gtk_tree_model_get_iter_first(treestore , @iterfirst) Then
		
		iter.stamp =  iterfirst.stamp
		
		iter.user_data = Cast(Any Ptr,iItem)
		
		path = gtk_tree_model_get_path(treestore, @iter)
		
		gtk_tree_view_expand_to_path(treeview,path)
		
		If iFlagAll Then
			
			gtk_tree_view_expand_row(treeview , path , 1)
			
		Else
			
			gtk_tree_view_expand_row(treeview , path , 0)
			
			'If gtk_tree_view_row_expanded(treeview , path) Then
				'
				'gtk_tree_view_collapse_row(treeview , path )
				'
			'Endif
			
		Endif
		
		gtk_tree_path_free(path)
		
	Endif
	
End Sub