#include Once "window9.bi"

Function Optiongadget( iGadget As Long , x As Long, y As Long, width_ As Long, height_ As Long  , sText As String = "",  style As Long = 0 ) As Hwnd Export
	
	Dim As HWND Opt , vBox , mainBox 
	
	Dim As ListT Ptr pListTemp
	
	Freegadget(iGadget)
	
	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)	

	If pGlobalTypeWindow9->OptGroup = 0 Then
	
		Opt = gtk_radio_button_new_with_label(0 , Strptr(sText))

		pGlobalTypeWindow9->OptGroup = gtk_radio_button_get_group (Cast(Any Ptr , Opt))
		
	Else
	
		Opt = gtk_radio_button_new_with_label( Cast(Any Ptr,pGlobalTypeWindow9->OptGroup) , Strptr(sText))
		
		pGlobalTypeWindow9->OptGroup = gtk_radio_button_get_group (Cast(Any Ptr , Opt))

	Endif	
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(Opt) ,  10)
	
	gtk_widget_set_size_request(Opt, width_, height_)
	
	gtk_fixed_put(GTK_FIXED(vbox), Opt, x , y)
	
	g_object_set_data (Cast(Any Ptr, Opt), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, Opt), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, Opt), "W_SIZE" , Cast(Any Ptr,Cint(width_)))
	
	g_object_set_data (Cast(Any Ptr, Opt), "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(Opt), "event", G_CALLBACK (@EventsOptionGadgetAllFunc), @(fNode->x))
	
	g_signal_connect(G_OBJECT(Opt), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))
	
	gtk_widget_show(vbox)
	
	gtk_widget_show(Opt)
	
	Dim As Any Ptr wChild = gtk_bin_get_child(GTK_BIN(opt))
	
	If wChild Then
	
		gtk_widget_modify_font( wChild , pGlobalTypeWindow9->fontCurent)
		
		g_object_set_data (Cast(Any Ptr, opt), "FONT" , Cast(Any Ptr,pGlobalTypeWindow9->fontCurent))

	Endif

	Return Opt	
	
End Function