kmdi Library API Documentation

kmdichildview.cpp

00001 //---------------------------------------------------------------------------- 00002 // filename : kmdichildview.cpp 00003 //---------------------------------------------------------------------------- 00004 // Project : KDE MDI extension 00005 // 00006 // begin : 07/1999 by Szymon Stefanek as part of kvirc 00007 // (an IRC application) 00008 // changes : 09/1999 by Falk Brettschneider to create a 00009 // -06/2000 stand-alone Qt extension set of 00010 // classes and a Qt-based library 00011 // 2000-2003 maintained by the KDevelop project 00012 // patches : 02/2000 by Massimo Morin (mmorin@schedsys.com) 00013 // */2000 by Lars Beikirch (Lars.Beikirch@gmx.net) 00014 // 02/2001 by Eva Brucherseifer (eva@rt.e-technik.tu-darmstadt.de) 00015 // 01/2003 by Jens Zurheide (jens.zurheide@gmx.de) 00016 // 00017 // copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it) 00018 // and 00019 // Falk Brettschneider 00020 // email : falkbr@kdevelop.org (Falk Brettschneider) 00021 //---------------------------------------------------------------------------- 00022 // 00023 //---------------------------------------------------------------------------- 00024 // 00025 // This program is free software; you can redistribute it and/or modify 00026 // it under the terms of the GNU Library General Public License as 00027 // published by the Free Software Foundation; either version 2 of the 00028 // License, or (at your option) any later version. 00029 // 00030 //---------------------------------------------------------------------------- 00031 00032 #include "kmdichildview.h" 00033 #include "kmdichildview.moc" 00034 00035 #include <qdatetime.h> 00036 #include <qobjectlist.h> 00037 00038 #include "kmdimainfrm.h" 00039 #include "kmdichildfrm.h" 00040 #include "kmdidefines.h" 00041 #include <kdebug.h> 00042 #include <klocale.h> 00043 #include <qiconset.h> 00044 00045 //============ KMdiChildView ============// 00046 00047 KMdiChildView::KMdiChildView( const QString& caption, QWidget* parentWidget, const char* name, WFlags f ) 00048 : QWidget( parentWidget, name, f ) 00049 , m_focusedChildWidget( 0L ) 00050 , m_firstFocusableChildWidget( 0L ) 00051 , m_lastFocusableChildWidget( 0L ) 00052 , m_stateChanged( true ) 00053 , m_bToolView( false ) 00054 , m_bInterruptActivation( false ) 00055 , m_bMainframesActivateViewIsPending( false ) 00056 , m_bFocusInEventIsPending( false ) 00057 , m_trackChanges( 0 ) 00058 { 00059 setGeometry( 0, 0, 0, 0 ); // reset 00060 if ( caption != 0L ) 00061 m_szCaption = caption; 00062 else 00063 m_szCaption = i18n( "Unnamed" ); 00064 00065 m_sTabCaption = m_szCaption; 00066 setFocusPolicy( ClickFocus ); 00067 installEventFilter( this ); 00068 00069 // store the current time 00070 updateTimeStamp(); 00071 } 00072 00073 00074 //============ KMdiChildView ============// 00075 00076 KMdiChildView::KMdiChildView( QWidget* parentWidget, const char* name, WFlags f ) 00077 : QWidget( parentWidget, name, f ) 00078 , m_focusedChildWidget( 0L ) 00079 , m_firstFocusableChildWidget( 0L ) 00080 , m_lastFocusableChildWidget( 0L ) 00081 , m_stateChanged( true ) 00082 , m_bToolView( false ) 00083 , m_bInterruptActivation( false ) 00084 , m_bMainframesActivateViewIsPending( false ) 00085 , m_bFocusInEventIsPending( false ) 00086 { 00087 setGeometry( 0, 0, 0, 0 ); // reset 00088 m_szCaption = i18n( "Unnamed" ); 00089 m_sTabCaption = m_szCaption; 00090 setFocusPolicy( ClickFocus ); 00091 installEventFilter( this ); 00092 00093 // store the current time 00094 updateTimeStamp(); 00095 } 00096 00097 //============ ~KMdiChildView ============// 00098 00099 KMdiChildView::~KMdiChildView() 00100 { 00101 kdDebug( 760 ) << k_funcinfo << endl; 00102 } 00103 00104 void KMdiChildView::trackIconAndCaptionChanges( QWidget *view ) 00105 { 00106 m_trackChanges = view; 00107 } 00108 00109 00110 //============== internal geometry ==============// 00111 00112 QRect KMdiChildView::internalGeometry() const 00113 { 00114 if ( mdiParent() ) 00115 { // is attached 00116 // get the client area coordinates inside the MDI child frame 00117 QRect posInFrame = geometry(); 00118 // map these values to the parent of the MDI child frame 00119 // (this usually is the MDI child area) and return 00120 QPoint ptTopLeft = mdiParent() ->mapToParent( posInFrame.topLeft() ); 00121 QSize sz = size(); 00122 return QRect( ptTopLeft, sz ); 00123 } 00124 else 00125 { 00126 QRect geo = geometry(); 00127 QRect frameGeo = externalGeometry(); 00128 return QRect( frameGeo.x(), frameGeo.y(), geo.width(), geo.height() ); 00129 // return geometry(); 00130 } 00131 } 00132 00133 //============== set internal geometry ==============// 00134 00135 void KMdiChildView::setInternalGeometry( const QRect& newGeometry ) 00136 { 00137 if ( mdiParent() ) 00138 { // is attached 00139 // retrieve the frame size 00140 QRect geo = internalGeometry(); 00141 QRect frameGeo = externalGeometry(); 00142 int nFrameSizeTop = geo.y() - frameGeo.y(); 00143 int nFrameSizeLeft = geo.x() - frameGeo.x(); 00144 00145 // create the new geometry that is accepted by the QWidget::setGeometry() method 00146 QRect newGeoQt; 00147 newGeoQt.setX( newGeometry.x() - nFrameSizeLeft ); 00148 newGeoQt.setY( newGeometry.y() - nFrameSizeTop ); 00149 00150 newGeoQt.setWidth( newGeometry.width() + nFrameSizeLeft + KMDI_CHILDFRM_DOUBLE_BORDER / 2 ); 00151 newGeoQt.setHeight( newGeometry.height() + nFrameSizeTop + KMDI_CHILDFRM_DOUBLE_BORDER / 2 ); 00152 // newGeoQt.setWidth(newGeometry.width()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER); 00153 // newGeoQt.setHeight(newGeometry.height()+mdiParent()->captionHeight()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER); 00154 00155 // set the geometry 00156 mdiParent()->setGeometry( newGeoQt ); 00157 } 00158 else 00159 { 00160 // retrieve the frame size 00161 QRect geo = internalGeometry(); 00162 QRect frameGeo = externalGeometry(); 00163 int nFrameSizeTop = geo.y() - frameGeo.y(); 00164 int nFrameSizeLeft = geo.x() - frameGeo.x(); 00165 00166 // create the new geometry that is accepted by the QWidget::setGeometry() method 00167 QRect newGeoQt; 00168 00169 newGeoQt.setX( newGeometry.x() - nFrameSizeLeft ); 00170 newGeoQt.setY( newGeometry.y() - nFrameSizeTop ); 00171 00172 newGeoQt.setWidth( newGeometry.width() ); 00173 newGeoQt.setHeight( newGeometry.height() ); 00174 00175 // set the geometry 00176 setGeometry( newGeoQt ); 00177 } 00178 } 00179 00180 //============== external geometry ==============// 00181 00182 QRect KMdiChildView::externalGeometry() const 00183 { 00184 return mdiParent() ? mdiParent()->frameGeometry() : frameGeometry(); 00185 } 00186 00187 //============== set external geometry ==============// 00188 00189 void KMdiChildView::setExternalGeometry( const QRect& newGeometry ) 00190 { 00191 if ( mdiParent() ) 00192 { // is attached 00193 mdiParent() ->setGeometry( newGeometry ); 00194 } 00195 else 00196 { 00197 // retrieve the frame size 00198 QRect geo = internalGeometry(); 00199 QRect frameGeo = externalGeometry(); 00200 int nTotalFrameWidth = frameGeo.width() - geo.width(); 00201 int nTotalFrameHeight = frameGeo.height() - geo.height(); 00202 int nFrameSizeTop = geo.y() - frameGeo.y(); 00203 int nFrameSizeLeft = geo.x() - frameGeo.x(); 00204 00205 // create the new geometry that is accepted by the QWidget::setGeometry() method 00206 // not attached => the window system makes the frame 00207 QRect newGeoQt; 00208 newGeoQt.setX( newGeometry.x() + nFrameSizeLeft ); 00209 newGeoQt.setY( newGeometry.y() + nFrameSizeTop ); 00210 newGeoQt.setWidth( newGeometry.width() - nTotalFrameWidth ); 00211 newGeoQt.setHeight( newGeometry.height() - nTotalFrameHeight ); 00212 00213 // set the geometry 00214 setGeometry( newGeoQt ); 00215 } 00216 } 00217 00218 //============== minimize ==============// 00219 00220 void KMdiChildView::minimize( bool bAnimate ) 00221 { 00222 if ( mdiParent() ) 00223 { 00224 if ( !isMinimized() ) 00225 { 00226 mdiParent() ->setState( KMdiChildFrm::Minimized, bAnimate ); 00227 } 00228 } 00229 else 00230 showMinimized(); 00231 } 00232 00233 void KMdiChildView::showMinimized() 00234 { 00235 emit isMinimizedNow(); 00236 QWidget::showMinimized(); 00237 } 00238 00239 //slot: 00240 void KMdiChildView::minimize() 00241 { 00242 minimize( true ); 00243 } 00244 00245 //============= maximize ==============// 00246 00247 void KMdiChildView::maximize( bool bAnimate ) 00248 { 00249 if ( mdiParent() ) 00250 { 00251 if ( !isMaximized() ) 00252 { 00253 mdiParent() ->setState( KMdiChildFrm::Maximized, bAnimate ); 00254 emit mdiParentNowMaximized( true ); 00255 } 00256 } 00257 else 00258 showMaximized(); 00259 } 00260 00261 void KMdiChildView::showMaximized() 00262 { 00263 emit isMaximizedNow(); 00264 QWidget::showMaximized(); 00265 } 00266 00267 //slot: 00268 void KMdiChildView::maximize() 00269 { 00270 maximize( true ); 00271 } 00272 00273 //============== restoreGeometry ================// 00274 00275 QRect KMdiChildView::restoreGeometry() 00276 { 00277 if ( mdiParent() ) 00278 return mdiParent() ->restoreGeometry(); 00279 else //FIXME not really supported, may be we must use Windows or X11 funtions 00280 return geometry(); 00281 } 00282 00283 //============== setRestoreGeometry ================// 00284 00285 void KMdiChildView::setRestoreGeometry( const QRect& newRestGeo ) 00286 { 00287 if ( mdiParent() ) 00288 mdiParent()->setRestoreGeometry( newRestGeo ); 00289 } 00290 00291 //============== attach ================// 00292 00293 void KMdiChildView::attach() 00294 { 00295 emit attachWindow( this, true ); 00296 } 00297 00298 //============== detach =================// 00299 00300 void KMdiChildView::detach() 00301 { 00302 emit detachWindow( this, true ); 00303 } 00304 00305 //=============== isMinimized ? =================// 00306 00307 bool KMdiChildView::isMinimized() const 00308 { 00309 if ( mdiParent() ) 00310 return ( mdiParent()->state() == KMdiChildFrm::Minimized ); 00311 else 00312 return QWidget::isMinimized(); 00313 } 00314 00315 //============== isMaximized ? ==================// 00316 00317 bool KMdiChildView::isMaximized() const 00318 { 00319 if ( mdiParent() ) 00320 return ( mdiParent()->state() == KMdiChildFrm::Maximized ); 00321 else 00322 return QWidget::isMaximized(); 00323 } 00324 00325 //============== restore ================// 00326 00327 void KMdiChildView::restore() 00328 { 00329 if ( mdiParent() ) 00330 { 00331 if ( isMaximized() ) 00332 emit mdiParentNowMaximized( false ); 00333 00334 if ( isMinimized() || isMaximized() ) 00335 mdiParent()->setState( KMdiChildFrm::Normal ); 00336 } 00337 else 00338 showNormal(); 00339 } 00340 00341 void KMdiChildView::showNormal() 00342 { 00343 emit isRestoredNow(); 00344 QWidget::showNormal(); 00345 } 00346 00347 //=============== youAreAttached ============// 00348 00349 void KMdiChildView::youAreAttached( KMdiChildFrm *lpC ) 00350 { 00351 lpC->setCaption( m_szCaption ); 00352 emit isAttachedNow(); 00353 } 00354 00355 //================ youAreDetached =============// 00356 00357 void KMdiChildView::youAreDetached() 00358 { 00359 setCaption( m_szCaption ); 00360 00361 setTabCaption( m_sTabCaption ); 00362 if ( myIconPtr() ) 00363 setIcon( *( myIconPtr() ) ); 00364 00365 setFocusPolicy( QWidget::StrongFocus ); 00366 00367 emit isDetachedNow(); 00368 } 00369 00370 //================ setCaption ================// 00371 // this set the caption of only the window 00372 void KMdiChildView::setCaption( const QString& szCaption ) 00373 { 00374 // this will work only for window 00375 m_szCaption = szCaption; 00376 if ( mdiParent() ) 00377 mdiParent() ->setCaption( m_szCaption ); 00378 else //have to call the parent one 00379 QWidget::setCaption( m_szCaption ); 00380 00381 emit windowCaptionChanged( m_szCaption ); 00382 } 00383 00384 //============== closeEvent ================// 00385 00386 void KMdiChildView::closeEvent( QCloseEvent *e ) 00387 { 00388 e->ignore(); //we ignore the event , and then close later if needed. 00389 emit childWindowCloseRequest( this ); 00390 } 00391 00392 //================ myIconPtr =================// 00393 00394 QPixmap* KMdiChildView::myIconPtr() 00395 { 00396 return 0; 00397 } 00398 00399 //============= focusInEvent ===============// 00400 00401 void KMdiChildView::focusInEvent( QFocusEvent *e ) 00402 { 00403 QWidget::focusInEvent( e ); 00404 00405 // every widget get a focusInEvent when a popup menu is opened!?! -> maybe bug of QT 00406 if ( e && ( ( e->reason() ) == QFocusEvent::Popup ) ) 00407 return ; 00408 00409 00410 m_bFocusInEventIsPending = true; 00411 activate(); 00412 m_bFocusInEventIsPending = false; 00413 00414 emit gotFocus( this ); 00415 } 00416 00417 //============= activate ===============// 00418 00419 void KMdiChildView::activate() 00420 { 00421 // avoid circularity 00422 static bool s_bActivateIsPending = false; 00423 if ( s_bActivateIsPending ) 00424 return ; 00425 00426 s_bActivateIsPending = true; 00427 00428 // raise the view and push the taskbar button 00429 if ( !m_bMainframesActivateViewIsPending ) 00430 emit focusInEventOccurs( this ); 00431 00432 // if this method was called directly, check if the mainframe wants that we interrupt 00433 if ( m_bInterruptActivation ) 00434 m_bInterruptActivation = false; 00435 else 00436 { 00437 if ( !m_bFocusInEventIsPending ) 00438 setFocus(); 00439 00440 kdDebug( 760 ) << k_funcinfo << endl; 00441 emit activated( this ); 00442 } 00443 00444 if ( m_focusedChildWidget != 0L ) 00445 m_focusedChildWidget->setFocus(); 00446 else 00447 { 00448 if ( m_firstFocusableChildWidget != 0L ) 00449 { 00450 m_firstFocusableChildWidget->setFocus(); 00451 m_focusedChildWidget = m_firstFocusableChildWidget; 00452 } 00453 } 00454 s_bActivateIsPending = false; 00455 } 00456 00457 //============= focusOutEvent ===============// 00458 00459 void KMdiChildView::focusOutEvent( QFocusEvent* e ) 00460 { 00461 QWidget::focusOutEvent( e ); 00462 emit lostFocus( this ); 00463 } 00464 00465 //============= resizeEvent ===============// 00466 00467 void KMdiChildView::resizeEvent( QResizeEvent* e ) 00468 { 00469 QWidget::resizeEvent( e ); 00470 00471 if ( m_stateChanged ) 00472 { 00473 m_stateChanged = false; 00474 if ( isMaximized() ) 00475 { //maximized 00476 emit isMaximizedNow(); 00477 } 00478 else if ( isMinimized() ) 00479 { //minimized 00480 emit isMinimizedNow(); 00481 } 00482 else 00483 { //is restored 00484 emit isRestoredNow(); 00485 } 00486 } 00487 } 00488 00489 void KMdiChildView::slot_childDestroyed() 00490 { 00491 // do what we do if a child is removed 00492 00493 // if we lost a child we uninstall ourself as event filter for the lost 00494 // child and its children 00495 const QObject * pLostChild = QObject::sender(); 00496 if ( pLostChild && ( pLostChild->isWidgetType() ) ) 00497 { 00498 QObjectList* list = ( ( QObject* ) ( pLostChild ) ) ->queryList( "QWidget" ); 00499 list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code 00500 QObjectListIt it( *list ); // iterate over all lost child widgets 00501 QObject* obj; 00502 while ( ( obj = it.current() ) != 0 ) 00503 { // for each found object... 00504 QWidget * widg = ( QWidget* ) obj; 00505 ++it; 00506 widg->removeEventFilter( this ); 00507 if ( m_firstFocusableChildWidget == widg ) 00508 m_firstFocusableChildWidget = 0L; // reset first widget 00509 00510 if ( m_lastFocusableChildWidget == widg ) 00511 m_lastFocusableChildWidget = 0L; // reset last widget 00512 00513 if ( m_focusedChildWidget == widg ) 00514 m_focusedChildWidget = 0L; // reset focused widget 00515 } 00516 delete list; // delete the list, not the objects 00517 } 00518 } 00519 00520 //============= eventFilter ===============// 00521 bool KMdiChildView::eventFilter( QObject *obj, QEvent *e ) 00522 { 00523 if ( e->type() == QEvent::KeyPress && isAttached() ) 00524 { 00525 QKeyEvent* ke = ( QKeyEvent* ) e; 00526 if ( ke->key() == Qt::Key_Tab ) 00527 { 00528 QWidget* w = ( QWidget* ) obj; 00529 FocusPolicy wfp = w->focusPolicy(); 00530 if ( wfp == QWidget::StrongFocus || wfp == QWidget::TabFocus || w->focusPolicy() == QWidget::WheelFocus ) 00531 { 00532 if ( m_lastFocusableChildWidget != 0 ) 00533 { 00534 if ( w == m_lastFocusableChildWidget ) 00535 { 00536 if ( w != m_firstFocusableChildWidget ) 00537 m_firstFocusableChildWidget->setFocus(); 00538 } 00539 } 00540 } 00541 } 00542 } 00543 else if ( e->type() == QEvent::FocusIn ) 00544 { 00545 if ( obj->isWidgetType() ) 00546 { 00547 QObjectList * list = queryList( "QWidget" ); 00548 if ( list->find( obj ) != -1 ) 00549 m_focusedChildWidget = ( QWidget* ) obj; 00550 00551 delete list; // delete the list, not the objects 00552 } 00553 if ( !isAttached() ) 00554 { // is toplevel, for attached views activation is done by main frame event filter 00555 static bool m_bActivationIsPending = false; 00556 if ( !m_bActivationIsPending ) 00557 { 00558 m_bActivationIsPending = true; 00559 activate(); // sets the focus 00560 m_bActivationIsPending = false; 00561 } 00562 } 00563 } 00564 else if ( e->type() == QEvent::ChildRemoved ) 00565 { 00566 // if we lost a child we uninstall ourself as event filter for the lost 00567 // child and its children 00568 QObject * pLostChild = ( ( QChildEvent* ) e ) ->child(); 00569 if ( ( pLostChild != 0L ) && ( pLostChild->isWidgetType() ) ) 00570 { 00571 QObjectList * list = pLostChild->queryList( "QWidget" ); 00572 list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code 00573 QObjectListIt it( *list ); // iterate over all lost child widgets 00574 QObject * o; 00575 while ( ( o = it.current() ) != 0 ) 00576 { // for each found object... 00577 QWidget * widg = ( QWidget* ) o; 00578 ++it; 00579 widg->removeEventFilter( this ); 00580 FocusPolicy wfp = widg->focusPolicy(); 00581 if ( wfp == QWidget::StrongFocus || wfp == QWidget::TabFocus || widg->focusPolicy() == QWidget::WheelFocus ) 00582 { 00583 if ( m_firstFocusableChildWidget == widg ) 00584 m_firstFocusableChildWidget = 0L; // reset first widget 00585 00586 if ( m_lastFocusableChildWidget == widg ) 00587 m_lastFocusableChildWidget = 0L; // reset last widget 00588 } 00589 } 00590 delete list; // delete the list, not the objects 00591 } 00592 } 00593 else if ( e->type() == QEvent::ChildInserted ) 00594 { 00595 // if we got a new child and we are attached to the MDI system we 00596 // install ourself as event filter for the new child and its children 00597 // (as we did when we were added to the MDI system). 00598 QObject * pNewChild = ( ( QChildEvent* ) e ) ->child(); 00599 if ( ( pNewChild != 0L ) && ( pNewChild->isWidgetType() ) ) 00600 { 00601 QWidget * pNewWidget = ( QWidget* ) pNewChild; 00602 if ( pNewWidget->testWFlags( Qt::WType_Dialog | Qt::WShowModal ) ) 00603 return false; 00604 QObjectList *list = pNewWidget->queryList( "QWidget" ); 00605 list->insert( 0, pNewChild ); // add the new child to the list too, just to save code 00606 QObjectListIt it( *list ); // iterate over all new child widgets 00607 QObject * o; 00608 while ( ( o = it.current() ) != 0 ) 00609 { // for each found object... 00610 QWidget * widg = ( QWidget* ) o; 00611 ++it; 00612 widg->installEventFilter( this ); 00613 connect( widg, SIGNAL( destroyed() ), this, SLOT( slot_childDestroyed() ) ); 00614 FocusPolicy wfp = widg->focusPolicy(); 00615 if ( wfp == QWidget::StrongFocus || wfp == QWidget::TabFocus || widg->focusPolicy() == QWidget::WheelFocus ) 00616 { 00617 if ( m_firstFocusableChildWidget == 0 ) 00618 m_firstFocusableChildWidget = widg; // first widge 00619 00620 m_lastFocusableChildWidget = widg; // last widget 00621 } 00622 } 00623 delete list; // delete the list, not the objects 00624 } 00625 } 00626 else 00627 { 00628 if ( e->type() == QEvent::IconChange ) 00629 { 00630 // qDebug("KMDiChildView:: QEvent:IconChange intercepted\n"); 00631 if ( obj == this ) 00632 iconUpdated( this, icon() ? ( *icon() ) : QPixmap() ); 00633 else if ( obj == m_trackChanges ) 00634 setIcon( m_trackChanges->icon() ? ( *( m_trackChanges->icon() ) ) : QPixmap() ); 00635 } 00636 if ( e->type() == QEvent::CaptionChange ) 00637 { 00638 if ( obj == this ) 00639 captionUpdated( this, caption() ); 00640 } 00641 } 00642 00643 return false; // standard event processing 00644 } 00645 00647 void KMdiChildView::removeEventFilterForAllChildren() 00648 { 00649 QObjectList* list = queryList( "QWidget" ); 00650 QObjectListIt it( *list ); // iterate over all child widgets 00651 QObject* obj; 00652 while ( ( obj = it.current() ) != 0 ) 00653 { // for each found object... 00654 QWidget* widg = ( QWidget* ) obj; 00655 ++it; 00656 widg->removeEventFilter( this ); 00657 } 00658 delete list; // delete the list, not the objects 00659 } 00660 00661 QWidget* KMdiChildView::focusedChildWidget() 00662 { 00663 return m_focusedChildWidget; 00664 } 00665 00666 void KMdiChildView::setFirstFocusableChildWidget( QWidget* firstFocusableChildWidget ) 00667 { 00668 m_firstFocusableChildWidget = firstFocusableChildWidget; 00669 } 00670 00671 void KMdiChildView::setLastFocusableChildWidget( QWidget* lastFocusableChildWidget ) 00672 { 00673 m_lastFocusableChildWidget = lastFocusableChildWidget; 00674 } 00675 00677 void KMdiChildView::setTabCaption ( const QString& stbCaption ) 00678 { 00679 m_sTabCaption = stbCaption; 00680 emit tabCaptionChanged( m_sTabCaption ); 00681 } 00682 00683 void KMdiChildView::setMDICaption ( const QString& caption ) 00684 { 00685 setCaption( caption ); 00686 setTabCaption( caption ); 00687 } 00688 00690 void KMdiChildView::setWindowMenuID( int id ) 00691 { 00692 m_windowMenuID = id; 00693 } 00694 00695 //============= slot_clickedInWindowMenu ===============// 00696 00698 void KMdiChildView::slot_clickedInWindowMenu() 00699 { 00700 updateTimeStamp(); 00701 emit clickedInWindowMenu( m_windowMenuID ); 00702 } 00703 00704 //============= slot_clickedInDockMenu ===============// 00705 00707 void KMdiChildView::slot_clickedInDockMenu() 00708 { 00709 emit clickedInDockMenu( m_windowMenuID ); 00710 } 00711 00712 //============= setMinimumSize ===============// 00713 00714 void KMdiChildView::setMinimumSize( int minw, int minh ) 00715 { 00716 QWidget::setMinimumSize( minw, minh ); 00717 if ( mdiParent() && mdiParent()->state() != KMdiChildFrm::Minimized ) 00718 { 00719 mdiParent() ->setMinimumSize( minw + KMDI_CHILDFRM_DOUBLE_BORDER, 00720 minh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent() ->captionHeight() ); 00721 } 00722 } 00723 00724 //============= setMaximumSize ===============// 00725 00726 void KMdiChildView::setMaximumSize( int maxw, int maxh ) 00727 { 00728 if ( mdiParent() && mdiParent()->state() == KMdiChildFrm::Normal ) 00729 { 00730 int w = maxw + KMDI_CHILDFRM_DOUBLE_BORDER; 00731 if ( w > QWIDGETSIZE_MAX ) 00732 w = QWIDGETSIZE_MAX; 00733 00734 int h = maxh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent() ->captionHeight(); 00735 if ( h > QWIDGETSIZE_MAX ) 00736 h = QWIDGETSIZE_MAX; 00737 00738 mdiParent()->setMaximumSize( w, h ); 00739 } 00740 QWidget::setMaximumSize( maxw, maxh ); 00741 } 00742 00743 //============= show ===============// 00744 00745 void KMdiChildView::show() 00746 { 00747 if ( mdiParent() ) 00748 mdiParent()->show(); 00749 00750 QWidget::show(); 00751 } 00752 00753 //============= hide ===============// 00754 00755 void KMdiChildView::hide() 00756 { 00757 if ( mdiParent() ) 00758 mdiParent()->hide(); 00759 00760 QWidget::hide(); 00761 } 00762 00763 //============= raise ===============// 00764 00765 void KMdiChildView::raise() 00766 { 00767 if ( mdiParent() ) //TODO Check Z-order 00768 mdiParent()->raise(); 00769 00770 QWidget::raise(); 00771 } 00772 00773 // kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;
KDE Logo
This file is part of the documentation for kmdi Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 12 23:29:41 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003