• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdemdi
 

tdemdi

  • tdemdi
tdemdichildarea.cpp
1 //----------------------------------------------------------------------------
2 // filename : tdemdichildarea.cpp
3 //----------------------------------------------------------------------------
4 // Project : KDE MDI extension
5 //
6 // begin : 07/1999 by Szymon Stefanek as part of kvirc
7 // (an IRC application)
8 // changes : 09/1999 by Falk Brettschneider to create an
9 // - 06/2000 stand-alone Qt extension set of
10 // classes and a Qt-based library
11 // 2000-2003 maintained by the KDevelop project
12 //
13 // copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
14 // and
15 // Falk Brettschneider
16 // email : falkbr@kdevelop.org (Falk Brettschneider)
17 //----------------------------------------------------------------------------
18 //
19 //----------------------------------------------------------------------------
20 //
21 // This program is free software; you can redistribute it and/or modify
22 // it under the terms of the GNU Library General Public License as
23 // published by the Free Software Foundation; either version 2 of the
24 // License, or (at your option) any later version.
25 //
26 //----------------------------------------------------------------------------
27 
28 #include "tdemdichildarea.h"
29 #include "tdemdichildarea.moc"
30 
31 #include "tdemdidefines.h"
32 
33 #include <tdeconfig.h>
34 #include <kdebug.h>
35 #include <tdeglobal.h>
36 #include <tdeglobalsettings.h>
37 
38 #include <math.h>
39 #include <tqpopupmenu.h>
40 
41 
43 // KMdiChildArea
45 
46 //============ KMdiChildArea ============//
47 
48 KMdiChildArea::KMdiChildArea( TQWidget *parent )
49  : TQFrame( parent, "tdemdi_childarea" )
50 {
51  setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
52  m_captionFont = TQFont();
53  TQFontMetrics fm( m_captionFont );
54  m_captionFontLineSpacing = fm.lineSpacing();
55  m_captionActiveBackColor = TDEGlobalSettings::activeTitleColor();
56  m_captionActiveForeColor = TDEGlobalSettings::activeTextColor();
57  m_captionInactiveBackColor = TDEGlobalSettings::inactiveTitleColor();
58  m_captionInactiveForeColor = TDEGlobalSettings::inactiveTextColor();
59  m_pZ = new TQPtrList<KMdiChildFrm>;
60  m_pZ->setAutoDelete( true );
61  setFocusPolicy( TQWidget::ClickFocus );
62  m_defaultChildFrmSize = TQSize( 400, 300 );
63 }
64 
65 
66 KMdiChildArea::~KMdiChildArea()
67 {
68  delete m_pZ; //This will destroy all the widgets inside.
69 }
70 
71 
72 void KMdiChildArea::manageChild( KMdiChildFrm* child, bool show, bool cascade )
73 {
74  kdDebug( 760 ) << k_funcinfo << "Adding child " << child << " to be managed" << endl;
75  KMdiChildFrm* top = topChild();
76 
77  //remove old references. There can be more than one so we remove them all
78  if ( m_pZ->findRef( child ) != -1 )
79  {
80  //TQPtrList::find* moves current() to the found item
81  m_pZ->take();
82  while ( m_pZ->findNextRef( child ) != -1 )
83  m_pZ->take();
84  }
85 
86  if ( show )
87  m_pZ->append( child ); //visible -> first in the Z order
88  else
89  m_pZ->insert( 0, child ); //hidden -> last in the Z order
90 
91  if ( cascade )
92  child->move( getCascadePoint( m_pZ->count() - 1 ) );
93 
94  if ( show )
95  {
96  if ( top && top->state() == KMdiChildFrm::Maximized )
97  {
98  kdDebug( 760 ) << k_funcinfo << "Maximizing the new child" << endl;
99  emit sysButtonConnectionsMustChange( top, child );
100  top->setState( KMdiChildFrm::Normal, false /*animate*/ );
101  child->setState( KMdiChildFrm::Maximized, false /*animate*/ );
102  }
103  child->show();
104  focusTopChild();
105  }
106 }
107 
108 
109 void KMdiChildArea::destroyChild( KMdiChildFrm *child, bool focusTop )
110 {
111  kdDebug( 760 ) << k_funcinfo << "Removing child " << child->caption() << endl;
112  bool wasMaximized = ( child->state() == KMdiChildFrm::Maximized );
113 
114  // destroy the old one
115  disconnect( child );
116  child->blockSignals( true );
117  m_pZ->setAutoDelete( false );
118  m_pZ->removeRef( child );
119 
120  // focus the next new childframe
121  KMdiChildFrm* newTopChild = topChild();
122  if ( wasMaximized )
123  {
124  if ( newTopChild )
125  {
126  newTopChild->setState( KMdiChildFrm::Maximized, false );
127  emit sysButtonConnectionsMustChange( child, newTopChild );
128  }
129  else
130  emit noMaximizedChildFrmLeft( child ); // last childframe removed
131  }
132 
133  delete child;
134  m_pZ->setAutoDelete( true );
135 
136  if ( focusTop )
137  focusTopChild();
138 }
139 
140 
141 void KMdiChildArea::destroyChildButNotItsView( KMdiChildFrm* child, bool focusTop )
142 {
143  kdDebug( 760 ) << k_funcinfo << "Removing child " << child->caption() << endl;
144  bool wasMaximized = ( child->state() == KMdiChildFrm::Maximized );
145 
146  // destroy the old one
147  disconnect( child );
148  child->unsetClient();
149  m_pZ->setAutoDelete( false );
150  m_pZ->removeRef( child );
151 
152  // focus the next new childframe
153  KMdiChildFrm* newTopChild = topChild();
154  if ( wasMaximized )
155  {
156  if ( newTopChild )
157  {
158  newTopChild->setState( KMdiChildFrm::Maximized, false );
159  emit sysButtonConnectionsMustChange( child, newTopChild );
160  }
161  else
162  emit noMaximizedChildFrmLeft( child ); // last childframe removed
163  }
164  delete child;
165  m_pZ->setAutoDelete( true );
166 
167  if ( focusTop )
168  focusTopChild();
169 }
170 
171 void KMdiChildArea::setTopChild( KMdiChildFrm* child, bool /* bSetFocus */ )
172 {
173  if ( !child )
174  return;
175 
176  if ( topChild() != child )
177  {
178  kdDebug( 760 ) << k_funcinfo << "Setting " << child->caption() << " as the new top child" << endl;
179  m_pZ->setAutoDelete( false );
180  if ( child )
181  m_pZ->removeRef( child );
182  m_pZ->setAutoDelete( true );
183 
184  //disable the labels of all the other children
185  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
186  for ( ; ( *it ); ++it )
187  ( *it )->m_pCaption->setActive( false );
188 
189  KMdiChildFrm* maximizedChild = topChild();
190  bool topChildMaximized = false;
191  if ( maximizedChild && maximizedChild->state() == KMdiChildFrm::Maximized )
192  topChildMaximized = true;
193 
194  m_pZ->append( child );
195 
196  int nChildAreaMinW = 0, nChildAreaMinH = 0;
197  int nChildAreaMaxW = TQWIDGETSIZE_MAX, nChildAreaMaxH = TQWIDGETSIZE_MAX;
198  if ( topChildMaximized && child->m_pClient )
199  {
200  //the former top child is maximized, so maximize the new one
201  nChildAreaMinW = child->m_pClient->minimumWidth();
202  nChildAreaMinH = child->m_pClient->minimumHeight();
204  // nChildAreaMaxW = child->m_pClient->maximumWidth();
205  // nChildAreaMaxH = child->m_pClient->maximumHeight();
206  }
207 
208  //set the min and max sizes of this child area to the new top child
209  setMinimumSize( nChildAreaMinW, nChildAreaMinH );
210  setMaximumSize( nChildAreaMaxW, nChildAreaMaxH );
211 
212  if ( topChildMaximized )
213  { //maximize the new view and restore the old
214  child->setState( KMdiChildFrm::Maximized, false /*animate*/);
215  maximizedChild->setState( KMdiChildFrm::Normal, false /*animate*/ );
216  emit sysButtonConnectionsMustChange( maximizedChild, child );
217  }
218  else
219  child->raise();
220 
221  TQFocusEvent::setReason( TQFocusEvent::Other );
222  child->m_pClient->setFocus();
223  }
224 }
225 
226 
227 void KMdiChildArea::resizeEvent( TQResizeEvent* e )
228 {
229  //If we have a maximized children at the top , adjust its size
230  KMdiChildFrm* child = topChild();
231  if ( child && child->state() == KMdiChildFrm::Maximized )
232  {
233  int clientw = 0, clienth = 0;
234  if ( child->m_pClient != 0L )
235  {
236  clientw = child->m_pClient->width();
237  clienth = child->m_pClient->height();
238  }
239  child->resize( width() + KMDI_CHILDFRM_DOUBLE_BORDER,
240  height() + child->m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_DOUBLE_BORDER );
241 
242  }
243  layoutMinimizedChildren();
244  TQWidget::resizeEvent( e );
245 }
246 
247 //=============== mousePressEvent =============//
248 
249 void KMdiChildArea::mousePressEvent( TQMouseEvent *e )
250 {
251  //Popup the window menu
252  if ( e->button() & TQt::RightButton )
253  emit popupWindowMenu( mapToGlobal( e->pos() ) );
254 }
255 
256 //=============== getCascadePoint ============//
257 
258 TQPoint KMdiChildArea::getCascadePoint( int indexOfWindow )
259 {
260  if ( indexOfWindow < 0 )
261  {
262  indexOfWindow = m_pZ->count(); //use the window count
263  kdDebug( 760 ) << k_funcinfo << "indexOfWindow was less than zero, using "
264  << indexOfWindow << " as new index" << endl;
265  }
266 
267  TQPoint pnt( 0, 0 );
268  if ( indexOfWindow == 0 )
269  {
270  kdDebug( 760 ) << k_funcinfo << "No windows. Returning TQPoint( 0, 0 ) as the cascade point" << endl;
271  return pnt;
272  }
273 
274  bool topLevelMode = false;
275  if ( height() == 1 ) // hacky?!
276  topLevelMode = true;
277 
278  kdDebug( 760 ) << k_funcinfo << "Getting the cascade point for window index " << indexOfWindow << endl;
279  kdDebug( 760 ) << k_funcinfo << "Do we think we're in top level mode? " << topLevelMode << endl;
280 
281  KMdiChildFrm* child = m_pZ->first();
282 
283  //default values
284  int step = 20;
285  int h = ( topLevelMode ? TQApplication::desktop()->height() : height() );
286  int w = ( topLevelMode ? TQApplication::desktop()->width() : width() );
287 
288  int availableHeight = h - m_defaultChildFrmSize.height();
289  int availableWidth = w - m_defaultChildFrmSize.width();
290  int ax = 0;
291  int ay = 0;
292 
293  if ( child )
294  {
295  kdDebug( 760 ) << k_funcinfo << "child frame exists. resetting height and width values" << endl;
296  step = child->m_pCaption->heightHint() + KMDI_CHILDFRM_BORDER;
297  availableHeight = h - child->minimumHeight();
298  availableWidth = w - child->minimumWidth();
299  }
300 
301  for ( int i = 0; i < indexOfWindow; i++ )
302  {
303  ax += step;
304  ay += step;
305 
306  //do some bounds checking, because to not do it would be bad.
307  if ( ax > availableWidth )
308  ax = 0;
309 
310  if ( ay > availableHeight )
311  ay = 0;
312  }
313  pnt.setX( ax );
314  pnt.setY( ay );
315  return pnt;
316 }
317 
318 
319 void KMdiChildArea::childMinimized( KMdiChildFrm *minimizedChild, bool wasMaximized )
320 {
321  //can't find the child in our list, so we don't care.
322  if ( m_pZ->findRef( minimizedChild ) == -1 )
323  {
324  kdDebug( 760 ) << k_funcinfo << "child was minimized but wasn't in our list!" << endl;
325  return;
326  }
327 
328  kdDebug( 760 ) << k_funcinfo << endl;
329  if ( m_pZ->count() > 1 )
330  {
331  //move the minimized child to the bottom
332  m_pZ->setAutoDelete( false );
333  m_pZ->removeRef( minimizedChild );
334  m_pZ->setAutoDelete( true );
335  m_pZ->insert( 0, minimizedChild );
336 
337  if ( wasMaximized )
338  { // Need to maximize the new top child
339  kdDebug( 760 ) << k_funcinfo << "child just minimized from maximized state. maximize new top child" << endl;
340  minimizedChild = topChild();
341  if ( !minimizedChild )
342  return; //??
343 
344  if ( minimizedChild->state() == KMdiChildFrm::Maximized )
345  return; //it's already maximized
346 
347  minimizedChild->setState( KMdiChildFrm::Maximized, false ); //do not animate the change
348  }
349  focusTopChild();
350  }
351  else
352  setFocus(); //Remove focus from the child. We only have one window
353 }
354 
355 void KMdiChildArea::focusTopChild()
356 {
357  KMdiChildFrm* lastChild = topChild();
358  if ( !lastChild )
359  {
360  kdDebug( 760 ) << k_funcinfo << "No more child windows left" << endl;
361  emit lastChildFrmClosed();
362  return;
363  }
364 
365  if ( !lastChild->m_pClient->hasFocus() )
366  {
367  //disable the labels of all the other children
368  TQPtrListIterator<KMdiChildFrm> it ( *m_pZ );
369  for ( ; ( *it ); ++it )
370  {
371  if ( ( *it ) != lastChild )
372  ( *it )->m_pCaption->setActive( false );
373  }
374 
375  kdDebug( 760 ) << k_funcinfo << "Giving focus to " << lastChild->caption() << endl;
376  lastChild->raise();
377  lastChild->m_pClient->activate();
378  }
379 
380 }
381 
382 void KMdiChildArea::cascadeWindows()
383 {
384  kdDebug( 760 ) << k_funcinfo << "cascading windows but not changing their size" << endl;
385  int idx = 0;
386  TQPtrList<KMdiChildFrm> list( *m_pZ );
387  list.setAutoDelete( false );
388  while ( !list.isEmpty() )
389  {
390  KMdiChildFrm* childFrm = list.first();
391  if ( childFrm->state() != KMdiChildFrm::Minimized )
392  {
393  if ( childFrm->state() == KMdiChildFrm::Maximized )
394  childFrm->restorePressed();
395 
396  childFrm->move( getCascadePoint( idx ) );
397  idx++;
398  }
399  list.removeFirst();
400  }
401  focusTopChild();
402 }
403 
404 void KMdiChildArea::cascadeMaximized()
405 {
406  kdDebug( 760 ) << k_funcinfo << "cascading windows. will make sure they are minimum sized" << endl;
407  int idx = 0;
408  TQPtrList<KMdiChildFrm> list( *m_pZ );
409 
410  list.setAutoDelete( false );
411  while ( !list.isEmpty() )
412  {
413  KMdiChildFrm* childFrm = list.first();
414  if (childFrm->state() != KMdiChildFrm::Minimized )
415  {
416  if (childFrm->state() == KMdiChildFrm::Maximized )
417  childFrm->restorePressed();
418 
419  TQPoint pnt( getCascadePoint( idx ) );
420  childFrm->move( pnt );
421  TQSize curSize( width() - pnt.x(), height() - pnt.y() );
422 
423  if ( ( childFrm->minimumSize().width() > curSize.width() ) ||
424  ( childFrm->minimumSize().height() > curSize.height() ) )
425  {
426  childFrm->resize( childFrm->minimumSize() );
427  }
428  else
429  childFrm->resize( curSize );
430 
431  idx++;
432  }
433  list.removeFirst();
434  }
435  focusTopChild();
436 }
437 
438 void KMdiChildArea::expandVertical()
439 {
440  kdDebug( 760 ) << k_funcinfo << "expanding all child frames vertically" << endl;
441  int idx = 0;
442  TQPtrList<KMdiChildFrm> list( *m_pZ );
443  list.setAutoDelete( false );
444  while ( !list.isEmpty() )
445  {
446  KMdiChildFrm* childFrm = list.first();
447  if ( childFrm->state() != KMdiChildFrm::Minimized )
448  {
449  if ( childFrm->state() == KMdiChildFrm::Maximized )
450  childFrm->restorePressed();
451 
452  childFrm->setGeometry( childFrm->x(), 0, childFrm->width(), height() );
453  idx++;
454  }
455  list.removeFirst();
456  }
457  focusTopChild();
458 }
459 
460 void KMdiChildArea::expandHorizontal()
461 {
462  kdDebug( 760 ) << k_funcinfo << "expanding all child frames horizontally" << endl;
463  int idx = 0;
464  TQPtrList<KMdiChildFrm> list( *m_pZ );
465  list.setAutoDelete( false );
466  while ( !list.isEmpty() )
467  {
468  KMdiChildFrm* childFrm = list.first();
469  if ( childFrm->state() != KMdiChildFrm::Minimized )
470  {
471  if ( childFrm->state() == KMdiChildFrm::Maximized )
472  childFrm->restorePressed();
473 
474  childFrm->setGeometry( 0, childFrm->y(), width(), childFrm->height() );
475  idx++;
476  }
477  list.removeFirst();
478  }
479  focusTopChild();
480 }
481 
482 int KMdiChildArea::getVisibleChildCount() const
483 {
484  int visibleChildCount = 0;
485  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
486  for ( ; ( *it ); ++it )
487  {
488  if ( ( *it )->state() != KMdiChildFrm::Minimized && ( *it )->isVisible() )
489  visibleChildCount++;
490  }
491  return visibleChildCount;
492 }
493 
494 void KMdiChildArea::tilePragma()
495 {
496  kdDebug( 760 ) << k_funcinfo << endl;
497  tileAllInternal( 9 );
498 }
499 
500 void KMdiChildArea::tileAllInternal( int maxWnds )
501 {
502  kdDebug( 760 ) << k_funcinfo << endl;
503  //NUM WINDOWS = 1,2,3,4,5,6,7,8,9
504  static int colstable[ 9 ] = { 1, 1, 1, 2, 2, 2, 3, 3, 3 }; //num columns
505  static int rowstable[ 9 ] = { 1, 2, 3, 2, 3, 3, 3, 3, 3 }; //num rows
506  static int lastwindw[ 9 ] = { 1, 1, 1, 1, 2, 1, 3, 2, 1 }; //last window multiplier
507  static int colrecall[ 9 ] = { 0, 0, 0, 3, 3, 3, 6, 6, 6 }; //adjust self
508  static int rowrecall[ 9 ] = { 0, 0, 0, 0, 4, 4, 4, 4, 4 }; //adjust self
509 
510  int numVisible = getVisibleChildCount();
511  if ( numVisible < 1 )
512  {
513  kdDebug( 760 ) << k_funcinfo << "No visible child windows to tile" << endl;
514  return;
515  }
516 
517  KMdiChildFrm *tcw = topChild();
518  int numToHandle = ( ( numVisible > maxWnds ) ? maxWnds : numVisible );
519 
520  int xQuantum = width() / colstable[ numToHandle - 1 ];
521  int widthToCompare;
522 
523  if ( tcw->minimumWidth() > m_defaultChildFrmSize.width() )
524  widthToCompare = tcw->minimumWidth();
525  else
526  widthToCompare = m_defaultChildFrmSize.width();
527 
528  if ( xQuantum < widthToCompare )
529  {
530  if ( colrecall[ numToHandle - 1 ] != 0 )
531  {
532  tileAllInternal( colrecall[ numToHandle - 1 ] );
533  return ;
534  }
535  }
536 
537  int yQuantum = height() / rowstable[ numToHandle - 1 ];
538  int heightToCompare;
539  if ( tcw->minimumHeight() > m_defaultChildFrmSize.height() )
540  heightToCompare = tcw->minimumHeight();
541  else
542  heightToCompare = m_defaultChildFrmSize.height();
543 
544  if ( yQuantum < heightToCompare )
545  {
546  if ( rowrecall[ numToHandle - 1 ] != 0 )
547  {
548  tileAllInternal( rowrecall[ numToHandle - 1 ] );
549  return ;
550  }
551  }
552  int curX = 0;
553  int curY = 0;
554  int curRow = 1;
555  int curCol = 1;
556  int curWin = 1;
557 
558  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
559  for ( ; ( *it ); ++it )
560  {
561  KMdiChildFrm* child = ( *it );
562  if ( child->state() != KMdiChildFrm::Minimized )
563  {
564  //restore the window
565  if ( child->state() == KMdiChildFrm::Maximized )
566  child->restorePressed();
567 
568  if ( ( curWin % numToHandle ) == 0 )
569  child->setGeometry( curX, curY, xQuantum * lastwindw[ numToHandle - 1 ], yQuantum );
570  else
571  child->setGeometry( curX, curY, xQuantum, yQuantum );
572 
573  //example : 12 windows : 3 cols 3 rows
574  if ( curCol < colstable[ numToHandle - 1 ] )
575  { //curCol<3
576  curX += xQuantum; //add a column in the same row
577  curCol++; //increase current column
578  }
579  else
580  {
581  curX = 0; //new row
582  curCol = 1; //column 1
583  if ( curRow < rowstable[ numToHandle - 1 ] )
584  { //curRow<3
585  curY += yQuantum; //add a row
586  curRow++; //increase current row
587  }
588  else
589  {
590  curY = 0; //restart from beginning
591  curRow = 1; //reset current row
592  }
593  }
594  curWin++;
595  }
596  }
597 
598  if ( tcw )
599  tcw->m_pClient->activate();
600 }
601 
602 void KMdiChildArea::tileAnodine()
603 {
604  KMdiChildFrm * topChildWindow = topChild();
605  int numVisible = getVisibleChildCount(); // count visible windows
606  if ( numVisible < 1 )
607  return ;
608 
609  int numCols = int( sqrt( ( double ) numVisible ) ); // set columns to square root of visible count
610  // create an array to form grid layout
611  int *numRows = new int[ numCols ];
612  int numCurCol = 0;
613 
614  while ( numCurCol < numCols )
615  {
616  numRows[numCurCol] = numCols; // create primary grid values
617  numCurCol++;
618  }
619 
620  int numDiff = numVisible - ( numCols * numCols ); // count extra rows
621  int numCurDiffCol = numCols; // set column limiting for grid updates
622 
623  while ( numDiff > 0 )
624  {
625  numCurDiffCol--;
626  numRows[numCurDiffCol]++; // add extra rows to column grid
627 
628  if ( numCurDiffCol < 1 )
629  numCurDiffCol = numCols; // rotate through the grid
630 
631  numDiff--;
632  }
633 
634  numCurCol = 0;
635  int numCurRow = 0;
636  int curX = 0;
637  int curY = 0;
638 
639  // the following code will size everything based on my grid above
640  // there is no limit to the number of windows it will handle
641  // it's great when a kick-ass theory works!!! // Pragma :)
642  int xQuantum = width() / numCols;
643  int yQuantum = height() / numRows[numCurCol];
644  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
645  for ( ; ( *it ); ++it )
646  {
647  KMdiChildFrm* child = ( *it );
648  if ( child->state() != KMdiChildFrm::Minimized )
649  {
650  if ( child->state() == KMdiChildFrm::Maximized )
651  child->restorePressed();
652 
653  child->setGeometry( curX, curY, xQuantum, yQuantum );
654  numCurRow++;
655  curY += yQuantum;
656 
657  if ( numCurRow == numRows[numCurCol] )
658  {
659  numCurRow = 0;
660  numCurCol++;
661  curY = 0;
662  curX += xQuantum;
663  if ( numCurCol != numCols )
664  yQuantum = height() / numRows[ numCurCol ];
665  }
666  }
667  }
668 
669  delete[] numRows;
670 
671  if ( topChildWindow )
672  topChildWindow->m_pClient->activate();
673 }
674 
675 
676 void KMdiChildArea::tileVertically()
677 {
678  KMdiChildFrm * topChildWindow = topChild();
679  int numVisible = getVisibleChildCount(); // count visible windows
680  if ( numVisible < 1 )
681  return ;
682 
683  int w = width() / numVisible;
684  int lastWidth = 0;
685 
686  if ( numVisible > 1 )
687  lastWidth = width() - ( w * ( numVisible - 1 ) );
688  else
689  lastWidth = w;
690 
691  int h = height();
692  int posX = 0;
693  int countVisible = 0;
694 
695  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
696  for ( ; ( *it ); ++it )
697  {
698  KMdiChildFrm* child = ( *it );
699  if ( child->state() != KMdiChildFrm::Minimized )
700  {
701  if ( child->state() == KMdiChildFrm::Maximized )
702  child->restorePressed();
703 
704  countVisible++;
705 
706  if ( countVisible < numVisible )
707  {
708  child->setGeometry( posX, 0, w, h );
709  posX += w;
710  }
711  else
712  { // last visible childframe
713  child->setGeometry( posX, 0, lastWidth, h );
714  }
715  }
716  }
717 
718  if ( topChildWindow )
719  topChildWindow->m_pClient->activate();
720 }
721 
722 
723 void KMdiChildArea::layoutMinimizedChildren()
724 {
725  int posX = 0;
726  int posY = height();
727  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
728  for ( ; ( *it ); ++it )
729  {
730  KMdiChildFrm* child = *( it );
731  if ( child->state() == KMdiChildFrm::Minimized )
732  {
733 
734  if ( ( posX > 0 ) && ( posX + child->width() > width() ) )
735  {
736  posX = 0;
737  posY -= child->height();
738  }
739 
740  child->move( posX, posY - child->height() );
741  posX = child->geometry().right();
742  }
743  }
744 }
745 
746 
747 void KMdiChildArea::setMdiCaptionFont( const TQFont& fnt )
748 {
749  m_captionFont = fnt;
750  TQFontMetrics fm( m_captionFont );
751  m_captionFontLineSpacing = fm.lineSpacing();
752 
753  TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
754  for ( ; ( *it ); ++it )
755  ( *it )->doResize();
756 
757 }
758 
759 void KMdiChildArea::setMdiCaptionActiveForeColor( const TQColor& clr )
760 {
761  m_captionActiveForeColor = clr;
762 }
763 
764 void KMdiChildArea::setMdiCaptionActiveBackColor( const TQColor& clr )
765 {
766  m_captionActiveBackColor = clr;
767 }
768 
769 void KMdiChildArea::setMdiCaptionInactiveForeColor( const TQColor& clr )
770 {
771  m_captionInactiveForeColor = clr;
772 }
773 
774 void KMdiChildArea::setMdiCaptionInactiveBackColor( const TQColor& clr )
775 {
776  m_captionInactiveBackColor = clr;
777 }
778 
779 //KDE4: remove
780 void KMdiChildArea::getCaptionColors( const TQPalette& /*pal*/, TQColor& activeBG,
781  TQColor& activeFG, TQColor& inactiveBG, TQColor& inactiveFG )
782 {
783  activeBG = TDEGlobalSettings::activeTitleColor();
784  activeFG = TDEGlobalSettings::activeTextColor();
785  inactiveBG = TDEGlobalSettings::inactiveTitleColor();
786  inactiveFG = TDEGlobalSettings::inactiveTextColor();
787 }
KMdiChildArea::destroyChild
void destroyChild(KMdiChildFrm *child, bool focusTopChild=true)
Destroys a managed KMdiChildFrm Also deletes the client attached to this child.
Definition: tdemdichildarea.cpp:109
KMdiChildArea::m_captionInactiveBackColor
TQColor m_captionInactiveBackColor
The foreground color of inactive MDI childframe window captions.
Definition: tdemdichildarea.h:89
KMdiChildArea::KMdiChildArea
KMdiChildArea(TQWidget *parent)
Consruction.
Definition: tdemdichildarea.cpp:48
KMdiChildArea::m_pZ
TQPtrList< KMdiChildFrm > * m_pZ
Z Order stack of KMdiChildFrm childframe windows (top=last)
Definition: tdemdichildarea.h:64
KMdiChildArea::cascadeMaximized
void cascadeMaximized()
Cascades all windows resizing them to the maximum available size.
Definition: tdemdichildarea.cpp:404
KMdiChildArea::m_captionActiveBackColor
TQColor m_captionActiveBackColor
The foreground color of the active MDI childframe window caption.
Definition: tdemdichildarea.h:79
KMdiChildArea::lastChildFrmClosed
void lastChildFrmClosed()
Signals that the last attached (docked) MDI view has been closed.
KMdiChildArea::setMdiCaptionActiveForeColor
void setMdiCaptionActiveForeColor(const TQColor &clr)
Sets the foreground color of the active MDI childframe window caption A relayout does not occur when ...
Definition: tdemdichildarea.cpp:759
KMdiChildArea::expandVertical
void expandVertical()
Maximize all windows but only in vertical direction.
Definition: tdemdichildarea.cpp:438
KMdiChildArea::topChild
KMdiChildFrm * topChild() const
Returns the topmost child (the active one) or 0 if there are no children.
Definition: tdemdichildarea.h:141
KMdiChildArea::m_captionInactiveForeColor
TQColor m_captionInactiveForeColor
The background color of inactive MDI childframe window captions.
Definition: tdemdichildarea.h:94
KMdiChildArea::manageChild
void manageChild(KMdiChildFrm *lpC, bool bShow=true, bool bCascade=true)
Appends a new KMdiChildFrm to this manager.
Definition: tdemdichildarea.cpp:72
KMdiChildArea::focusTopChild
void focusTopChild()
Gives focus to the topmost child if it doesn't get focus automatically or you want to wait to give it...
Definition: tdemdichildarea.cpp:355
KMdiChildArea::childMinimized
void childMinimized(KMdiChildFrm *lpC, bool bWasMaximized)
Internally used.
Definition: tdemdichildarea.cpp:319
KMdiChildArea::setMdiCaptionActiveBackColor
void setMdiCaptionActiveBackColor(const TQColor &clr)
Sets the background color of the active MDI childframe window captions A relayout does not occur when...
Definition: tdemdichildarea.cpp:764
KMdiChildArea::tilePragma
void tilePragma()
Tile Pragma.
Definition: tdemdichildarea.cpp:494
KMdiChildArea::destroyChildButNotItsView
void destroyChildButNotItsView(KMdiChildFrm *lpC, bool bFocusTopChild=true)
Destroys a managed KMdiChildFrm Clients attached to the KMdiChildFrm are not deleted.
Definition: tdemdichildarea.cpp:141
KMdiChildArea::layoutMinimizedChildren
void layoutMinimizedChildren()
Position and layout the minimized child frames.
Definition: tdemdichildarea.cpp:723
KMdiChildArea::expandHorizontal
void expandHorizontal()
Maximize all windows but only in horizontal direction.
Definition: tdemdichildarea.cpp:460
KMdiChildArea::popupWindowMenu
void popupWindowMenu(TQPoint)
Signals a KMdiMainFrm that the 'Window' popup menu must be shown.
KMdiChildArea::cascadeWindows
void cascadeWindows()
Cascades all windows resizing them to the minimum size.
Definition: tdemdichildarea.cpp:382
KMdiChildArea::resizeEvent
virtual void resizeEvent(TQResizeEvent *)
Automatically resizes a maximized MDI view and layouts the positions of minimized MDI views.
Definition: tdemdichildarea.cpp:227
KMdiChildArea::setMdiCaptionInactiveBackColor
void setMdiCaptionInactiveBackColor(const TQColor &clr)
Sets the background color of inactive MDI childframe window captions A relayout does not occur when u...
Definition: tdemdichildarea.cpp:774
KMdiChildArea::sysButtonConnectionsMustChange
void sysButtonConnectionsMustChange(KMdiChildFrm *, KMdiChildFrm *)
Signals a KMdiMainFrm that the signal/slot connections of the system buttons in the menubar (only in ...
KMdiChildArea::getVisibleChildCount
int getVisibleChildCount() const
Returns the number of visible children.
Definition: tdemdichildarea.cpp:482
KMdiChildArea::setMdiCaptionFont
void setMdiCaptionFont(const TQFont &fnt)
Sets the MDI childframe window caption font A relayout does not occur when using this function.
Definition: tdemdichildarea.cpp:747
KMdiChildArea::m_captionFont
TQFont m_captionFont
The MDI childframe window caption font.
Definition: tdemdichildarea.h:74
KMdiChildArea::tileVertically
void tileVertically()
Tile all the windows in the child area vertically.
Definition: tdemdichildarea.cpp:676
KMdiChildArea::m_captionActiveForeColor
TQColor m_captionActiveForeColor
The background color of the active MDI childframe window captions.
Definition: tdemdichildarea.h:84
KMdiChildArea::tileAllInternal
void tileAllInternal(int maxWnds)
Internally used for the tile algorithm.
Definition: tdemdichildarea.cpp:500
KMdiChildArea::setTopChild
void setTopChild(KMdiChildFrm *child, bool setFocus=false)
Brings the child to the top of the stack The child is focused if setFocus is true.
Definition: tdemdichildarea.cpp:171
KMdiChildArea::tileAnodine
void tileAnodine()
Tile Anodine.
Definition: tdemdichildarea.cpp:602
KMdiChildArea::mousePressEvent
void mousePressEvent(TQMouseEvent *e)
Shows the 'Window' popup menu on right mouse button click.
Definition: tdemdichildarea.cpp:249
KMdiChildArea::~KMdiChildArea
~KMdiChildArea()
Destructor : THERE should be no child windows anymore...
Definition: tdemdichildarea.cpp:66
KMdiChildArea::setMdiCaptionInactiveForeColor
void setMdiCaptionInactiveForeColor(const TQColor &clr)
Sets the foreground color of inactive MDI childframe window captions A relayout does not occur when u...
Definition: tdemdichildarea.cpp:769
KMdiChildArea::getCaptionColors
static void getCaptionColors(const TQPalette &pal, TQColor &activeBG, TQColor &activeFG, TQColor &inactiveBG, TQColor &inactiveFG) TDE_DEPRECATED
Gets all caption colors, consistent with current WM settings (or other Desktop settings e....
Definition: tdemdichildarea.cpp:780
KMdiChildArea::noMaximizedChildFrmLeft
void noMaximizedChildFrmLeft(KMdiChildFrm *)
Signals that there aren't maximized child frames any more.
KMdiChildArea::m_defaultChildFrmSize
TQSize m_defaultChildFrmSize
the default size of an newly created childframe
Definition: tdemdichildarea.h:69
KMdiChildArea::getCascadePoint
TQPoint getCascadePoint(int indexOfWindow=-1)
Calculates the cascade point for the given index.
Definition: tdemdichildarea.cpp:258
KMdiChildFrmCaption::heightHint
int heightHint()
Returns the caption bar height depending on the used font.
Definition: tdemdichildfrmcaption.cpp:198
KMdiChildFrm
Internal class.
Definition: tdemdichildfrm.h:131
KMdiChildFrm::state
MdiWindowState state() const
Returns the current state of the window.
Definition: tdemdichildfrm.h:240
KMdiChildFrm::setState
void setState(MdiWindowState state, bool bAnimate=true)
Minimizes, Maximizes, or restores the window.
Definition: tdemdichildfrm.cpp:511
KMdiChildFrm::restorePressed
void restorePressed()
Handles a click on the Restore (Normalize) button.
Definition: tdemdichildfrm.cpp:458
KMdiChildFrm::caption
const TQString & caption()
Gets the caption of this mdi child.
Definition: tdemdichildfrm.h:230
KMdiChildFrm::unsetClient
void unsetClient(TQPoint positionOffset=TQPoint(0, 0))
Reparents the client widget to 0 (desktop), moves with an offset from the original position Removes t...
Definition: tdemdichildfrm.cpp:812
KMdiChildView::activate
void activate()
This method does the same as focusInEvent().
Definition: tdemdichildview.cpp:420

tdemdi

Skip menu "tdemdi"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdemdi

Skip menu "tdemdi"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdemdi by doxygen 1.9.1
This website is maintained by Timothy Pearson.