#include ONCE "window9.bi"

function GetStateMenu(menu as HMENU , iNumberMenu as Long ) as Long export

	dim as ListT ptr pListTemp
	
	dim as HMENU itemMenu
	
	pListTemp = cast(ListT ptr,pGlobalTypeWindow9->ListMenus->findNodeFunc(cint(iNumberMenu)))
	
	if pListTemp = 0 then return -1
	
	itemMenu = cast(HMENU , pListTemp->anyTwoData)
	
	dim as integer iCheck = cast(integer , g_object_get_data (cast(any ptr, itemMenu), "Check" ) )
	
	dim as Long iDisable = gtk_widget_get_sensitive(itemMenu)
			
	if iDisable = FALSe andalso iCheck = 1 then
	
		return 4
		
	elseif iDisable = FALSe	then
	
		return 1
		
	elseif iCheck = 1 then
	
		return 3
		
	else
	
		return 0

	EndIf

End function