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

void QextMdiMainFrm::attachWindow ( QextMdiChildView pWnd,
bool  bShow = TRUE 
) [virtual, slot]

Makes a main frame controlled undocked QextMdiChildView docked. Doesn't work on QextMdiChildView which aren't added to the MDI system. Use addWindow() for that.

Definition at line 425 of file qextmdimainfrm.cpp.

References QextMdiChildFrm::captionHeight(), QextMdiChildView::hide(), QextMdiChildFrm::m_pClient, QextMdiChildArea::manageChild(), QextMdiChildFrm::setClient(), QextMdiChildFrm::setRestoreGeometry(), switchToChildframeMode(), QextMdiChildArea::topChild(), and QextMdiChildView::youAreAttached().

Referenced by addWindow(), dockMenuItemActivated(), removeWindowFromMdi(), and switchToChildframeMode().

{
   pWnd->installEventFilter(this);

   // decide whether window shall be cascaded
   bool bCascade = FALSE;
   QApplication::sendPostedEvents();
   QRect frameGeo = pWnd->frameGeometry();
   QPoint topLeftScreen = pWnd->mapToGlobal(QPoint(0,0));
   QPoint topLeftMdiChildArea = m_pMdi->mapFromGlobal(topLeftScreen);
   QRect childAreaGeo = m_pMdi->geometry();
   if ( (topLeftMdiChildArea.x() < 0) || (topLeftMdiChildArea.y() < 0) ||
        (topLeftMdiChildArea.x()+frameGeo.width() > childAreaGeo.width()) ||
        (topLeftMdiChildArea.y()+frameGeo.height() > childAreaGeo.height()) ) {
      bCascade = TRUE;
   }

   // create frame and insert child view
   QextMdiChildFrm *lpC=new QextMdiChildFrm(m_pMdi);
   pWnd->hide();
   if (!bCascade) {
      lpC->move(topLeftMdiChildArea);
   }
   lpC->setClient(pWnd);
   lpC->setFocus();
   pWnd->youAreAttached(lpC);
   if( (m_mdiMode == QextMdi::ToplevelMode) && !parentWidget()) {
      setMinimumHeight( m_oldMainFrmMinHeight);
      setMaximumHeight( m_oldMainFrmMaxHeight);
      resize( width(), m_oldMainFrmHeight);
      m_oldMainFrmHeight = 0;
      switchToChildframeMode();
   }

   m_pMdi->manageChild(lpC,FALSE,bCascade);
   if (m_pMdi->topChild() && m_pMdi->topChild()->isMaximized()) {
      QRect r = lpC->geometry();
      lpC->setGeometry(-lpC->m_pClient->x(), -lpC->m_pClient->y(),
                       m_pMdi->width()  + QEXTMDI_MDI_CHILDFRM_DOUBLE_BORDER,
                       m_pMdi->height() + lpC->captionHeight() + QEXTMDI_MDI_CHILDFRM_SEPARATOR + QEXTMDI_MDI_CHILDFRM_DOUBLE_BORDER);
      lpC->setRestoreGeometry(r);
   }      

   if (bShow) {
      lpC->show();
   }

#undef FocusIn
   QFocusEvent fe(QEvent::FocusIn);
   QApplication::sendEvent( pWnd, &fe);

   m_pCurrentWindow  = pWnd;  // required for checking the active item
}


Generated by  Doxygen 1.6.0   Back to index