#include ONCE "window9.bi"

sub Delete_Menu ( menu as HMENU ) export
	
	if menu = 0 then exit sub
	
	dim as ListT ptr pListTemp , pListBackup
	
	dim as HMENU tempM 
	
	pListTemp = pGlobalTypeWindow9->ListMenus->firstNode
	
	while pListTemp
		
		pListBackup = pListTemp->nextnode
		
		dim as HMENU tempM =  cast(any ptr, pListTemp->anyThreeData) 
		
		do		
			
			if TempM then
				
				if TempM = menu then
					
					pGlobalTypeWindow9->ListMenus->removeNodeSub(pListTemp->anyOneData)
					
					exit do
					
				EndIf	
				
			else
				
				exit do
				
			EndIf
			
			tempM = g_object_get_data (cast(any ptr, tempM), "menumainparent")
			
		loop
		
		pListTemp = pListBackup
		
	wend
	
	gtk_widget_destroy(menu)
	
End Sub