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

void QextMdiMainFrm::addWindow ( QextMdiChildView pView,
int  flags = QextMdi::StandardAdd 
) [virtual, slot]

One of the most important methods at all! Adds a QextMdiChildView to the MDI system. The main frame takes it under control. You can specify here whether:

  • the view should be attached or detached.
  • shown or hidden
  • maximized, minimized or restored (normalized)
  • added as tool view (stay-on-top and toplevel) or added as document-type view.

Definition at line 255 of file qextmdimainfrm.cpp.

References activateView(), addToolWindow(), QextMdiTaskBar::addWinButton(), attachWindow(), QextMdiChildView::caption(), childViewIsDetachedNow(), childWindowCloseRequest(), detachWindow(), dockMenuItemActivated(), QextMdiChildArea::getCascadePoint(), QextMdiChildView::isAttached(), QextMdiChildView::isMaximized(), QextMdiChildView::maximize(), QextMdiChildView::mdiParent(), QextMdiChildView::minimize(), QextMdiChildView::show(), QextMdiChildView::tabCaption(), windowExists(), and windowMenuItemActivated().

Referenced by addWindow(), KBear::slotCreateClient(), and KBear::slotOptionsShowViewLocal().

{
   if( windowExists( pWnd)) {
      // is already added to the MDI system
      return;
   }

   if( flags & QextMdi::ToolWindow) {
      addToolWindow( pWnd);
      // some kind of cascading
      pWnd->move(m_pMdi->mapToGlobal(m_pMdi->getCascadePoint()));

      return;
   }

   // common connections used when under MDI control
   QObject::connect( pWnd, SIGNAL(clickedInWindowMenu(int)), this, SLOT(windowMenuItemActivated(int)) );
   QObject::connect( pWnd, SIGNAL(focusInEventOccurs(QextMdiChildView*)), this, SLOT(activateView(QextMdiChildView*)) );
   QObject::connect( pWnd, SIGNAL(childWindowCloseRequest(QextMdiChildView*)), this, SLOT(childWindowCloseRequest(QextMdiChildView*)) );
   QObject::connect( pWnd, SIGNAL(attachWindow(QextMdiChildView*,bool)), this, SLOT(attachWindow(QextMdiChildView*,bool)) );
   QObject::connect( pWnd, SIGNAL(detachWindow(QextMdiChildView*,bool)), this, SLOT(detachWindow(QextMdiChildView*,bool)) );
   QObject::connect( pWnd, SIGNAL(clickedInDockMenu(int)), this, SLOT(dockMenuItemActivated(int)) );
   m_pWinList->append(pWnd);
   if (m_pTaskBar) {
      QextMdiTaskBarButton* but = m_pTaskBar->addWinButton(pWnd);
      QObject::connect( pWnd, SIGNAL(tabCaptionChanged(const QString&)), but, SLOT(setNewText(const QString&)) );
   }

   // embed the view depending on the current MDI mode
   if (m_mdiMode == QextMdi::TabPageMode) {
      const QPixmap& wndIcon = pWnd->icon() ? *(pWnd->icon()) : QPixmap();
      KDockWidget* pCover = createDockWidget( pWnd->name(),
                                              wndIcon,
                                              0L,  // parent
                                              pWnd->caption(),
                                              pWnd->tabCaption());
      pCover->setWidget( pWnd);
      pCover->setToolTipString( pWnd->caption());
      if (!(flags & QextMdi::Detach)) {
         m_pDockbaseOfTabPage->setDockSite(KDockWidget::DockFullSite);
         pCover->manualDock( m_pDockbaseOfTabPage, KDockWidget::DockCenter);
         pCover->setEnableDocking(KDockWidget::DockNone);
         if (m_pDockbaseOfTabPage == m_pDockbaseAreaOfDocumentViews) {
            m_pDockbaseAreaOfDocumentViews->undock();
            m_pDockbaseAreaOfDocumentViews->setDockSite(KDockWidget::DockNone);
         }
         else {
           m_pDockbaseOfTabPage->setDockSite(KDockWidget::DockCorner);
         }
         m_pDockbaseOfTabPage = pCover;
      }
      if (!(flags & QextMdi::Hide)) {
         pCover->show();
      }
      pWnd->setFocus();
   }
   else {
      if( (flags & QextMdi::Detach) || (m_mdiMode == QextMdi::ToplevelMode)) {
         detachWindow( pWnd, !(flags & QextMdi::Hide));
         emit childViewIsDetachedNow(pWnd); // fake it because detach won't call it in this case of addWindow-to-MDI
      } else {
         attachWindow( pWnd, !(flags & QextMdi::Hide));
      }

      if ((m_bMaximizedChildFrmMode && !(m_bSDIApplication && (flags & QextMdi::Detach)) && (m_mdiMode != QextMdi::ToplevelMode))
       || (flags & QextMdi::Maximize) ) {
         if (!pWnd->isMaximized())
            pWnd->maximize();
      }
      if (!m_bSDIApplication || (flags & QextMdi::Detach)) {
         if (flags & QextMdi::Minimize)
            pWnd->minimize();
         if (!(flags & QextMdi::Hide)) {
            if (pWnd->isAttached()) {
               pWnd->mdiParent()->show();
            }
            else {
               pWnd->show();
            }
         }
      }
   }
}


Generated by  Doxygen 1.6.0   Back to index