#include ONCE "window9.bi"

function GetButtonToolBarState(iHwndToolBar As Integer ,  IDButton as Integer , iFlag as Long ) 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 return -1
	
	select case iFlag
		
		Case 1
		
			return gtk_toggle_tool_button_get_active (cast(any ptr, iButton))
		
		case 2
		
			if gtk_widget_get_sensitive(cast(any ptr , iButton)) then 
			
				return 0
			
			else 
			
				return 1	
			
			EndIf
		
		case 3
		
			if gtk_widget_get_visible(cast(any ptr, iButton)) then
			
				return 0
			
			else
			
				return 1
			
			EndIf
		
	End Select	 	
	
End function