#include Once "window9.bi"

Function Checkboxgadget( 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 CheckBox , 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)	
	
	CheckBox = gtk_check_button_new_with_label(sText)	
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(CheckBox) ,  9)
	
	gtk_widget_set_size_request(CheckBox, width_, height_)
	
	gtk_fixed_put(GTK_FIXED(vbox), CheckBox, x , y)
	
	g_object_set_data (Cast(Any Ptr, CheckBox), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, CheckBox), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, CheckBox), "W_SIZE" , Cast(Any Ptr,Cint(width_)))
	
	g_object_set_data (Cast(Any Ptr, CheckBox), "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(CheckBox), "event", G_CALLBACK (@EventsCheckBoxGadgetAllFunc), @(fNode->x))
	
	g_signal_connect(G_OBJECT(CheckBox), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))
	
	gtk_widget_show(vBox)

	gtk_widget_show(CheckBox)
	
	Dim As Any Ptr wChild = gtk_bin_get_child(GTK_BIN(CheckBox))
	
	If wChild Then
	
		gtk_widget_modify_font( wChild , pGlobalTypeWindow9->fontCurent)
		
		g_object_set_data (Cast(Any Ptr, CheckBox), "FONT" , Cast(Any Ptr,pGlobalTypeWindow9->fontCurent))

	Endif
	
	Return CheckBox	
	
End Function