Пример #1
0
bool CMDIfileManager::CloseAll()
{
  size_t nSize = m_mapWindowFile.size();
  int nRunning = nSize ? RunningFrameCount() : 0;
  bool bRtn = !nRunning;
  if(nSize && bRtn)
  {
    CMDI_WF::iterator itr;
    CMDIFrame *pf;

    //  copy all frame pointers because m_mapWindowFile
    //  will change each time a window is closed

    std::list<CMDIFrame *> vpFrame;

    for(itr = m_mapWindowFile.begin();
      bRtn && _IteratorOK(itr);
      ++itr)
    {
      pf = itr->first;
      if(wxDynamicCast(pf,CFrameSample) == NULL)
      {
        vpFrame.push_back(pf);
      }
      else
      {
        vpFrame.push_front(pf);
      }
    }
    for(std::list<CMDIFrame *>::iterator itrv = vpFrame.begin();
      itrv != vpFrame.end();
      ++itrv)
    {
      pf = *itrv;
      itr = m_mapWindowFile.find(pf);
      if(!_IteratorOK(itr))
      {} // prevent window from being destroyed more than one
      else if(!pf->Close(false))
      {
        bRtn = false;
        break;
      }
    }
  }
  return bRtn;
}
Пример #2
0
bool CMDIfileManager::CloseAll()
{
  size_t nSize = m_mapWindowFile.size();
  int nRunning = nSize ? RunningFrameCount() : 0;
  bool bRtn = !nRunning;
  if(nSize && bRtn)
  {
    CMDI_WF::iterator itr;
    CMDIFrame *pf;

    //  copy all frame pointers because m_mapWindowFile
    //  will change each time a window is closed

    vector<CMDIFrame *> vpFrame;
    vpFrame.reserve(nSize);

    for(itr = m_mapWindowFile.begin();
      bRtn && _IteratorOK(itr);
      ++itr)
    {
      vpFrame.push_back(itr->first);
    }

    for(vector<CMDIFrame *>::iterator itrv = vpFrame.begin();
      itrv != vpFrame.end();
      ++itrv)
    {
      pf = *itrv;
      if(!pf->Close(false))
      {
        bRtn = false;
      }
    }
  }
  return bRtn;
}