#include ONCE "window9.bi"

sub DisableGadget( iGadget as Long , iState as Long ) export

	dim as long iClass = GetClassGadget ( iGadget )
	
	dim as Hwnd w , w2
	
	w = GadgetId(iGadget)
	
	select case iClass
	
		Case 1 , 3 , 4 , 6 , 7 , 8 , 9 , 10 , 12 , 13 , 14 , 16 , 18 , 21 , 22 , 23 , 26
		
			w2 = w
			
		case 2 , 11 , 15 , 19 , 20
		
			w2 = gtk_widget_get_parent(w)
			
		case 5
		
			if g_object_get_data(G_OBJECT(w), "notify") then
	
				w2 = gtk_widget_get_parent(w)
				
			else
			
				w2 = w

			EndIf
			
		case 17
		
			#ifdef __USE_GTK3__
			
				w2 = w			
			
			#else
			
				w2 = gtk_widget_get_parent(w)				
			
			#endif

	End Select
	
	select case iState
	
		Case 0
		
			gtk_widget_set_sensitive(cast(any ptr , w2) , TRUE)
			
		case else
		
			gtk_widget_set_sensitive(cast(any ptr , w2) , FALSE)

	End Select

End Sub