本文整理汇总了C++中TDocument::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ TDocument::Close方法的具体用法?C++ TDocument::Close怎么用?C++ TDocument::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDocument
的用法示例。
在下文中一共展示了TDocument::Close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//
/// 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;
}
}
示例2: while
//
/// Closes the document but does not delete or detach the document. Before closing
/// the document, Close checks any child documents and tries to close them before
/// closing the parent document. Even if you write your own Close function, call
/// TDocument's version to ensure that all child documents are checked before the
/// parent document is closed.
//
bool
TDocument::Close()
{
TDocument* pdoc = 0;
while ((pdoc = ChildDoc.Next(pdoc)) != 0)
if (!pdoc->Close())
return false;
return true;
}
示例3: GetCurrentDoc
//
/// If the document can be closed it is closed.
//
void
TDocManager::FileClose()
{
TDocument* doc = GetCurrentDoc();
if (doc && doc->CanClose()) { // normally calls back to FlushDoc()
if (!doc->Close())
PostDocError(*doc, IDS_UNABLECLOSE);
else
delete doc;
}
WARNX(OwlDocView, !doc, 0, _T("FileClose invoked with no current doc"));
}
示例4: PostDocError
//
/// Overrideable method invoked just before the DocumentManager creates a new
/// document. The default behaviour is to close and delete the current
/// document if we're in SDI mode.
//
bool
TDocManager::CreatingDoc(TDocTemplate* /*tpl*/)
{
if (Mode & dmSDI) {
TDocument* doc = DocList.Next(0);
if (doc) {
if (!doc->CanClose())
return false;
if (!doc->Close()) {
PostDocError(*doc, IDS_UNABLECLOSE);
return false;
}
delete doc;
}
}
return true;
}