00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#include "kmdichildarea.h"
00029
#include "kmdichildarea.moc"
00030
00031
#include "kmdidefines.h"
00032
00033
#include <kconfig.h>
00034
#include <kdebug.h>
00035
#include <kglobal.h>
00036
#include <kglobalsettings.h>
00037
00038
#include <math.h>
00039
#include <qpopupmenu.h>
00040
00041
00043
00045
00046
00047
00048 KMdiChildArea::KMdiChildArea(
QWidget *parent )
00049 :
QFrame( parent, "kmdi_childarea" )
00050 {
00051 setFrameStyle( QFrame::Panel | QFrame::Sunken );
00052
m_captionFont =
QFont();
00053
QFontMetrics fm(
m_captionFont );
00054 m_captionFontLineSpacing = fm.lineSpacing();
00055
m_captionActiveBackColor = KGlobalSettings::activeTitleColor();
00056
m_captionActiveForeColor = KGlobalSettings::activeTextColor();
00057
m_captionInactiveBackColor = KGlobalSettings::inactiveTitleColor();
00058
m_captionInactiveForeColor = KGlobalSettings::inactiveTextColor();
00059
m_pZ =
new QPtrList<KMdiChildFrm>;
00060
m_pZ->setAutoDelete(
true );
00061 setFocusPolicy( ClickFocus );
00062
m_defaultChildFrmSize =
QSize( 400, 300 );
00063 }
00064
00065
00066 KMdiChildArea::~KMdiChildArea()
00067 {
00068
delete m_pZ;
00069 }
00070
00071
00072 void KMdiChildArea::manageChild(
KMdiChildFrm* child,
bool show,
bool cascade )
00073 {
00074 kdDebug( 760 ) << k_funcinfo <<
"Adding child " << child <<
" to be managed" << endl;
00075
KMdiChildFrm* top =
topChild();
00076
00077
00078
if (
m_pZ->findRef( child ) != -1 )
00079 {
00080
00081
m_pZ->take();
00082
while (
m_pZ->findNextRef( child ) != -1 )
00083
m_pZ->take();
00084 }
00085
00086
if ( show )
00087
m_pZ->append( child );
00088
else
00089
m_pZ->insert( 0, child );
00090
00091
if ( cascade )
00092 child->move(
getCascadePoint(
m_pZ->count() - 1 ) );
00093
00094
if ( show )
00095 {
00096
if ( top && top->
state() == KMdiChildFrm::Maximized )
00097 {
00098 kdDebug( 760 ) << k_funcinfo <<
"Maximizing the new child" << endl;
00099 emit
sysButtonConnectionsMustChange( top, child );
00100 top->
setState( KMdiChildFrm::Normal,
false );
00101 child->
setState( KMdiChildFrm::Maximized,
false );
00102 }
00103 child->show();
00104
focusTopChild();
00105 }
00106 }
00107
00108
00109 void KMdiChildArea::destroyChild(
KMdiChildFrm *child,
bool focusTop )
00110 {
00111 kdDebug( 760 ) << k_funcinfo <<
"Removing child " << child->
caption() << endl;
00112
bool wasMaximized = ( child->
state() == KMdiChildFrm::Maximized );
00113
00114
00115 QObject::disconnect( child );
00116 child->blockSignals(
true );
00117
m_pZ->setAutoDelete(
false );
00118
m_pZ->removeRef( child );
00119
00120
00121
KMdiChildFrm* newTopChild =
topChild();
00122
if ( wasMaximized )
00123 {
00124
if ( newTopChild )
00125 {
00126 newTopChild->
setState( KMdiChildFrm::Maximized,
false );
00127 emit
sysButtonConnectionsMustChange( child, newTopChild );
00128 }
00129
else
00130 emit
noMaximizedChildFrmLeft( child );
00131 }
00132
00133
delete child;
00134
m_pZ->setAutoDelete(
true );
00135
00136
if ( focusTop )
00137
focusTopChild();
00138 }
00139
00140
00141 void KMdiChildArea::destroyChildButNotItsView(
KMdiChildFrm* child,
bool focusTop )
00142 {
00143 kdDebug( 760 ) << k_funcinfo <<
"Removing child " << child->
caption() << endl;
00144
bool wasMaximized = ( child->
state() == KMdiChildFrm::Maximized );
00145
00146
00147 QObject::disconnect( child );
00148 child->
unsetClient();
00149
m_pZ->setAutoDelete(
false );
00150
m_pZ->removeRef( child );
00151
00152
00153
KMdiChildFrm* newTopChild =
topChild();
00154
if ( wasMaximized )
00155 {
00156
if ( newTopChild )
00157 {
00158 newTopChild->
setState( KMdiChildFrm::Maximized,
false );
00159 emit
sysButtonConnectionsMustChange( child, newTopChild );
00160 }
00161
else
00162 emit
noMaximizedChildFrmLeft( child );
00163 }
00164
delete child;
00165
m_pZ->setAutoDelete(
true );
00166
00167
if ( focusTop )
00168
focusTopChild();
00169 }
00170
00171 void KMdiChildArea::setTopChild(
KMdiChildFrm* child,
bool )
00172 {
00173
if ( !child )
00174
return;
00175
00176
if (
topChild() != child )
00177 {
00178 kdDebug( 760 ) << k_funcinfo <<
"Setting " << child->
caption() <<
" as the new top child" << endl;
00179
m_pZ->setAutoDelete(
false );
00180
if ( child )
00181
m_pZ->removeRef( child );
00182
m_pZ->setAutoDelete(
true );
00183
00184
00185
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00186
for ( ; ( *it ); ++it )
00187 ( *it )->m_pCaption->setActive(
false );
00188
00189
KMdiChildFrm* maximizedChild =
topChild();
00190
bool topChildMaximized =
false;
00191
if ( maximizedChild && maximizedChild->
state() == KMdiChildFrm::Maximized )
00192 topChildMaximized =
true;
00193
00194
m_pZ->append( child );
00195
00196
int nChildAreaMinW = 0, nChildAreaMinH = 0;
00197
int nChildAreaMaxW = QWIDGETSIZE_MAX, nChildAreaMaxH = QWIDGETSIZE_MAX;
00198
if ( topChildMaximized && child->
m_pClient )
00199 {
00200
00201 nChildAreaMinW = child->
m_pClient->minimumWidth();
00202 nChildAreaMinH = child->
m_pClient->minimumHeight();
00204
00205
00206 }
00207
00208
00209 setMinimumSize( nChildAreaMinW, nChildAreaMinH );
00210 setMaximumSize( nChildAreaMaxW, nChildAreaMaxH );
00211
00212
if ( topChildMaximized )
00213 {
00214 child->
setState( KMdiChildFrm::Maximized,
false );
00215 maximizedChild->
setState( KMdiChildFrm::Normal,
false );
00216 emit
sysButtonConnectionsMustChange( maximizedChild, child );
00217 }
00218
else
00219 child->raise();
00220
00221 QFocusEvent::setReason( QFocusEvent::Other );
00222 child->
m_pClient->setFocus();
00223 }
00224 }
00225
00226
00227 void KMdiChildArea::resizeEvent(
QResizeEvent* e )
00228 {
00229
00230
KMdiChildFrm* child =
topChild();
00231
if ( child && child->
state() == KMdiChildFrm::Maximized )
00232 {
00233
int clientw = 0, clienth = 0;
00234
if ( child->
m_pClient != 0L )
00235 {
00236 clientw = child->
m_pClient->width();
00237 clienth = child->
m_pClient->height();
00238 }
00239 child->resize( width() + KMDI_CHILDFRM_DOUBLE_BORDER,
00240 height() + child->
m_pCaption->
heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_DOUBLE_BORDER );
00241
00242 }
00243
layoutMinimizedChildren();
00244 QWidget::resizeEvent( e );
00245 }
00246
00247
00248
00249 void KMdiChildArea::mousePressEvent(
QMouseEvent *e )
00250 {
00251
00252
if ( e->button() & RightButton )
00253 emit
popupWindowMenu( mapToGlobal( e->pos() ) );
00254 }
00255
00256
00257
00258 QPoint KMdiChildArea::getCascadePoint(
int indexOfWindow )
00259 {
00260
if ( indexOfWindow < 0 )
00261 {
00262 indexOfWindow =
m_pZ->count();
00263 kdDebug( 760 ) << k_funcinfo <<
"indexOfWindow was less than zero, using "
00264 << indexOfWindow <<
" as new index" << endl;
00265 }
00266
00267
QPoint pnt( 0, 0 );
00268
if ( indexOfWindow == 0 )
00269 {
00270 kdDebug( 760 ) << k_funcinfo <<
"No windows. Returning QPoint( 0, 0 ) as the cascade point" << endl;
00271
return pnt;
00272 }
00273
00274
bool topLevelMode =
false;
00275
if ( height() == 1 )
00276 topLevelMode =
true;
00277
00278 kdDebug( 760 ) << k_funcinfo <<
"Getting the cascade point for window index " << indexOfWindow << endl;
00279 kdDebug( 760 ) << k_funcinfo <<
"Do we think we're in top level mode? " << topLevelMode << endl;
00280
00281
KMdiChildFrm* child =
m_pZ->first();
00282
00283
00284
int step = 20;
00285
int h = ( topLevelMode ? QApplication::desktop()->height() : height() );
00286
int w = ( topLevelMode ? QApplication::desktop()->width() : width() );
00287
00288
int availableHeight = h -
m_defaultChildFrmSize.height();
00289
int availableWidth = w -
m_defaultChildFrmSize.width();
00290
int ax = 0;
00291
int ay = 0;
00292
00293
if ( child )
00294 {
00295 kdDebug( 760 ) << k_funcinfo <<
"child frame exists. resetting height and width values" << endl;
00296 step = child->
m_pCaption->
heightHint() + KMDI_CHILDFRM_BORDER;
00297 availableHeight = h - child->minimumHeight();
00298 availableWidth = w - child->minimumWidth();
00299 }
00300
00301
for (
int i = 0; i < indexOfWindow; i++ )
00302 {
00303 ax += step;
00304 ay += step;
00305
00306
00307
if ( ax > availableWidth )
00308 ax = 0;
00309
00310
if ( ay > availableHeight )
00311 ay = 0;
00312 }
00313 pnt.setX( ax );
00314 pnt.setY( ay );
00315
return pnt;
00316 }
00317
00318
00319 void KMdiChildArea::childMinimized(
KMdiChildFrm *minimizedChild,
bool wasMaximized )
00320 {
00321
00322
if (
m_pZ->findRef( minimizedChild ) == -1 )
00323 {
00324 kdDebug( 760 ) << k_funcinfo <<
"child was minimized but wasn't in our list!" << endl;
00325
return;
00326 }
00327
00328 kdDebug( 760 ) << k_funcinfo << endl;
00329
if (
m_pZ->count() > 1 )
00330 {
00331
00332
m_pZ->setAutoDelete(
false );
00333
m_pZ->removeRef( minimizedChild );
00334
m_pZ->setAutoDelete(
true );
00335
m_pZ->insert( 0, minimizedChild );
00336
00337
if ( wasMaximized )
00338 {
00339 kdDebug( 760 ) << k_funcinfo <<
"child just minimized from maximized state. maximize new top child" << endl;
00340 minimizedChild =
topChild();
00341
if ( !minimizedChild )
00342
return;
00343
00344
if ( minimizedChild->
state() == KMdiChildFrm::Maximized )
00345
return;
00346
00347 minimizedChild->
setState( KMdiChildFrm::Maximized,
false );
00348 }
00349
focusTopChild();
00350 }
00351
else
00352 setFocus();
00353 }
00354
00355 void KMdiChildArea::focusTopChild()
00356 {
00357
KMdiChildFrm* lastChild =
topChild();
00358
if ( !lastChild )
00359 {
00360 kdDebug( 760 ) << k_funcinfo <<
"No more child windows left" << endl;
00361 emit
lastChildFrmClosed();
00362
return;
00363 }
00364
00365
if ( !lastChild->
m_pClient->hasFocus() )
00366 {
00367
00368
QPtrListIterator<KMdiChildFrm> it ( *
m_pZ );
00369
for ( ; ( *it ); ++it )
00370 {
00371
if ( ( *it ) != lastChild )
00372 ( *it )->m_pCaption->setActive(
false );
00373 }
00374
00375 kdDebug( 760 ) << k_funcinfo <<
"Giving focus to " << lastChild->
caption() << endl;
00376 lastChild->raise();
00377 lastChild->
m_pClient->
activate();
00378 }
00379
00380 }
00381
00382 void KMdiChildArea::cascadeWindows()
00383 {
00384 kdDebug( 760 ) << k_funcinfo <<
"cascading windows but not changing their size" << endl;
00385
int idx = 0;
00386
QPtrList<KMdiChildFrm> list( *
m_pZ );
00387 list.setAutoDelete(
false );
00388
while ( !list.isEmpty() )
00389 {
00390
KMdiChildFrm* childFrm = list.first();
00391
if ( childFrm->
state() != KMdiChildFrm::Minimized )
00392 {
00393
if ( childFrm->
state() == KMdiChildFrm::Maximized )
00394 childFrm->
restorePressed();
00395
00396 childFrm->move(
getCascadePoint( idx ) );
00397 idx++;
00398 }
00399 list.removeFirst();
00400 }
00401
focusTopChild();
00402 }
00403
00404 void KMdiChildArea::cascadeMaximized()
00405 {
00406 kdDebug( 760 ) << k_funcinfo <<
"cascading windows. will make sure they are minimum sized" << endl;
00407
int idx = 0;
00408
QPtrList<KMdiChildFrm> list( *
m_pZ );
00409
00410 list.setAutoDelete(
false );
00411
while ( !list.isEmpty() )
00412 {
00413
KMdiChildFrm* childFrm = list.first();
00414
if (childFrm->
state() != KMdiChildFrm::Minimized )
00415 {
00416
if (childFrm->
state() == KMdiChildFrm::Maximized )
00417 childFrm->
restorePressed();
00418
00419
QPoint pnt(
getCascadePoint( idx ) );
00420 childFrm->move( pnt );
00421
QSize curSize( width() - pnt.x(), height() - pnt.y() );
00422
00423
if ( ( childFrm->minimumSize().width() > curSize.width() ) ||
00424 ( childFrm->minimumSize().height() > curSize.height() ) )
00425 {
00426 childFrm->resize( childFrm->minimumSize() );
00427 }
00428
else
00429 childFrm->resize( curSize );
00430
00431 idx++;
00432 }
00433 list.removeFirst();
00434 }
00435
focusTopChild();
00436 }
00437
00438 void KMdiChildArea::expandVertical()
00439 {
00440 kdDebug( 760 ) << k_funcinfo <<
"expanding all child frames vertically" << endl;
00441
int idx = 0;
00442
QPtrList<KMdiChildFrm> list( *
m_pZ );
00443 list.setAutoDelete(
false );
00444
while ( !list.isEmpty() )
00445 {
00446
KMdiChildFrm* childFrm = list.first();
00447
if ( childFrm->
state() != KMdiChildFrm::Minimized )
00448 {
00449
if ( childFrm->
state() == KMdiChildFrm::Maximized )
00450 childFrm->
restorePressed();
00451
00452 childFrm->setGeometry( childFrm->x(), 0, childFrm->width(), height() );
00453 idx++;
00454 }
00455 list.removeFirst();
00456 }
00457
focusTopChild();
00458 }
00459
00460 void KMdiChildArea::expandHorizontal()
00461 {
00462 kdDebug( 760 ) << k_funcinfo <<
"expanding all child frames horizontally" << endl;
00463
int idx = 0;
00464
QPtrList<KMdiChildFrm> list( *
m_pZ );
00465 list.setAutoDelete(
false );
00466
while ( !list.isEmpty() )
00467 {
00468
KMdiChildFrm* childFrm = list.first();
00469
if ( childFrm->
state() != KMdiChildFrm::Minimized )
00470 {
00471
if ( childFrm->
state() == KMdiChildFrm::Maximized )
00472 childFrm->
restorePressed();
00473
00474 childFrm->setGeometry( 0, childFrm->y(), width(), childFrm->height() );
00475 idx++;
00476 }
00477 list.removeFirst();
00478 }
00479
focusTopChild();
00480 }
00481
00482 int KMdiChildArea::getVisibleChildCount()
const
00483
{
00484
int visibleChildCount = 0;
00485
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00486
for ( ; ( *it ); ++it )
00487 {
00488
if ( ( *it )->state() != KMdiChildFrm::Minimized && ( *it )->isVisible() )
00489 visibleChildCount++;
00490 }
00491
return visibleChildCount;
00492 }
00493
00494 void KMdiChildArea::tilePragma()
00495 {
00496 kdDebug( 760 ) << k_funcinfo << endl;
00497
tileAllInternal( 9 );
00498 }
00499
00500 void KMdiChildArea::tileAllInternal(
int maxWnds )
00501 {
00502 kdDebug( 760 ) << k_funcinfo << endl;
00503
00504
static int colstable[ 9 ] = { 1, 1, 1, 2, 2, 2, 3, 3, 3 };
00505
static int rowstable[ 9 ] = { 1, 2, 3, 2, 3, 3, 3, 3, 3 };
00506
static int lastwindw[ 9 ] = { 1, 1, 1, 1, 2, 1, 3, 2, 1 };
00507
static int colrecall[ 9 ] = { 0, 0, 0, 3, 3, 3, 6, 6, 6 };
00508
static int rowrecall[ 9 ] = { 0, 0, 0, 0, 4, 4, 4, 4, 4 };
00509
00510
int numVisible =
getVisibleChildCount();
00511
if ( numVisible < 1 )
00512 {
00513 kdDebug( 760 ) << k_funcinfo <<
"No visible child windows to tile" << endl;
00514
return;
00515 }
00516
00517
KMdiChildFrm *tcw =
topChild();
00518
int numToHandle = ( ( numVisible > maxWnds ) ? maxWnds : numVisible );
00519
00520
int xQuantum = width() / colstable[ numToHandle - 1 ];
00521
int widthToCompare;
00522
00523
if ( tcw->minimumWidth() >
m_defaultChildFrmSize.width() )
00524 widthToCompare = tcw->minimumWidth();
00525
else
00526 widthToCompare =
m_defaultChildFrmSize.width();
00527
00528
if ( xQuantum < widthToCompare )
00529 {
00530
if ( colrecall[ numToHandle - 1 ] != 0 )
00531 {
00532
tileAllInternal( colrecall[ numToHandle - 1 ] );
00533
return ;
00534 }
00535 }
00536
00537
int yQuantum = height() / rowstable[ numToHandle - 1 ];
00538
int heightToCompare;
00539
if ( tcw->minimumHeight() >
m_defaultChildFrmSize.height() )
00540 heightToCompare = tcw->minimumHeight();
00541
else
00542 heightToCompare =
m_defaultChildFrmSize.height();
00543
00544
if ( yQuantum < heightToCompare )
00545 {
00546
if ( rowrecall[ numToHandle - 1 ] != 0 )
00547 {
00548
tileAllInternal( rowrecall[ numToHandle - 1 ] );
00549
return ;
00550 }
00551 }
00552
int curX = 0;
00553
int curY = 0;
00554
int curRow = 1;
00555
int curCol = 1;
00556
int curWin = 1;
00557
00558
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00559
for ( ; ( *it ); ++it )
00560 {
00561
KMdiChildFrm* child = ( *it );
00562
if ( child->
state() != KMdiChildFrm::Minimized )
00563 {
00564
00565
if ( child->
state() == KMdiChildFrm::Maximized )
00566 child->
restorePressed();
00567
00568
if ( ( curWin % numToHandle ) == 0 )
00569 child->setGeometry( curX, curY, xQuantum * lastwindw[ numToHandle - 1 ], yQuantum );
00570
else
00571 child->setGeometry( curX, curY, xQuantum, yQuantum );
00572
00573
00574
if ( curCol < colstable[ numToHandle - 1 ] )
00575 {
00576 curX += xQuantum;
00577 curCol++;
00578 }
00579
else
00580 {
00581 curX = 0;
00582 curCol = 1;
00583
if ( curRow < rowstable[ numToHandle - 1 ] )
00584 {
00585 curY += yQuantum;
00586 curRow++;
00587 }
00588
else
00589 {
00590 curY = 0;
00591 curRow = 1;
00592 }
00593 }
00594 curWin++;
00595 }
00596 }
00597
00598
if ( tcw )
00599 tcw->
m_pClient->
activate();
00600 }
00601
00602 void KMdiChildArea::tileAnodine()
00603 {
00604
KMdiChildFrm * topChildWindow =
topChild();
00605
int numVisible =
getVisibleChildCount();
00606
if ( numVisible < 1 )
00607
return ;
00608
00609
int numCols = int( sqrt( (
double ) numVisible ) );
00610
00611
int *numRows =
new int[ numCols ];
00612
int numCurCol = 0;
00613
00614
while ( numCurCol < numCols )
00615 {
00616 numRows[numCurCol] = numCols;
00617 numCurCol++;
00618 }
00619
00620
int numDiff = numVisible - ( numCols * numCols );
00621
int numCurDiffCol = numCols;
00622
00623
while ( numDiff > 0 )
00624 {
00625 numCurDiffCol--;
00626 numRows[numCurDiffCol]++;
00627
00628
if ( numCurDiffCol < 1 )
00629 numCurDiffCol = numCols;
00630
00631 numDiff--;
00632 }
00633
00634 numCurCol = 0;
00635
int numCurRow = 0;
00636
int curX = 0;
00637
int curY = 0;
00638
00639
00640
00641
00642
int xQuantum = width() / numCols;
00643
int yQuantum = height() / numRows[numCurCol];
00644
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00645
for ( ; ( *it ); ++it )
00646 {
00647
KMdiChildFrm* child = ( *it );
00648
if ( child->
state() != KMdiChildFrm::Minimized )
00649 {
00650
if ( child->
state() == KMdiChildFrm::Maximized )
00651 child->
restorePressed();
00652
00653 child->setGeometry( curX, curY, xQuantum, yQuantum );
00654 numCurRow++;
00655 curY += yQuantum;
00656
00657
if ( numCurRow == numRows[numCurCol] )
00658 {
00659 numCurRow = 0;
00660 numCurCol++;
00661 curY = 0;
00662 curX += xQuantum;
00663
if ( numCurCol != numCols )
00664 yQuantum = height() / numRows[ numCurCol ];
00665 }
00666 }
00667 }
00668
00669
delete[] numRows;
00670
00671
if ( topChildWindow )
00672 topChildWindow->
m_pClient->
activate();
00673 }
00674
00675
00676 void KMdiChildArea::tileVertically()
00677 {
00678
KMdiChildFrm * topChildWindow =
topChild();
00679
int numVisible =
getVisibleChildCount();
00680
if ( numVisible < 1 )
00681
return ;
00682
00683
int w = width() / numVisible;
00684
int lastWidth = 0;
00685
00686
if ( numVisible > 1 )
00687 lastWidth = width() - ( w * ( numVisible - 1 ) );
00688
else
00689 lastWidth = w;
00690
00691
int h = height();
00692
int posX = 0;
00693
int countVisible = 0;
00694
00695
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00696
for ( ; ( *it ); ++it )
00697 {
00698
KMdiChildFrm* child = ( *it );
00699
if ( child->
state() != KMdiChildFrm::Minimized )
00700 {
00701
if ( child->
state() == KMdiChildFrm::Maximized )
00702 child->
restorePressed();
00703
00704 countVisible++;
00705
00706
if ( countVisible < numVisible )
00707 {
00708 child->setGeometry( posX, 0, w, h );
00709 posX += w;
00710 }
00711
else
00712 {
00713 child->setGeometry( posX, 0, lastWidth, h );
00714 }
00715 }
00716 }
00717
00718
if ( topChildWindow )
00719 topChildWindow->
m_pClient->
activate();
00720 }
00721
00722
00723 void KMdiChildArea::layoutMinimizedChildren()
00724 {
00725
int posX = 0;
00726
int posY = height();
00727
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00728
for ( ; ( *it ); ++it )
00729 {
00730
KMdiChildFrm* child = *( it );
00731
if ( child->
state() == KMdiChildFrm::Minimized )
00732 {
00733
00734
if ( ( posX > 0 ) && ( posX + child->width() > width() ) )
00735 {
00736 posX = 0;
00737 posY -= child->height();
00738 }
00739
00740 child->move( posX, posY - child->height() );
00741 posX = child->geometry().right();
00742 }
00743 }
00744 }
00745
00746
00747 void KMdiChildArea::setMdiCaptionFont(
const QFont& fnt )
00748 {
00749
m_captionFont = fnt;
00750
QFontMetrics fm(
m_captionFont );
00751 m_captionFontLineSpacing = fm.lineSpacing();
00752
00753
QPtrListIterator<KMdiChildFrm> it( *
m_pZ );
00754
for ( ; ( *it ); ++it )
00755 ( *it )->doResize();
00756
00757 }
00758
00759 void KMdiChildArea::setMdiCaptionActiveForeColor(
const QColor& clr )
00760 {
00761
m_captionActiveForeColor = clr;
00762 }
00763
00764 void KMdiChildArea::setMdiCaptionActiveBackColor(
const QColor& clr )
00765 {
00766
m_captionActiveBackColor = clr;
00767 }
00768
00769 void KMdiChildArea::setMdiCaptionInactiveForeColor(
const QColor& clr )
00770 {
00771
m_captionInactiveForeColor = clr;
00772 }
00773
00774 void KMdiChildArea::setMdiCaptionInactiveBackColor(
const QColor& clr )
00775 {
00776
m_captionInactiveBackColor = clr;
00777 }
00778
00779
00780 void KMdiChildArea::getCaptionColors(
const QPalette& ,
QColor& activeBG,
00781
QColor& activeFG,
QColor& inactiveBG,
QColor& inactiveFG )
00782 {
00783 activeBG = KGlobalSettings::activeTitleColor();
00784 activeFG = KGlobalSettings::activeTextColor();
00785 inactiveBG = KGlobalSettings::inactiveTitleColor();
00786 inactiveFG = KGlobalSettings::inactiveTextColor();
00787 }
00788
00789