#include Once "window9.bi"

Function Containergadget(iGadget As Long , x As Long , y As Long , width_ As Long , height_ As Long, iStyle As Long = 0) As HWND Export
	
	Dim As HWND LayoutContainer , vBox , mainBox
	
	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)	
	
	LayoutContainer = gtk_layout_new (0,0)		
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(LayoutContainer) ,  21)

	gtk_widget_set_size_request(LayoutContainer, width_, height_)
	
	gtk_fixed_put(GTK_FIXED(vbox), LayoutContainer, x , y)
	
	g_object_set_data (Cast(Any Ptr, LayoutContainer), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, LayoutContainer), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, LayoutContainer), "W_SIZE" , Cast(Any Ptr,Cint(width_)))
	
	g_object_set_data (Cast(Any Ptr, LayoutContainer), "H_SIZE" , Cast(Any Ptr,Cint(height_)))	
	
	tree_add_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)
	
	Dim As Node Ptr fNode = tree_find_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)	
	
	'g_signal_connect(G_OBJECT(eventbox), "event", G_CALLBACK (@EventsLayoutContainerGadgetAllFunc), @(fNode->x))
	
	g_signal_connect(G_OBJECT(LayoutContainer), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))
	
	g_object_set_data (Cast(Any Ptr,LayoutContainer), "widget"  , Cast(Any Ptr ,@"layout"))
	
	#ifdef __USE_GTK3__
		
		g_signal_connect(LayoutContainer, "draw", G_CALLBACK(@DrawColorLayoutFunc), NULL)
		
	#endif	
	
	pGlobalTypeWindow9->ListWinAndContainers->addNodeSub( Cint(LayoutContainer) , Cint(LayoutContainer) )
	
	gtk_widget_show(vbox)
	
	gtk_widget_show(LayoutContainer)
	
	pGlobalTypeWindow9->CurentHwnd = LayoutContainer
	
	Return LayoutContainer
		
End Function