#include ONCE "window9.bi"

sub SetButtonToolBarState(iHwndToolBar As Integer ,  IDButton as Integer , iFlag as Long , iState as Long) export
	
	dim as ListT ptr pTemp = pGlobalTypeWindow9->ListToolBar->firstnode
	
	dim as Any ptr iButton
	
	while pTemp
		
		if pTemp->anyOneData = IDButton then
			
			iButton = cast(any ptr,pTemp->anyTwoData)
			
			exit while
			
		EndIf
		
		pTemp = pTemp->nextNode
		
	Wend	
	
	if iButton = 0 then exit sub
	
	select case iFlag
		
		Case 1
		
			gtk_toggle_tool_button_set_active (cast(any ptr, iButton) , iState)
		
		case 2
		
			if iState = 1 then
			
				gtk_widget_set_sensitive(cast(any ptr , iButton) , FALSE)
			
			else
			
				gtk_widget_set_sensitive(cast(any ptr , iButton) , 1)
			
			EndIf				
		
		case 3
		
			if iState = 1 then
			
				gtk_widget_set_visible(cast(any ptr, iButton) , FALSE)
			
			else
			
				gtk_widget_set_visible(cast(any ptr, iButton) , 1)
			
			EndIf			
		
	End Select	 	
	
End Sub