当前位置: 首页>>代码示例>>C++>>正文


C++ TDocument::Close方法代码示例

本文整理汇总了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;
  }
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:39,代码来源:docmanag.cpp

示例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;
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:17,代码来源:document.cpp

示例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"));
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:15,代码来源:docmanag.cpp

示例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;
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:22,代码来源:docmanag.cpp


注:本文中的TDocument::Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。