#include Once "window9.bi"

Function Groupgadget( iGadget As Long , iX As Long , iY As Long , iWidth As Long , iHeight As Long , sText As String = "") As Hwnd Export
	
	Dim As HWND group , vBox , mainBox , label
	
	Dim As ListT Ptr pListTemp

	Freegadget(iGadget)
	
	pGlobalTypeWindow9->OptGroup = 0 ' reset Group OptionGadget
	
	pListTemp = Cast(ListT Ptr,pGlobalTypeWindow9->ListWinAndContainers->findNodeFunc(Cint(pGlobalTypeWindow9->CurentHwnd)))
	
	mainBox = Cast(hwnd , pListTemp->anyTwoData)	

	vbox = gtk_fixed_new()

	gtk_container_add (GTK_CONTAINER(mainBox), vbox)	
	
	label = gtk_label_new (sText)
	
	group = gtk_frame_new (0)
	
	gtk_frame_set_label_widget(Cast(Any Ptr,group) , label)
	
	gtk_frame_set_shadow_type(Cast(Any Ptr,group) , GTK_SHADOW_IN)
	
	gtk_frame_set_label(Cast(Any Ptr,group) , sText)
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(group) ,  16)

	gtk_widget_set_size_request(group, iWidth, iHeight)
	
	gtk_fixed_put(GTK_FIXED(vbox), group, iX , iY)
	
	g_object_set_data (Cast(Any Ptr, group), "X_SIZE" , Cast(Any Ptr,Cint(iX)))
	
	g_object_set_data (Cast(Any Ptr, group), "Y_SIZE" , Cast(Any Ptr,Cint(iY)))
	
	g_object_set_data (Cast(Any Ptr, group), "W_SIZE" , Cast(Any Ptr,Cint(iWidth)))
	
	g_object_set_data (Cast(Any Ptr, group), "H_SIZE" , Cast(Any Ptr,Cint(iHeight)))		
	
	tree_add_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)
	
	Dim As Node Ptr fNode = tree_find_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)	
	
	g_signal_connect(G_OBJECT(group), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))	
	
	gtk_widget_show(vBox)

	gtk_widget_show(group)
	
	Dim As GList Ptr children = gtk_container_get_children(Cast(Any Ptr,group))

	gtk_widget_modify_font(children->Data , pGlobalTypeWindow9->fontCurent)	
	
	Return group	

End Function