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

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

Undocks all view windows (unix-like)

undocks all view windows (unix-like)

Reimplemented in KBear.

Definition at line 973 of file qextmdimainfrm.cpp.

References findRootDockWidgets(), QextMdiChildView::isToolView(), setUndockPositioningOffset(), and QextMdiChildView::show().

Referenced by KBear::switchToToplevelMode().

{
   if (m_mdiMode == QextMdi::ToplevelMode)
      return;

   QextMdi::MdiMode oldMdiMode = m_mdiMode;

   const int frameBorderWidth  = 7;  // TODO: Can we / do we need to ask the window manager?
   setUndockPositioningOffset( QPoint( 0, (m_pTaskBar ? m_pTaskBar->height() : 0) + frameBorderWidth));

   // 1.) select the dockwidgets to be undocked and store their geometry
#if QT_VERSION < 300
   QList<KDockWidget> rootDockWidgetList;
#else
   QPtrList<KDockWidget> rootDockWidgetList;
#endif
   QValueList<QRect> positionList;
   findRootDockWidgets(&rootDockWidgetList, &positionList);

   // 2.) undock the MDI views of QextMDI
   if (oldMdiMode == QextMdi::ChildframeMode) {
      finishChildframeMode();
   }
   else if (oldMdiMode == QextMdi::TabPageMode) { // if tabified, release all views from their docking covers
      finishTabPageMode();
   }

   // 3.) undock all these found oldest ancestors (being KDockWidgets)
#if QT_VERSION < 300
   QListIterator<KDockWidget> it3( rootDockWidgetList);
#else
   QPtrListIterator<KDockWidget> it3( rootDockWidgetList);
#endif
   for (; it3.current(); ++it3 ) {
       KDockWidget* pDockW = it3.current();
       pDockW->undock();
   }

   // 4.) recreate the MDI childframe area and hide it
   if (oldMdiMode == QextMdi::TabPageMode) {
      if (!m_pDockbaseAreaOfDocumentViews) {
         m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
         m_pDockbaseAreaOfDocumentViews->setEnableDocking(KDockWidget::DockNone);
         m_pDockbaseAreaOfDocumentViews->setDockSite(KDockWidget::DockCorner);
         m_pDockbaseAreaOfDocumentViews->setWidget(m_pMdi);
      }
      // set this dock to main view
      setView(m_pDockbaseAreaOfDocumentViews);
      setMainDockWidget(m_pDockbaseAreaOfDocumentViews);
      m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
   }
   QApplication::sendPostedEvents();
   if (!parentWidget()) {
      m_oldMainFrmMinHeight = minimumHeight();
      m_oldMainFrmMaxHeight = maximumHeight();
      m_oldMainFrmHeight = height();
      if( m_pWinList->count())
         setFixedHeight( height() - m_pDockbaseAreaOfDocumentViews->height());
      else { // consider space for the taskbar
         QApplication::sendPostedEvents();
         setFixedHeight( height() - m_pDockbaseAreaOfDocumentViews->height() + 27);
      }
   }

   // 5. show the child views again
#if QT_VERSION < 300
   QListIterator<QextMdiChildView> it( *m_pWinList);
#else
   QPtrListIterator<QextMdiChildView> it( *m_pWinList);
#endif
   for( it.toFirst(); it.current(); ++it) {
      QextMdiChildView* pView = it.current();
#ifndef NO_KDE2
      XSetTransientForHint(qt_xdisplay(),pView->winId(),winId());
#endif
      if( !pView->isToolView())
         pView->show();
   }

   // 6.) reset all memorized positions of the undocked ones and show them again
   QValueList<QRect>::Iterator it5;
   for (it3.toFirst(), it5 = positionList.begin() ; it3.current(), it5 != positionList.end(); ++it3, ++it5 ) {
       KDockWidget* pDockW = it3.current();
       pDockW->setGeometry( (*it5));
       pDockW->show();
   }

   m_pDockbaseAreaOfDocumentViews->setDockSite(KDockWidget::DockNone);
   m_mdiMode = QextMdi::ToplevelMode;
   //qDebug("ToplevelMode on");
}


Generated by  Doxygen 1.6.0   Back to index