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 } 00063 else { 00064 m_szCaption = QString(i18n("Unnamed")); 00065 } 00066 m_sTabCaption = m_szCaption; 00067 00068 setFocusPolicy(ClickFocus); 00069 00070 installEventFilter(this); 00071 00072 // store the current time 00073 updateTimeStamp(); 00074 } 00075 00076 00077 //============ KMdiChildView ============// 00078 00079 KMdiChildView::KMdiChildView( QWidget* parentWidget, const char* name, WFlags f) 00080 : QWidget(parentWidget, name, f) 00081 ,m_focusedChildWidget(0L) 00082 ,m_firstFocusableChildWidget(0L) 00083 ,m_lastFocusableChildWidget(0L) 00084 ,m_stateChanged(true) 00085 ,m_bToolView(false) 00086 ,m_bInterruptActivation(false) 00087 ,m_bMainframesActivateViewIsPending(false) 00088 ,m_bFocusInEventIsPending(false) 00089 { 00090 setGeometry( 0, 0, 0, 0); // reset 00091 m_szCaption = QString(i18n("Unnamed")); 00092 m_sTabCaption = m_szCaption; 00093 00094 setFocusPolicy(ClickFocus); 00095 00096 installEventFilter(this); 00097 00098 // store the current time 00099 updateTimeStamp(); 00100 } 00101 00102 //============ ~KMdiChildView ============// 00103 00104 KMdiChildView::~KMdiChildView() 00105 { 00106 kdDebug(760)<<"~KMdiChildView()"<<endl; 00107 } 00108 00109 void KMdiChildView::trackIconAndCaptionChanges(QWidget *view) { 00110 m_trackChanges=view; 00111 } 00112 00113 00114 //============== internal geometry ==============// 00115 00116 QRect KMdiChildView::internalGeometry() const 00117 { 00118 if(mdiParent()) { // is attached 00119 // get the client area coordinates inside the MDI child frame 00120 QRect posInFrame = geometry(); 00121 // map these values to the parent of the MDI child frame 00122 // (this usually is the MDI child area) and return 00123 QPoint ptTopLeft = mdiParent()->mapToParent(posInFrame.topLeft()); 00124 QSize sz = size(); 00125 return QRect(ptTopLeft, sz); 00126 } 00127 else { 00128 QRect geo = geometry(); 00129 QRect frameGeo = externalGeometry(); 00130 return QRect(frameGeo.x(), frameGeo.y(), geo.width(), geo.height()); 00131 // return geometry(); 00132 } 00133 } 00134 00135 //============== set internal geometry ==============// 00136 00137 void KMdiChildView::setInternalGeometry(const QRect& newGeometry) 00138 { 00139 if(mdiParent()) { // is attached 00140 // retrieve the frame size 00141 QRect geo = internalGeometry(); 00142 QRect frameGeo = externalGeometry(); 00143 int nFrameSizeTop = geo.y() - frameGeo.y(); 00144 int nFrameSizeLeft = geo.x() - frameGeo.x(); 00145 00146 // create the new geometry that is accepted by the QWidget::setGeometry() method 00147 QRect newGeoQt; 00148 newGeoQt.setX(newGeometry.x()-nFrameSizeLeft); 00149 newGeoQt.setY(newGeometry.y()-nFrameSizeTop); 00150 00151 newGeoQt.setWidth(newGeometry.width()+nFrameSizeLeft+KMDI_CHILDFRM_DOUBLE_BORDER/2); 00152 newGeoQt.setHeight(newGeometry.height()+nFrameSizeTop+KMDI_CHILDFRM_DOUBLE_BORDER/2); 00153 // newGeoQt.setWidth(newGeometry.width()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER); 00154 // newGeoQt.setHeight(newGeometry.height()+mdiParent()->captionHeight()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER); 00155 00156 // set the geometry 00157 mdiParent()->setGeometry(newGeoQt); 00158 } 00159 else { 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()) { // is attached 00192 mdiParent()->setGeometry(newGeometry); 00193 } 00194 else { 00195 // retrieve the frame size 00196 QRect geo = internalGeometry(); 00197 QRect frameGeo = externalGeometry(); 00198 int nTotalFrameWidth = frameGeo.width() - geo.width(); 00199 int nTotalFrameHeight = frameGeo.height() - geo.height(); 00200 int nFrameSizeTop = geo.y() - frameGeo.y(); 00201 int nFrameSizeLeft = geo.x() - frameGeo.x(); 00202 00203 // create the new geometry that is accepted by the QWidget::setGeometry() method 00204 // not attached => the window system makes the frame 00205 QRect newGeoQt; 00206 newGeoQt.setX(newGeometry.x()+nFrameSizeLeft); 00207 newGeoQt.setY(newGeometry.y()+nFrameSizeTop); 00208 newGeoQt.setWidth(newGeometry.width()-nTotalFrameWidth); 00209 newGeoQt.setHeight(newGeometry.height()-nTotalFrameHeight); 00210 00211 // set the geometry 00212 setGeometry(newGeoQt); 00213 } 00214 } 00215 00216 //============== minimize ==============// 00217 00218 void KMdiChildView::minimize(bool bAnimate) 00219 { 00220 if(mdiParent()) { 00221 if(!isMinimized()) { 00222 mdiParent()->setState(KMdiChildFrm::Minimized,bAnimate); 00223 } 00224 } 00225 else { 00226 showMinimized(); 00227 } 00228 } 00229 00230 void KMdiChildView::showMinimized() 00231 { 00232 //qDebug("is minimized now"); 00233 emit isMinimizedNow(); 00234 QWidget::showMinimized(); 00235 } 00236 00237 //slot: 00238 void KMdiChildView::minimize() { minimize(true); } 00239 00240 //============= maximize ==============// 00241 00242 void KMdiChildView::maximize(bool bAnimate) 00243 { 00244 if(mdiParent()) { 00245 if(!isMaximized()) { 00246 mdiParent()->setState(KMdiChildFrm::Maximized,bAnimate); 00247 emit mdiParentNowMaximized(true); 00248 } 00249 } 00250 else { 00251 showMaximized(); 00252 } 00253 } 00254 00255 void KMdiChildView::showMaximized() 00256 { 00257 //qDebug("is maximized now"); 00258 emit isMaximizedNow(); 00259 QWidget::showMaximized(); 00260 } 00261 00262 //slot: 00263 void KMdiChildView::maximize() { maximize(true); } 00264 00265 //============== restoreGeometry ================// 00266 00267 QRect KMdiChildView::restoreGeometry() 00268 { 00269 if(mdiParent()) { 00270 return mdiParent()->restoreGeometry(); 00271 } 00272 else { 00273 // XXX not really supported, may be we must use Windows or X11 funtions 00274 return geometry(); 00275 } 00276 } 00277 00278 //============== setRestoreGeometry ================// 00279 00280 void KMdiChildView::setRestoreGeometry(const QRect& newRestGeo) 00281 { 00282 if(mdiParent()) { 00283 mdiParent()->setRestoreGeometry(newRestGeo); 00284 } 00285 else { 00286 // XXX not supported, may be we must use Windows or X11 funtions 00287 } 00288 } 00289 00290 //============== attach ================// 00291 00292 void KMdiChildView::attach() 00293 { 00294 emit attachWindow(this,true); 00295 } 00296 00297 //============== detach =================// 00298 00299 void KMdiChildView::detach() 00300 { 00301 emit detachWindow(this, true); 00302 } 00303 00304 //=============== isMinimized ? =================// 00305 00306 bool KMdiChildView::isMinimized() const 00307 { 00308 if(mdiParent()) { 00309 return (mdiParent()->state() == KMdiChildFrm::Minimized); 00310 } 00311 else { 00312 return QWidget::isMinimized(); 00313 } 00314 } 00315 00316 //============== isMaximized ? ==================// 00317 00318 bool KMdiChildView::isMaximized() const 00319 { 00320 if(mdiParent()) { 00321 return (mdiParent()->state() == KMdiChildFrm::Maximized); 00322 } 00323 else { 00324 return QWidget::isMaximized(); 00325 } 00326 } 00327 00328 //============== restore ================// 00329 00330 void KMdiChildView::restore() 00331 { 00332 if(mdiParent()) { 00333 if(isMaximized()) { 00334 emit mdiParentNowMaximized(false); 00335 } 00336 if(isMinimized()||isMaximized()) { 00337 mdiParent()->setState(KMdiChildFrm::Normal); 00338 } 00339 } 00340 else { 00341 showNormal(); 00342 } 00343 } 00344 00345 void KMdiChildView::showNormal() 00346 { 00347 //qDebug("is restored now"); 00348 emit isRestoredNow(); 00349 QWidget::showNormal(); 00350 } 00351 00352 //=============== youAreAttached ============// 00353 00354 void KMdiChildView::youAreAttached(KMdiChildFrm *lpC) 00355 { 00356 lpC->setCaption(m_szCaption); 00357 00358 emit isAttachedNow(); 00359 } 00360 00361 //================ youAreDetached =============// 00362 00363 void KMdiChildView::youAreDetached() 00364 { 00365 setCaption(m_szCaption); 00366 00367 setTabCaption(m_sTabCaption); 00368 if(myIconPtr())setIcon(*(myIconPtr())); 00369 setFocusPolicy(QWidget::StrongFocus); 00370 00371 emit isDetachedNow(); 00372 } 00373 00374 //================ setCaption ================// 00375 // this set the caption of only the window 00376 void KMdiChildView::setCaption(const QString& szCaption) 00377 { 00378 // this will work only for window 00379 m_szCaption=szCaption; 00380 if(mdiParent()) { 00381 mdiParent()->setCaption(m_szCaption); 00382 } 00383 else { 00384 // sorry have to call the parent one 00385 QWidget::setCaption(m_szCaption); 00386 } 00387 emit windowCaptionChanged(m_szCaption); 00388 } 00389 00390 //============== closeEvent ================// 00391 00392 void KMdiChildView::closeEvent(QCloseEvent *e) 00393 { 00394 e->ignore(); //we ignore the event , and then close later if needed. 00395 emit childWindowCloseRequest(this); 00396 } 00397 00398 //================ myIconPtr =================// 00399 00400 QPixmap* KMdiChildView::myIconPtr() 00401 { 00402 return 0; 00403 } 00404 00405 //============= focusInEvent ===============// 00406 00407 void KMdiChildView::focusInEvent(QFocusEvent *e) 00408 { 00409 QWidget::focusInEvent(e); 00410 00411 // every widget get a focusInEvent when a popup menu is opened!?! -> maybe bug of QT 00412 if(e && ((e->reason())==QFocusEvent::Popup)) { 00413 return; 00414 } 00415 00416 m_bFocusInEventIsPending = true; 00417 activate(); 00418 m_bFocusInEventIsPending = false; 00419 00420 emit gotFocus(this); 00421 } 00422 00423 //============= activate ===============// 00424 00425 void KMdiChildView::activate() 00426 { 00427 // avoid circularity 00428 static bool s_bActivateIsPending = false; 00429 if(s_bActivateIsPending) { 00430 return; 00431 } 00432 s_bActivateIsPending = true; 00433 00434 // raise the view and push the taskbar button 00435 if(!m_bMainframesActivateViewIsPending) { 00436 emit focusInEventOccurs( this); 00437 } 00438 00439 // if this method was called directly, check if the mainframe wants that we interrupt 00440 if(m_bInterruptActivation) { 00441 m_bInterruptActivation = false; 00442 } 00443 else { 00444 if(!m_bFocusInEventIsPending) { 00445 setFocus(); 00446 } 00447 kdDebug(760) << "KMdiChildView::activate() called!" << endl; 00448 emit activated(this); 00449 } 00450 00451 if(m_focusedChildWidget != 0L) { 00452 m_focusedChildWidget->setFocus(); 00453 } 00454 else { 00455 if(m_firstFocusableChildWidget != 0L) { 00456 m_firstFocusableChildWidget->setFocus(); 00457 m_focusedChildWidget = m_firstFocusableChildWidget; 00458 } 00459 } 00460 s_bActivateIsPending = false; 00461 } 00462 00463 //============= focusOutEvent ===============// 00464 00465 void KMdiChildView::focusOutEvent(QFocusEvent* e) 00466 { 00467 QWidget::focusOutEvent(e); 00468 00469 emit lostFocus( this); 00470 } 00471 00472 //============= resizeEvent ===============// 00473 00474 void KMdiChildView::resizeEvent(QResizeEvent* e) 00475 { 00476 QWidget::resizeEvent( e); 00477 00478 if(m_stateChanged) { 00479 m_stateChanged = false; 00480 if(isMaximized()) { 00481 //qDebug("is maximized now"); 00482 emit isMaximizedNow(); 00483 } 00484 else if(isMinimized()) { 00485 //qDebug("is minimized now"); 00486 emit isMinimizedNow(); 00487 } 00488 else { // is restored 00489 //qDebug("is restored now"); 00490 emit isRestoredNow(); 00491 } 00492 } 00493 } 00494 00495 void KMdiChildView::slot_childDestroyed() 00496 { 00497 // do what we do if a child is removed 00498 00499 // if we lost a child we uninstall ourself as event filter for the lost 00500 // child and its children 00501 const QObject* pLostChild = QObject::sender(); 00502 if ((pLostChild != 0L) && (pLostChild->isWidgetType())) { 00503 QObjectList *list = ((QObject*)(pLostChild))->queryList("QWidget"); 00504 list->insert(0, pLostChild); // add the lost child to the list too, just to save code 00505 QObjectListIt it( *list ); // iterate over all lost child widgets 00506 QObject * obj; 00507 while ( (obj=it.current()) != 0 ) { // for each found object... 00508 QWidget* widg = (QWidget*)obj; 00509 ++it; 00510 widg->removeEventFilter(this); 00511 if(m_firstFocusableChildWidget == widg) { 00512 m_firstFocusableChildWidget = 0L; // reset first widget 00513 } 00514 if(m_lastFocusableChildWidget == widg) { 00515 m_lastFocusableChildWidget = 0L; // reset last widget 00516 } 00517 if(m_focusedChildWidget == widg) { 00518 m_focusedChildWidget = 0L; // reset focused widget 00519 } 00520 } 00521 delete list; // delete the list, not the objects 00522 } 00523 } 00524 00525 //============= eventFilter ===============// 00526 bool KMdiChildView::eventFilter(QObject *obj, QEvent *e ) 00527 { 00528 if(e->type() == QEvent::KeyPress && isAttached()) { 00529 QKeyEvent* ke = (QKeyEvent*) e; 00530 if(ke->key() == Qt::Key_Tab) { 00531 //qDebug("ChildView %i::eventFilter - TAB from %s (%s)", this, obj->name(), obj->className()); 00532 QWidget* w = (QWidget*) obj; 00533 if((w->focusPolicy() == QWidget::StrongFocus) || 00534 (w->focusPolicy() == QWidget::TabFocus ) || 00535 (w->focusPolicy() == QWidget::WheelFocus )) 00536 { 00537 //qDebug(" accept TAB as setFocus change"); 00538 if(m_lastFocusableChildWidget != 0) { 00539 if(w == m_lastFocusableChildWidget) { 00540 if(w != m_firstFocusableChildWidget) { 00541 //qDebug(" TAB: setFocus to first"); 00542 m_firstFocusableChildWidget->setFocus(); 00543 //qDebug(" TAB: focus is set to first"); 00544 } 00545 } 00546 } 00547 } 00548 } 00549 } 00550 else if(e->type() == QEvent::FocusIn) { 00551 if(obj->isWidgetType()) { 00552 QObjectList *list = queryList( "QWidget" ); 00553 if(list->find(obj) != -1) { 00554 m_focusedChildWidget = (QWidget*)obj; 00555 } 00556 delete list; // delete the list, not the objects 00557 } 00558 if (!isAttached()) { // is toplevel, for attached views activation is done by main frame event filter 00559 static bool m_bActivationIsPending = false; 00560 if(!m_bActivationIsPending) { 00561 m_bActivationIsPending = true; 00562 activate(); // sets the focus 00563 m_bActivationIsPending = false; 00564 } 00565 } 00566 } 00567 else if (e->type() == QEvent::ChildRemoved) { 00568 // if we lost a child we uninstall ourself as event filter for the lost 00569 // child and its children 00570 QObject* pLostChild = ((QChildEvent*)e)->child(); 00571 if ((pLostChild != 0L) && (pLostChild->isWidgetType())) { 00572 QObjectList *list = pLostChild->queryList( "QWidget" ); 00573 list->insert(0, pLostChild); // add the lost child to the list too, just to save code 00574 QObjectListIt it( *list ); // iterate over all lost child widgets 00575 QObject * o; 00576 while ( (o=it.current()) != 0 ) { // for each found object... 00577 QWidget* widg = (QWidget*)o; 00578 ++it; 00579 widg->removeEventFilter(this); 00580 if((widg->focusPolicy() == QWidget::StrongFocus) || 00581 (widg->focusPolicy() == QWidget::TabFocus ) || 00582 (widg->focusPolicy() == QWidget::WheelFocus )) 00583 { 00584 if(m_firstFocusableChildWidget == widg) { 00585 m_firstFocusableChildWidget = 0L; // reset first widget 00586 } 00587 if(m_lastFocusableChildWidget == widg) { 00588 m_lastFocusableChildWidget = 0L; // reset last widget 00589 } 00590 } 00591 } 00592 delete list; // delete the list, not the objects 00593 } 00594 } 00595 else if (e->type() == QEvent::ChildInserted) { 00596 // if we got a new child and we are attached to the MDI system we 00597 // install ourself as event filter for the new child and its children 00598 // (as we did when we were added to the MDI system). 00599 QObject* pNewChild = ((QChildEvent*)e)->child(); 00600 if ((pNewChild != 0L) && (pNewChild->isWidgetType())) 00601 { 00602 QWidget* pNewWidget = (QWidget*)pNewChild; 00603 if (pNewWidget->testWFlags(Qt::WType_Dialog | Qt::WShowModal)) 00604 return false; 00605 QObjectList *list = pNewWidget->queryList( "QWidget" ); 00606 list->insert(0, pNewChild); // add the new child to the list too, just to save code 00607 QObjectListIt it( *list ); // iterate over all new child widgets 00608 QObject * o; 00609 while ( (o=it.current()) != 0 ) { // 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 if((widg->focusPolicy() == QWidget::StrongFocus) || 00615 (widg->focusPolicy() == QWidget::TabFocus ) || 00616 (widg->focusPolicy() == QWidget::WheelFocus )) 00617 { 00618 if(m_firstFocusableChildWidget == 0) { 00619 m_firstFocusableChildWidget = widg; // first widge 00620 } 00621 m_lastFocusableChildWidget = widg; // last widget 00622 //qDebug("*** %s (%s)",widg->name(),widg->className()); 00623 } 00624 } 00625 delete list; // delete the list, not the objects 00626 } 00627 } 00628 else 00629 { 00630 if (e->type()==QEvent::IconChange) { 00631 // qDebug("KMDiChildView:: QEvent:IconChange intercepted\n"); 00632 if (obj==this) 00633 iconUpdated(this,icon()?(*icon()):QPixmap()); 00634 else if (obj==m_trackChanges) 00635 setIcon(m_trackChanges->icon()?(*(m_trackChanges->icon())):QPixmap()); 00636 } 00637 if (e->type()==QEvent::CaptionChange) { 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 ) { // for each found object... 00653 QWidget* widg = (QWidget*)obj; 00654 ++it; 00655 widg->removeEventFilter(this); 00656 } 00657 delete list; // delete the list, not the objects 00658 } 00659 00660 QWidget* KMdiChildView::focusedChildWidget() 00661 { 00662 return m_focusedChildWidget; 00663 } 00664 00665 void KMdiChildView::setFirstFocusableChildWidget(QWidget* firstFocusableChildWidget) 00666 { 00667 m_firstFocusableChildWidget = firstFocusableChildWidget; 00668 } 00669 00670 void KMdiChildView::setLastFocusableChildWidget(QWidget* lastFocusableChildWidget) 00671 { 00672 m_lastFocusableChildWidget = lastFocusableChildWidget; 00673 } 00675 void KMdiChildView::setTabCaption (const QString& stbCaption) { 00676 00677 m_sTabCaption = stbCaption; 00678 emit tabCaptionChanged(m_sTabCaption); 00679 00680 } 00681 void KMdiChildView::setMDICaption (const QString& caption) { 00682 setCaption(caption); 00683 setTabCaption(caption); 00684 } 00685 00687 void KMdiChildView::setWindowMenuID( int id) 00688 { 00689 m_windowMenuID = id; 00690 } 00691 00692 //============= slot_clickedInWindowMenu ===============// 00693 00695 void KMdiChildView::slot_clickedInWindowMenu() 00696 { 00697 updateTimeStamp(); 00698 emit clickedInWindowMenu( m_windowMenuID); 00699 } 00700 00701 //============= slot_clickedInDockMenu ===============// 00702 00704 void KMdiChildView::slot_clickedInDockMenu() 00705 { 00706 emit clickedInDockMenu( m_windowMenuID); 00707 } 00708 00709 //============= setMinimumSize ===============// 00710 00711 void KMdiChildView::setMinimumSize( int minw, int minh) 00712 { 00713 QWidget::setMinimumSize( minw, minh); 00714 if ( (mdiParent() != 0L) && (mdiParent()->state() != KMdiChildFrm::Minimized) ) { 00715 mdiParent()->setMinimumSize( minw + KMDI_CHILDFRM_DOUBLE_BORDER, 00716 minh + KMDI_CHILDFRM_DOUBLE_BORDER 00717 + KMDI_CHILDFRM_SEPARATOR 00718 + mdiParent()->captionHeight()); 00719 } 00720 } 00721 00722 //============= setMaximumSize ===============// 00723 00724 void KMdiChildView::setMaximumSize( int maxw, int maxh) 00725 { 00726 if ( (mdiParent() != 0L) && (mdiParent()->state() == KMdiChildFrm::Normal) ) { 00727 int w = maxw + KMDI_CHILDFRM_DOUBLE_BORDER; 00728 if(w > QWIDGETSIZE_MAX) { w = QWIDGETSIZE_MAX; } 00729 int h = maxh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent()->captionHeight(); 00730 if(h > QWIDGETSIZE_MAX) { h = QWIDGETSIZE_MAX; } 00731 mdiParent()->setMaximumSize( w, h); 00732 } 00733 QWidget::setMaximumSize( maxw, maxh); 00734 } 00735 00736 //============= show ===============// 00737 00738 void KMdiChildView::show() 00739 { 00740 QWidget* pParent = mdiParent(); 00741 if(pParent != 0L) { 00742 pParent->show(); 00743 } 00744 QWidget::show(); 00745 } 00746 00747 //============= hide ===============// 00748 00749 void KMdiChildView::hide() 00750 { 00751 if(mdiParent() != 0L) { 00752 mdiParent()->hide(); 00753 } 00754 QWidget::hide(); 00755 } 00756 00757 //============= raise ===============// 00758 00759 void KMdiChildView::raise() 00760 { 00761 if(mdiParent() != 0L) { 00762 mdiParent()->raise(); 00763 // XXXCTL what's about Z-order? L.B. 2002/02/10 00764 } 00765 QWidget::raise(); 00766 } 00767 00768 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kmdi Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:33:17 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003