#include Once "window9.bi"

Function Panelgadget(iGadget As Long , x As Long , y As Long , iWidth As Long = 0, iHeight As Long  = 0, iSizeIcon As Long = 0 , iStyle As Long = 0) As HWND Export
	
	Dim As HWND panel , vBox , mainBox 
	
	Dim As Long iW , iH
	
	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)
	
	panel = gtk_notebook_new ()
	
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (panel), GTK_POS_TOP)
	
	gtk_notebook_set_scrollable(Cast(Any Ptr,panel) , True)		
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(panel) ,  22)
	
	If iWidth = 0 Then
		
		iW = Windowclientwidth(pGlobalTypeWindow9->CurentHwnd)
		
	Else
		
		iW = iWidth
		
	Endif
	
	If iHeight = 0 Then
		
		iH = Windowclientheight(pGlobalTypeWindow9->CurentHwnd)
		
	Else
		
		iH = iHeight
		
	Endif	
	
	gtk_widget_set_size_request(panel, iW, iH)
	
	gtk_fixed_put(GTK_FIXED(vbox), panel, x , y)
	
	g_object_set_data (Cast(Any Ptr, panel), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, panel), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, panel), "W_SIZE" , Cast(Any Ptr,Cint(iW)))
	
	g_object_set_data (Cast(Any Ptr, panel), "H_SIZE" , Cast(Any Ptr,Cint(iH)))	
	
	tree_add_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)
	
	Dim As Node Ptr fNode = tree_find_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)	
	
	g_signal_connect(G_OBJECT(panel), "button-press-event", G_CALLBACK (@MousePressListViewSub), @(fNode->x))
	
	g_signal_connect(G_OBJECT(panel), "button-release-event", G_CALLBACK (@MousePressListViewSub), @(fNode->x))	
	
	g_signal_connect(G_OBJECT(panel), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))
	
	g_signal_connect(G_OBJECT(panel), "switch-page", G_CALLBACK (@TabsChangePageFunc), @(fNode->x))
	
	gtk_widget_show(vbox)
	
	gtk_widget_show(panel)
	
	Return panel	
	
End Function