#include Once "window9.bi"

Function Calendargadget(iGadget As Long , x As Long, y As Long, width_ As Long, height_ As Long  , style As Long = 0 ) As Hwnd Export
	
	Dim As HWND Calendar , 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)	
	
	calendar = gtk_calendar_new()	
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(calendar) ,  8)

	gtk_widget_set_size_request(calendar, width_, height_)
	
	gtk_fixed_put(GTK_FIXED(vbox), calendar, x , y)
	
	g_object_set_data (Cast(Any Ptr, calendar), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, calendar), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, calendar), "W_SIZE" , Cast(Any Ptr,Cint(width_)))
	
	g_object_set_data (Cast(Any Ptr, calendar), "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(calendar), "event", G_CALLBACK (@EventsCalendarGadgetAllFunc), @(fNode->x))
	
	g_signal_connect(G_OBJECT(calendar), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))	
	
	gtk_widget_show(vbox)
	
	gtk_widget_show(calendar)
	
	gtk_widget_modify_font(calendar , pGlobalTypeWindow9->fontCurent)
	
	Return calendar	

End Function