#include ONCE "window9.bi"

sub SetStateMenu(menu as HMENU , iNumberMenu as Long , iState 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 exit sub
	
	itemMenu = cast(HMENU , pListTemp->anyTwoData)
	
	select case iState
	
		Case 0
		
			g_object_set_data (cast(any ptr, itemMenu), "Check" , cast(any ptr,cast(integer , 0)))
			
			dim as any ptr plastImage = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(itemMenu))
			
			if plastImage then
				
				gtk_widget_destroy(plastImage)
				
			EndIf
			
			gtk_widget_set_sensitive(itemMenu, TRUE)		
		
		case 1 , 2
			
			gtk_widget_set_sensitive(itemMenu, FALSE)
		
		case 3
		
			g_object_set_data (cast(any ptr, itemMenu), "Check" , cast(any ptr,cast(integer , 1)))
			
			dim as any ptr plastImage = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(itemMenu))
			
			if plastImage then
				
				gtk_widget_destroy(plastImage)
				
			EndIf
			
			gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(itemMenu), gtk_image_new_from_stock(GTK_STOCK_OK , 1))			

	End Select

End Sub