#include ONCE "window9.bi"

private function GetCountTreeViewSub cdecl( model as any ptr, path as any ptr , iter as any ptr , rows as long ptr) as gboolean
	
	*rows+=1
	
	return false
	
End Function

function GetCountItemTreeView(iGadget as Long) as Long export
	
	dim as any ptr treeview = GadgetID(iGadget)
	
	if treeview = 0 then return 0
	
	dim as any ptr model = gtk_tree_view_get_model(treeview)
	
	dim as long rows
	
	gtk_tree_model_foreach( model , cast(any ptr,@GetCountTreeViewSub), @rows )
	
	return rows	
	
End Function