#include Once "window9.bi"

Function Progressbargadget( iGadget As Long , x As Long, y As Long, width_ As Long, height_ As Long  , iBeginPos As Long = 0 , iEndPos As Long = 0 , iStyle As Long = PBS_MARQUEE ) As Hwnd Export
	
	Dim As HWND Progress , 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)	
	
	Progress = gtk_progress_bar_new ()
	
	#ifndef __USE_GTK3__
	
	If iStyle And PBS_MARQUEE Then
		
		gtk_progress_bar_set_bar_style(Cast(Any Ptr,progress) , GTK_PROGRESS_DISCRETE)
		
	Elseif 	iStyle And PBS_SMOOTH Then
		
		gtk_progress_bar_set_bar_style(Cast(Any Ptr,progress) , GTK_PROGRESS_CONTINUOUS)
		
	Endif
	
	If iStyle And PBS_VERTICAL Then
		
		gtk_progress_bar_set_orientation(Cast(Any Ptr,progress) , GTK_PROGRESS_BOTTOM_TO_TOP)
		
	Endif	
	
	#endif
	
	If pGlobalTypeWindow9->ListRangeForSliders = 0 Then
		
		pGlobalTypeWindow9->ListRangeForSliders = New LinList
		
	Endif
	
	pGlobalTypeWindow9->ListRangeForSliders->addNodeSub(iGadget , iBeginPos ,  iEndPos)
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(Progress) ,  18)
	
	gtk_widget_set_size_request(Progress, width_, height_)
	
	gtk_fixed_put(GTK_FIXED(vbox), Progress, x , y)
	
	g_object_set_data (Cast(Any Ptr, Progress), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, Progress), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, Progress), "W_SIZE" , Cast(Any Ptr,Cint(width_)))
	
	g_object_set_data (Cast(Any Ptr, Progress), "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(Progress), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))
	
	gtk_widget_show(vbox)
	
	gtk_widget_show(Progress)
	
	Return Progress
	
End Function