#include "xdrv.h"
#include <stream.h>
#include <InterViews/leave-scope.h>
#include <Dispatch/leave-scope.h>
#include "cgidbg.h"
#include "menu.h"

#include "menmgr.h"

void MenuViewList::about_to_change_menu(Menu * to_change)
{
	if (!to_change) DbgError("MenuViewList::about_to_change_menu",
		"null menu");
	// LogOut << "MenuViewList::about_to_change_menu("<<(void*)to_change<<"\n" ;
	// LogOut << "`" << to_change->GetHeader() << "'\n" ;
	MenuViewListIterator Next(*this);
	MenuView * check ;
	MenuViewList to_delete ;
	while (check = Next())
	  if (check->about_to_change_menu(to_change)) {
			// LogOut << "Request to delete:" << (void *) check << "\n" ;
			to_delete.Append(check);
	}
	MenuViewListIterator Nex(to_delete);
	while (check = Nex()) {
		// LogOut << "Deleting " << (void *) check << "\n" ;
		check->exit_window() ;
	}
}

