// /// Destruct this DocManager. Close all open documents (views close with them), /// and delete all non-static doc templates /// /// Destroys a TDocManager object removes attached documents templates. The /// constructor resets TDocTemplate::DocTemplateStaticHead to point to the head of /// the static template list. // TDocManager::~TDocManager() { // Iterate through document list, closing and deleting each // TDocument* doc; while ((doc = DocList.Next(0)) != 0) { if (doc->IsOpen()) doc->Close(); // NOTE: deleting the document deletes all attached views, and unlinks // the document from the docmanager's document list // delete doc; // Flush (dispatch) any pending MDI-Child-destroy messages // GetApplication()->PumpWaitingMessages(); } // Reset the 'Docmanager' pointer of static templates and delete // dynamic ones... // while (TemplateList) { TDocTemplate* tpl = TemplateList; TemplateList = tpl->GetNextTemplate(); if (tpl->IsStatic()) tpl->SetDocManager(0); else delete tpl; } }