Logo Search packages:      
Sourcecode: kbear version File versions  Download package

void QextMdiMainFrm::closeWindow ( QextMdiChildView pWnd,
bool  layoutTaskBar = TRUE 
) [virtual, slot]

Removes a QextMdiChildView from the MDI system and from the main frame`s control. Note: The view will be deleted!

Definition at line 620 of file qextmdimainfrm.cpp.

References QextMdiChildView::activate(), QextMdiChildArea::destroyChild(), QextMdiChildArea::getVisibleChildCount(), QextMdiChildView::isAttached(), lastChildViewClosed(), QextMdiChildFrm::m_pClient, QextMdiChildView::mdiParent(), QextMdiTaskBar::removeWinButton(), and QextMdiChildArea::topChild().

Referenced by event(), KBear::event(), and ~QextMdiMainFrm().

{
   //Closes a child window. sends no close event : simply deletes it
   m_pWinList->removeRef(pWnd);
   if (m_pWinList->count() == 0)
      m_pCurrentWindow = 0L;

   if (m_pTaskBar) {
      m_pTaskBar->removeWinButton(pWnd, layoutTaskBar);
   }

   if (m_mdiMode == QextMdi::TabPageMode) {
      if (m_pWinList->count() == 0) {
         if (!m_pDockbaseAreaOfDocumentViews) {
            m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
            m_pDockbaseAreaOfDocumentViews->setWidget(m_pMdi);
            setMainDockWidget(m_pDockbaseAreaOfDocumentViews);
         }
         m_pDockbaseOfTabPage->setDockSite(KDockWidget::DockFullSite);
         m_pDockbaseAreaOfDocumentViews->setEnableDocking(KDockWidget::DockCenter);
         m_pDockbaseAreaOfDocumentViews->manualDock( m_pDockbaseOfTabPage, KDockWidget::DockCenter);
         m_pDockbaseAreaOfDocumentViews->setEnableDocking(KDockWidget::DockNone);
         m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
      }
      KDockWidget* pDockW = (KDockWidget*) pWnd->parentWidget();
      pWnd->reparent(0L, QPoint(0,0));
      pDockW->setWidget(0L);
      if (pDockW == m_pDockbaseOfTabPage) {
#if !defined(NO_KDE2) && (QT_VERSION >= 300)
         QTabWidget* pTab = (QTabWidget*) pDockW->parentWidget()->parentWidget();
         int cnt = pTab->count();
         m_pDockbaseOfTabPage = (KDockWidget*) pTab->page(cnt - 2);
         if (pDockW == m_pDockbaseOfTabPage) {
            m_pDockbaseOfTabPage = (KDockWidget*) pTab->page(cnt - 1); // different to the one deleted next
         }
#else
         KDockTabCtl* pTab = (KDockTabCtl*) pDockW->parentWidget()->parentWidget();
         KDockWidget* pLastPage = (KDockWidget*) pTab->getLastPage();
         m_pDockbaseOfTabPage = (KDockWidget*) pTab->getPrevPage(pLastPage);
         if (pDockW == m_pDockbaseOfTabPage) {
            m_pDockbaseOfTabPage = pLastPage;
         }
#endif
      }
      delete pDockW;
   }
   else if (pWnd->isAttached()) {
      m_pMdi->destroyChild(pWnd->mdiParent());
   }
   else {
      delete pWnd;
      // is not attached
      if (m_pMdi->getVisibleChildCount() > 0) {
         setActiveWindow();
         m_pCurrentWindow = 0L;
         QextMdiChildView* pView = m_pMdi->topChild()->m_pClient;
         if (pView) {
            pView->activate();
         }
      }
      else if (m_pWinList->count() > 0) {
         m_pWinList->last()->activate();
         m_pWinList->last()->setFocus();
      }
   }

   if (!m_pCurrentWindow)
      emit lastChildViewClosed();
}


Generated by  Doxygen 1.6.0   Back to index