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

void QextMdiMainFrm::switchToTabPageMode (  )  [virtual, slot]

Docks all view windows (Windows-like)

Reimplemented in KBear.

Definition at line 1199 of file qextmdimainfrm.cpp.

References activeWindow(), QextMdiChildView::caption(), QextMdiChildView::isToolView(), leftTopLevelMode(), QextMdiTaskBar::switchOn(), and QextMdiChildView::tabCaption().

Referenced by KBear::switchToTabPageMode().

{
   QextMdiChildView* pRemActiveWindow = activeWindow();

   if (m_mdiMode == QextMdi::TabPageMode)
      return;  // nothing need to be done

   // make sure that all MDI views are detached
   if (m_mdiMode == QextMdi::ChildframeMode) {
      finishChildframeMode();
   }
   else if (m_mdiMode == QextMdi::ToplevelMode) {
      finishToplevelMode();
   }

   // resize to childframe mode size of the mainwindow if we were in toplevel mode
   if( (m_mdiMode == QextMdi::ToplevelMode) && !parentWidget()) {
      setMinimumHeight( m_oldMainFrmMinHeight);
      setMaximumHeight( m_oldMainFrmMaxHeight);
      resize( width(), m_oldMainFrmHeight);
      m_oldMainFrmHeight = 0;
      //qDebug("TopLevelMode off");
      emit leftTopLevelMode();
      QApplication::sendPostedEvents();

      // restore the old dock szenario which we memorized at the time we switched to toplevel mode
      QDomElement oldDockState = m_pTempDockSession->namedItem("cur_dock_state").toElement();
      readDockConfig( oldDockState);
   }

   if (m_pDockbaseOfTabPage != m_pDockbaseAreaOfDocumentViews) {
      delete m_pDockbaseOfTabPage;
      m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
   }

   m_mdiMode = QextMdi::TabPageMode;

   // tabify all MDI views covered by a KDockWidget
   KDockWidget* pCover = 0L;
#if QT_VERSION < 300
   QListIterator<QextMdiChildView> it4( *m_pWinList);
#else
   QPtrListIterator<QextMdiChildView> it4( *m_pWinList);
#endif
   for( ; it4.current(); ++it4) {
      QextMdiChildView* pView = it4.current();
      if( pView->isToolView())
         continue;
      const QPixmap& wndIcon = pView->icon() ? *(pView->icon()) : QPixmap();
      pCover = createDockWidget( pView->name(),
                                 wndIcon,
                                 0L,  // parent
                                 pView->caption(),
                                 pView->tabCaption());
      pCover->setWidget( pView);
      pCover->setToolTipString( pView->caption());
      m_pDockbaseOfTabPage->setDockSite(KDockWidget::DockFullSite);
      // dock as tab-page
      pCover->manualDock( m_pDockbaseOfTabPage, KDockWidget::DockCenter);
      // update the dockbase
      pCover->setEnableDocking(KDockWidget::DockNone);
      if (m_pDockbaseOfTabPage == m_pDockbaseAreaOfDocumentViews) {
         m_pMdi->reparent(0,QPoint(0,0));
         m_pDockbaseAreaOfDocumentViews->close();
         delete m_pDockbaseAreaOfDocumentViews;
         m_pDockbaseAreaOfDocumentViews = 0L;
         QApplication::sendPostedEvents();
      }
      else {
         m_pDockbaseOfTabPage->setDockSite(KDockWidget::DockCorner);
      }
      m_pDockbaseOfTabPage = pCover;
      setMainDockWidget(pCover);
   }
   if (pCover) {
      if (m_pWinList->count() > 1) { // note: with only 1 page we haven't already tabbed widgets
         // set the first page as active page
#if !defined(NO_KDE2) && (QT_VERSION >= 300)
         QTabWidget* pTab = (QTabWidget*) pCover->parentWidget()->parentWidget();
         if (pTab)
            pTab->showPage(pRemActiveWindow);
#else
         KDockTabCtl* pTab = (KDockTabCtl*) pCover->parentWidget()->parentWidget();
         if (pTab)
            pTab->setVisiblePage(pRemActiveWindow);
#endif
      }
      pRemActiveWindow->setFocus();
   }

   m_pTaskBar->switchOn(FALSE);
   //qDebug("TabPageMode on");
}


Generated by  Doxygen 1.6.0   Back to index