本文整理汇总了C++中TDocument::CanClose方法的典型用法代码示例。如果您正苦于以下问题:C++ TDocument::CanClose方法的具体用法?C++ TDocument::CanClose怎么用?C++ TDocument::CanClose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDocument
的用法示例。
在下文中一共展示了TDocument::CanClose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//
/// Checks to see if all child documents can be closed before closing the current
/// document. If any child returns false, CanClose returns false and aborts the
/// process. If all children return true, calls TDocManager::FlushDoc. If FlushDoc
/// finds that the document has been changed but not saved, it displays a message
/// asking the user to either save the document, discard any changes, or cancel the
/// operation. If the document has not been changed and all children's CanClose
/// functions return true, this CanClose function returns true.
//
bool
TDocument::CanClose()
{
TDocument* pdoc = 0;
while ((pdoc = ChildDoc.Next(pdoc)) != 0)
if (!pdoc->CanClose())
return false;
return DocManager->FlushDoc(*this); // do the UI in the doc manager
}
示例2: while
//
/// Checks to see if all child documents can be closed before closing the current
/// document. If any child returns false, returns false and aborts the process. If
/// all children return true, EvCanClose calls TDocManager::FlushDoc for each
/// document. If FlushDoc finds that the document is dirty, it displays a message
/// asking the user to save the document, discard any changes, or cancel the
/// operation. If the document is not dirty and CanClose returns true, EvCanClose
/// returns true.
//
bool
TDocManager::EvCanClose()
{
TDocument* doc = 0;
while ((doc = DocList.Next(doc)) != 0) {
if (!doc->CanClose()) // normally calls back to FlushDoc()
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: GetObject
void
TDocument::Streamer::Write(opstream& os) const
{
TDocument* o = GetObject();
while (!o->CanClose()) // can't permit cancel here
;
os << o->OpenMode;
_USES_CONVERSION;
os.fwriteString(_W2A(o->DocPath));
os.fwriteString(_W2A(o->Title));
os << o->Template; // templates already streamed, must be so if static
os << o->ParentDoc;
os << o->ViewList; // each view streams out the next
os << TView::NextViewId; // insure that this static var gets set on reload
}
示例5: 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;
}