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

tdemdi

  • tdemdi
tdemdichildview.cpp
1 //----------------------------------------------------------------------------
2 // filename : tdemdichildview.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 a
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 // patches : 02/2000 by Massimo Morin (mmorin@schedsys.com)
13 // */2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
14 // 02/2001 by Eva Brucherseifer (eva@rt.e-technik.tu-darmstadt.de)
15 // 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
16 //
17 // copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
18 // and
19 // Falk Brettschneider
20 // email : falkbr@kdevelop.org (Falk Brettschneider)
21 //----------------------------------------------------------------------------
22 //
23 //----------------------------------------------------------------------------
24 //
25 // This program is free software; you can redistribute it and/or modify
26 // it under the terms of the GNU Library General Public License as
27 // published by the Free Software Foundation; either version 2 of the
28 // License, or (at your option) any later version.
29 //
30 //----------------------------------------------------------------------------
31 
32 #include "tdemdichildview.h"
33 #include "tdemdichildview.moc"
34 
35 #include <tqdatetime.h>
36 #include <tqobjectlist.h>
37 
38 #include "tdemdimainfrm.h"
39 #include "tdemdichildfrm.h"
40 #include "tdemdidefines.h"
41 #include <kdebug.h>
42 #include <tdelocale.h>
43 #include <tqiconset.h>
44 
45 //============ KMdiChildView ============//
46 
47 KMdiChildView::KMdiChildView( const TQString& caption, TQWidget* parentWidget, const char* name, WFlags f )
48  : TQWidget( parentWidget, name, f )
49  , m_focusedChildWidget( 0L )
50  , m_firstFocusableChildWidget( 0L )
51  , m_lastFocusableChildWidget( 0L )
52  , m_stateChanged( true )
53  , m_bToolView( false )
54  , m_bInterruptActivation( false )
55  , m_bMainframesActivateViewIsPending( false )
56  , m_bFocusInEventIsPending( false )
57  , m_trackChanges( 0 )
58 {
59  setGeometry( 0, 0, 0, 0 ); // reset
60  if ( caption != 0L )
61  m_szCaption = caption;
62  else
63  m_szCaption = i18n( "Unnamed" );
64 
65  m_sTabCaption = m_szCaption;
66  setFocusPolicy( TQWidget::ClickFocus );
67  installEventFilter( this );
68 
69  // store the current time
70  updateTimeStamp();
71 }
72 
73 
74 //============ KMdiChildView ============//
75 
76 KMdiChildView::KMdiChildView( TQWidget* parentWidget, const char* name, WFlags f )
77  : TQWidget( parentWidget, name, f )
78  , m_focusedChildWidget( 0L )
79  , m_firstFocusableChildWidget( 0L )
80  , m_lastFocusableChildWidget( 0L )
81  , m_stateChanged( true )
82  , m_bToolView( false )
83  , m_bInterruptActivation( false )
84  , m_bMainframesActivateViewIsPending( false )
85  , m_bFocusInEventIsPending( false )
86  , m_trackChanges( 0 )
87 {
88  setGeometry( 0, 0, 0, 0 ); // reset
89  m_szCaption = i18n( "Unnamed" );
90  m_sTabCaption = m_szCaption;
91  setFocusPolicy( TQWidget::ClickFocus );
92  installEventFilter( this );
93 
94  // store the current time
95  updateTimeStamp();
96 }
97 
98 //============ ~KMdiChildView ============//
99 
100 KMdiChildView::~KMdiChildView()
101 {
102  kdDebug( 760 ) << k_funcinfo << endl;
103 }
104 
105 void KMdiChildView::trackIconAndCaptionChanges( TQWidget *view )
106 {
107  m_trackChanges = view;
108 }
109 
110 
111 //============== internal geometry ==============//
112 
113 TQRect KMdiChildView::internalGeometry() const
114 {
115  if ( mdiParent() )
116  { // is attached
117  // get the client area coordinates inside the MDI child frame
118  TQRect posInFrame = geometry();
119  // map these values to the parent of the MDI child frame
120  // (this usually is the MDI child area) and return
121  TQPoint ptTopLeft = mdiParent() ->mapToParent( posInFrame.topLeft() );
122  TQSize sz = size();
123  return TQRect( ptTopLeft, sz );
124  }
125  else
126  {
127  TQRect geo = geometry();
128  TQRect frameGeo = externalGeometry();
129  return TQRect( frameGeo.x(), frameGeo.y(), geo.width(), geo.height() );
130  // return geometry();
131  }
132 }
133 
134 //============== set internal geometry ==============//
135 
136 void KMdiChildView::setInternalGeometry( const TQRect& newGeometry )
137 {
138  if ( mdiParent() )
139  { // is attached
140  // retrieve the frame size
141  TQRect geo = internalGeometry();
142  TQRect frameGeo = externalGeometry();
143  int nFrameSizeTop = geo.y() - frameGeo.y();
144  int nFrameSizeLeft = geo.x() - frameGeo.x();
145 
146  // create the new geometry that is accepted by the TQWidget::setGeometry() method
147  TQRect newGeoQt;
148  newGeoQt.setX( newGeometry.x() - nFrameSizeLeft );
149  newGeoQt.setY( newGeometry.y() - nFrameSizeTop );
150 
151  newGeoQt.setWidth( newGeometry.width() + nFrameSizeLeft + KMDI_CHILDFRM_DOUBLE_BORDER / 2 );
152  newGeoQt.setHeight( newGeometry.height() + nFrameSizeTop + KMDI_CHILDFRM_DOUBLE_BORDER / 2 );
153  // newGeoQt.setWidth(newGeometry.width()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER);
154  // newGeoQt.setHeight(newGeometry.height()+mdiParent()->captionHeight()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER);
155 
156  // set the geometry
157  mdiParent()->setGeometry( newGeoQt );
158  }
159  else
160  {
161  // retrieve the frame size
162  TQRect geo = internalGeometry();
163  TQRect frameGeo = externalGeometry();
164  int nFrameSizeTop = geo.y() - frameGeo.y();
165  int nFrameSizeLeft = geo.x() - frameGeo.x();
166 
167  // create the new geometry that is accepted by the TQWidget::setGeometry() method
168  TQRect newGeoQt;
169 
170  newGeoQt.setX( newGeometry.x() - nFrameSizeLeft );
171  newGeoQt.setY( newGeometry.y() - nFrameSizeTop );
172 
173  newGeoQt.setWidth( newGeometry.width() );
174  newGeoQt.setHeight( newGeometry.height() );
175 
176  // set the geometry
177  setGeometry( newGeoQt );
178  }
179 }
180 
181 //============== external geometry ==============//
182 
183 TQRect KMdiChildView::externalGeometry() const
184 {
185  return mdiParent() ? mdiParent()->frameGeometry() : frameGeometry();
186 }
187 
188 //============== set external geometry ==============//
189 
190 void KMdiChildView::setExternalGeometry( const TQRect& newGeometry )
191 {
192  if ( mdiParent() )
193  { // is attached
194  mdiParent() ->setGeometry( newGeometry );
195  }
196  else
197  {
198  // retrieve the frame size
199  TQRect geo = internalGeometry();
200  TQRect frameGeo = externalGeometry();
201  int nTotalFrameWidth = frameGeo.width() - geo.width();
202  int nTotalFrameHeight = frameGeo.height() - geo.height();
203  int nFrameSizeTop = geo.y() - frameGeo.y();
204  int nFrameSizeLeft = geo.x() - frameGeo.x();
205 
206  // create the new geometry that is accepted by the TQWidget::setGeometry() method
207  // not attached => the window system makes the frame
208  TQRect newGeoQt;
209  newGeoQt.setX( newGeometry.x() + nFrameSizeLeft );
210  newGeoQt.setY( newGeometry.y() + nFrameSizeTop );
211  newGeoQt.setWidth( newGeometry.width() - nTotalFrameWidth );
212  newGeoQt.setHeight( newGeometry.height() - nTotalFrameHeight );
213 
214  // set the geometry
215  setGeometry( newGeoQt );
216  }
217 }
218 
219 //============== minimize ==============//
220 
221 void KMdiChildView::minimize( bool bAnimate )
222 {
223  if ( mdiParent() )
224  {
225  if ( !isMinimized() )
226  {
227  mdiParent() ->setState( KMdiChildFrm::Minimized, bAnimate );
228  }
229  }
230  else
231  showMinimized();
232 }
233 
234 void KMdiChildView::showMinimized()
235 {
236  emit isMinimizedNow();
237  TQWidget::showMinimized();
238 }
239 
240 //slot:
241 void KMdiChildView::minimize()
242 {
243  minimize( true );
244 }
245 
246 //============= maximize ==============//
247 
248 void KMdiChildView::maximize( bool bAnimate )
249 {
250  if ( mdiParent() )
251  {
252  if ( !isMaximized() )
253  {
254  mdiParent() ->setState( KMdiChildFrm::Maximized, bAnimate );
255  emit mdiParentNowMaximized( true );
256  }
257  }
258  else
259  showMaximized();
260 }
261 
262 void KMdiChildView::showMaximized()
263 {
264  emit isMaximizedNow();
265  TQWidget::showMaximized();
266 }
267 
268 //slot:
269 void KMdiChildView::maximize()
270 {
271  maximize( true );
272 }
273 
274 //============== restoreGeometry ================//
275 
276 TQRect KMdiChildView::restoreGeometry()
277 {
278  if ( mdiParent() )
279  return mdiParent() ->restoreGeometry();
280  else //FIXME not really supported, may be we must use Windows or X11 funtions
281  return geometry();
282 }
283 
284 //============== setRestoreGeometry ================//
285 
286 void KMdiChildView::setRestoreGeometry( const TQRect& newRestGeo )
287 {
288  if ( mdiParent() )
289  mdiParent()->setRestoreGeometry( newRestGeo );
290 }
291 
292 //============== attach ================//
293 
294 void KMdiChildView::attach()
295 {
296  emit attachWindow( this, true );
297 }
298 
299 //============== detach =================//
300 
301 void KMdiChildView::detach()
302 {
303  emit detachWindow( this, true );
304 }
305 
306 //=============== isMinimized ? =================//
307 
308 bool KMdiChildView::isMinimized() const
309 {
310  if ( mdiParent() )
311  return ( mdiParent()->state() == KMdiChildFrm::Minimized );
312  else
313  return TQWidget::isMinimized();
314 }
315 
316 //============== isMaximized ? ==================//
317 
318 bool KMdiChildView::isMaximized() const
319 {
320  if ( mdiParent() )
321  return ( mdiParent()->state() == KMdiChildFrm::Maximized );
322  else
323  return TQWidget::isMaximized();
324 }
325 
326 //============== restore ================//
327 
328 void KMdiChildView::restore()
329 {
330  if ( mdiParent() )
331  {
332  if ( isMaximized() )
333  emit mdiParentNowMaximized( false );
334 
335  if ( isMinimized() || isMaximized() )
336  mdiParent()->setState( KMdiChildFrm::Normal );
337  }
338  else
339  showNormal();
340 }
341 
342 void KMdiChildView::showNormal()
343 {
344  emit isRestoredNow();
345  TQWidget::showNormal();
346 }
347 
348 //=============== youAreAttached ============//
349 
350 void KMdiChildView::youAreAttached( KMdiChildFrm *lpC )
351 {
352  lpC->setCaption( m_szCaption );
353  emit isAttachedNow();
354 }
355 
356 //================ youAreDetached =============//
357 
358 void KMdiChildView::youAreDetached()
359 {
360  setCaption( m_szCaption );
361 
362  setTabCaption( m_sTabCaption );
363  if ( myIconPtr() )
364  setIcon( *( myIconPtr() ) );
365 
366  setFocusPolicy( TQWidget::StrongFocus );
367 
368  emit isDetachedNow();
369 }
370 
371 //================ setCaption ================//
372 // this set the caption of only the window
373 void KMdiChildView::setCaption( const TQString& szCaption )
374 {
375  // this will work only for window
376  m_szCaption = szCaption;
377  if ( mdiParent() )
378  mdiParent() ->setCaption( m_szCaption );
379  else //have to call the parent one
380  TQWidget::setCaption( m_szCaption );
381 
382  emit windowCaptionChanged( m_szCaption );
383 }
384 
385 //============== closeEvent ================//
386 
387 void KMdiChildView::closeEvent( TQCloseEvent *e )
388 {
389  e->ignore(); //we ignore the event , and then close later if needed.
390  emit childWindowCloseRequest( this );
391 }
392 
393 //================ myIconPtr =================//
394 
395 TQPixmap* KMdiChildView::myIconPtr()
396 {
397  return 0;
398 }
399 
400 //============= focusInEvent ===============//
401 
402 void KMdiChildView::focusInEvent( TQFocusEvent *e )
403 {
404  TQWidget::focusInEvent( e );
405 
406  // every widget get a focusInEvent when a popup menu is opened!?! -> maybe bug of QT
407  if ( e && ( ( e->reason() ) == TQFocusEvent::Popup ) )
408  return ;
409 
410 
411  m_bFocusInEventIsPending = true;
412  activate();
413  m_bFocusInEventIsPending = false;
414 
415  emit gotFocus( this );
416 }
417 
418 //============= activate ===============//
419 
420 void KMdiChildView::activate()
421 {
422  // avoid circularity
423  static bool s_bActivateIsPending = false;
424  if ( s_bActivateIsPending )
425  return ;
426 
427  s_bActivateIsPending = true;
428 
429  // raise the view and push the taskbar button
430  if ( !m_bMainframesActivateViewIsPending )
431  emit focusInEventOccurs( this );
432 
433  // if this method was called directly, check if the mainframe wants that we interrupt
434  if ( m_bInterruptActivation )
435  m_bInterruptActivation = false;
436  else
437  {
438  if ( !m_bFocusInEventIsPending )
439  setFocus();
440 
441  kdDebug( 760 ) << k_funcinfo << endl;
442  emit activated( this );
443  }
444 
445  if ( m_focusedChildWidget != 0L )
446  m_focusedChildWidget->setFocus();
447  else
448  {
449  if ( m_firstFocusableChildWidget != 0L )
450  {
451  m_firstFocusableChildWidget->setFocus();
452  m_focusedChildWidget = m_firstFocusableChildWidget;
453  }
454  }
455  s_bActivateIsPending = false;
456 }
457 
458 //============= focusOutEvent ===============//
459 
460 void KMdiChildView::focusOutEvent( TQFocusEvent* e )
461 {
462  TQWidget::focusOutEvent( e );
463  emit lostFocus( this );
464 }
465 
466 //============= resizeEvent ===============//
467 
468 void KMdiChildView::resizeEvent( TQResizeEvent* e )
469 {
470  TQWidget::resizeEvent( e );
471 
472  if ( m_stateChanged )
473  {
474  m_stateChanged = false;
475  if ( isMaximized() )
476  { //maximized
477  emit isMaximizedNow();
478  }
479  else if ( isMinimized() )
480  { //minimized
481  emit isMinimizedNow();
482  }
483  else
484  { //is restored
485  emit isRestoredNow();
486  }
487  }
488 }
489 
490 void KMdiChildView::slot_childDestroyed()
491 {
492  // do what we do if a child is removed
493 
494  // if we lost a child we uninstall ourself as event filter for the lost
495  // child and its children
496  const TQObject * pLostChild = sender();
497  if ( pLostChild && ( pLostChild->isWidgetType() ) )
498  {
499  TQObjectList* list = ( ( TQObject* ) ( pLostChild ) ) ->queryList( "TQWidget" );
500  list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code
501  TQObjectListIt it( *list ); // iterate over all lost child widgets
502  TQObject* obj;
503  while ( ( obj = it.current() ) != 0 )
504  { // for each found object...
505  TQWidget * widg = ( TQWidget* ) obj;
506  ++it;
507  widg->removeEventFilter( this );
508  if ( m_firstFocusableChildWidget == widg )
509  m_firstFocusableChildWidget = 0L; // reset first widget
510 
511  if ( m_lastFocusableChildWidget == widg )
512  m_lastFocusableChildWidget = 0L; // reset last widget
513 
514  if ( m_focusedChildWidget == widg )
515  m_focusedChildWidget = 0L; // reset focused widget
516  }
517  delete list; // delete the list, not the objects
518  }
519 }
520 
521 //============= eventFilter ===============//
522 bool KMdiChildView::eventFilter( TQObject *obj, TQEvent *e )
523 {
524  if ( e->type() == TQEvent::KeyPress && isAttached() )
525  {
526  TQKeyEvent* ke = ( TQKeyEvent* ) e;
527  if ( ke->key() == TQt::Key_Tab )
528  {
529  TQWidget* w = ( TQWidget* ) obj;
530  TQWidget::FocusPolicy wfp = w->focusPolicy();
531  if ( wfp == TQWidget::StrongFocus || wfp == TQWidget::TabFocus || w->focusPolicy() == TQWidget::WheelFocus )
532  {
533  if ( m_lastFocusableChildWidget != 0 )
534  {
535  if ( w == m_lastFocusableChildWidget )
536  {
537  if ( w != m_firstFocusableChildWidget )
538  m_firstFocusableChildWidget->setFocus();
539  }
540  }
541  }
542  }
543  }
544  else if ( e->type() == TQEvent::FocusIn )
545  {
546  if ( obj->isWidgetType() )
547  {
548  TQObjectList * list = queryList( "TQWidget" );
549  if ( list->find( obj ) != -1 )
550  m_focusedChildWidget = ( TQWidget* ) obj;
551 
552  delete list; // delete the list, not the objects
553  }
554  if ( !isAttached() )
555  { // is toplevel, for attached views activation is done by main frame event filter
556  static bool m_bActivationIsPending = false;
557  if ( !m_bActivationIsPending )
558  {
559  m_bActivationIsPending = true;
560  activate(); // sets the focus
561  m_bActivationIsPending = false;
562  }
563  }
564  }
565  else if ( e->type() == TQEvent::ChildRemoved )
566  {
567  // if we lost a child we uninstall ourself as event filter for the lost
568  // child and its children
569  TQObject * pLostChild = ( ( TQChildEvent* ) e ) ->child();
570  if ( ( pLostChild != 0L ) && ( pLostChild->isWidgetType() ) )
571  {
572  TQObjectList * list = pLostChild->queryList( "TQWidget" );
573  list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code
574  TQObjectListIt it( *list ); // iterate over all lost child widgets
575  TQObject * o;
576  while ( ( o = it.current() ) != 0 )
577  { // for each found object...
578  TQWidget * widg = ( TQWidget* ) o;
579  ++it;
580  widg->removeEventFilter( this );
581  TQWidget::FocusPolicy wfp = widg->focusPolicy();
582  if ( wfp == TQWidget::StrongFocus || wfp == TQWidget::TabFocus || widg->focusPolicy() == TQWidget::WheelFocus )
583  {
584  if ( m_firstFocusableChildWidget == widg )
585  m_firstFocusableChildWidget = 0L; // reset first widget
586 
587  if ( m_lastFocusableChildWidget == widg )
588  m_lastFocusableChildWidget = 0L; // reset last widget
589  }
590  }
591  delete list; // delete the list, not the objects
592  }
593  }
594  else if ( e->type() == TQEvent::ChildInserted )
595  {
596  // if we got a new child and we are attached to the MDI system we
597  // install ourself as event filter for the new child and its children
598  // (as we did when we were added to the MDI system).
599  TQObject * pNewChild = ( ( TQChildEvent* ) e ) ->child();
600  if ( ( pNewChild != 0L ) && ( pNewChild->isWidgetType() ) )
601  {
602  TQWidget * pNewWidget = ( TQWidget* ) pNewChild;
603  if ( pNewWidget->testWFlags( (WFlags)(WType_Dialog | WShowModal) ) )
604  return false;
605  TQObjectList *list = pNewWidget->queryList( "TQWidget" );
606  list->insert( 0, pNewChild ); // add the new child to the list too, just to save code
607  TQObjectListIt it( *list ); // iterate over all new child widgets
608  TQObject * o;
609  while ( ( o = it.current() ) != 0 )
610  { // for each found object...
611  TQWidget * widg = ( TQWidget* ) o;
612  ++it;
613  widg->installEventFilter( this );
614  connect( widg, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( slot_childDestroyed() ) );
615  TQWidget::FocusPolicy wfp = widg->focusPolicy();
616  if ( wfp == TQWidget::StrongFocus || wfp == TQWidget::TabFocus || widg->focusPolicy() == TQWidget::WheelFocus )
617  {
618  if ( m_firstFocusableChildWidget == 0 )
619  m_firstFocusableChildWidget = widg; // first widge
620 
621  m_lastFocusableChildWidget = widg; // last widget
622  }
623  }
624  delete list; // delete the list, not the objects
625  }
626  }
627  else
628  {
629  if ( e->type() == TQEvent::IconChange )
630  {
631  // tqDebug("KMDiChildView:: TQEvent:IconChange intercepted\n");
632  if ( obj == this )
633  iconUpdated( this, icon() ? ( *icon() ) : TQPixmap() );
634  else if ( obj == m_trackChanges )
635  setIcon( m_trackChanges->icon() ? ( *( m_trackChanges->icon() ) ) : TQPixmap() );
636  }
637  if ( e->type() == TQEvent::CaptionChange )
638  {
639  if ( obj == this )
640  captionUpdated( this, caption() );
641  }
642  }
643 
644  return false; // standard event processing
645 }
646 
648 void KMdiChildView::removeEventFilterForAllChildren()
649 {
650  TQObjectList* list = queryList( "TQWidget" );
651  TQObjectListIt it( *list ); // iterate over all child widgets
652  TQObject* obj;
653  while ( ( obj = it.current() ) != 0 )
654  { // for each found object...
655  TQWidget* widg = ( TQWidget* ) obj;
656  ++it;
657  widg->removeEventFilter( this );
658  }
659  delete list; // delete the list, not the objects
660 }
661 
662 TQWidget* KMdiChildView::focusedChildWidget()
663 {
664  return m_focusedChildWidget;
665 }
666 
667 void KMdiChildView::setFirstFocusableChildWidget( TQWidget* firstFocusableChildWidget )
668 {
669  m_firstFocusableChildWidget = firstFocusableChildWidget;
670 }
671 
672 void KMdiChildView::setLastFocusableChildWidget( TQWidget* lastFocusableChildWidget )
673 {
674  m_lastFocusableChildWidget = lastFocusableChildWidget;
675 }
676 
678 void KMdiChildView::setTabCaption ( const TQString& stbCaption )
679 {
680  m_sTabCaption = stbCaption;
681  emit tabCaptionChanged( m_sTabCaption );
682 }
683 
684 void KMdiChildView::setMDICaption ( const TQString& caption )
685 {
686  setCaption( caption );
687  setTabCaption( caption );
688 }
689 
691 void KMdiChildView::setWindowMenuID( int id )
692 {
693  m_windowMenuID = id;
694 }
695 
696 //============= slot_clickedInWindowMenu ===============//
697 
699 void KMdiChildView::slot_clickedInWindowMenu()
700 {
701  updateTimeStamp();
702  emit clickedInWindowMenu( m_windowMenuID );
703 }
704 
705 //============= slot_clickedInDockMenu ===============//
706 
708 void KMdiChildView::slot_clickedInDockMenu()
709 {
710  emit clickedInDockMenu( m_windowMenuID );
711 }
712 
713 //============= setMinimumSize ===============//
714 
715 void KMdiChildView::setMinimumSize( int minw, int minh )
716 {
717  TQWidget::setMinimumSize( minw, minh );
718  if ( mdiParent() && mdiParent()->state() != KMdiChildFrm::Minimized )
719  {
720  mdiParent() ->setMinimumSize( minw + KMDI_CHILDFRM_DOUBLE_BORDER,
721  minh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent() ->captionHeight() );
722  }
723 }
724 
725 //============= setMaximumSize ===============//
726 
727 void KMdiChildView::setMaximumSize( int maxw, int maxh )
728 {
729  if ( mdiParent() && mdiParent()->state() == KMdiChildFrm::Normal )
730  {
731  int w = maxw + KMDI_CHILDFRM_DOUBLE_BORDER;
732  if ( w > TQWIDGETSIZE_MAX )
733  w = TQWIDGETSIZE_MAX;
734 
735  int h = maxh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent() ->captionHeight();
736  if ( h > TQWIDGETSIZE_MAX )
737  h = TQWIDGETSIZE_MAX;
738 
739  mdiParent()->setMaximumSize( w, h );
740  }
741  TQWidget::setMaximumSize( maxw, maxh );
742 }
743 
744 //============= show ===============//
745 
746 void KMdiChildView::show()
747 {
748  if ( mdiParent() )
749  mdiParent()->show();
750 
751  TQWidget::show();
752 }
753 
754 //============= hide ===============//
755 
756 void KMdiChildView::hide()
757 {
758  if ( mdiParent() )
759  mdiParent()->hide();
760 
761  TQWidget::hide();
762 }
763 
764 //============= raise ===============//
765 
766 void KMdiChildView::raise()
767 {
768  if ( mdiParent() ) //TODO Check Z-order
769  mdiParent()->raise();
770 
771  TQWidget::raise();
772 }
KMdiChildFrm
Internal class.
Definition: tdemdichildfrm.h:131
KMdiChildFrm::setState
void setState(MdiWindowState state, bool bAnimate=true)
Minimizes, Maximizes, or restores the window.
Definition: tdemdichildfrm.cpp:511
KMdiChildFrm::setRestoreGeometry
void setRestoreGeometry(const TQRect &newRestGeo)
Sets the geometry that will be restored by calling restore().
Definition: tdemdichildfrm.cpp:680
KMdiChildFrm::setMinimumSize
virtual void setMinimumSize(int minw, int minh)
Sets the minimum size of the widget to w by h pixels.
Definition: tdemdichildfrm.cpp:1217
KMdiChildFrm::restoreGeometry
TQRect restoreGeometry() const
Returns the geometry that will be restored by calling restore().
Definition: tdemdichildfrm.cpp:673
KMdiChildFrm::captionHeight
int captionHeight() const
Returns the caption bar height.
Definition: tdemdichildfrm.h:271
KMdiChildFrm::setCaption
void setCaption(const TQString &text)
Sets the caption of this window.
Definition: tdemdichildfrm.cpp:687
KMdiChildView::isMinimized
bool isMinimized() const
Tells if the window is minimized when attached to the Mdi manager, or if it is VISIBLE when 'floating...
Definition: tdemdichildview.cpp:308
KMdiChildView::youAreAttached
virtual void youAreAttached(KMdiChildFrm *lpC)
Internally called, if KMdiMainFrm::attach is called.
Definition: tdemdichildview.cpp:350
KMdiChildView::gotFocus
void gotFocus(KMdiChildView *)
Is sent when this MDI child has received the focus (after actually changing the focus).
KMdiChildView::m_szCaption
TQString m_szCaption
See KMdiChildView::caption.
Definition: tdemdichildview.h:119
KMdiChildView::eventFilter
virtual bool eventFilter(TQObject *obj, TQEvent *e)
It only catches TQEvent::KeyPress events there.
Definition: tdemdichildview.cpp:522
KMdiChildView::removeEventFilterForAllChildren
void removeEventFilterForAllChildren()
Switches interposing in event loop of all current child widgets off.
Definition: tdemdichildview.cpp:648
KMdiChildView::m_lastFocusableChildWidget
TQWidget * m_lastFocusableChildWidget
See KMdiChildView::setLastFocusableChildWidget.
Definition: tdemdichildview.h:139
KMdiChildView::attachWindow
void attachWindow(KMdiChildView *, bool)
Internally used by KMdiChildView::attach to send it as command to the mainframe.
KMdiChildView::lostFocus
void lostFocus(KMdiChildView *)
Is sent when this MDI child view has lost the focus (after actually changing the focus).
KMdiChildView::detach
virtual void detach()
Detaches this window from the Mdi manager.
Definition: tdemdichildview.cpp:301
KMdiChildView::focusInEvent
virtual void focusInEvent(TQFocusEvent *e)
If attached, the childframe will be activated and the MDI taskbar button will be pressed.
Definition: tdemdichildview.cpp:402
KMdiChildView::showMinimized
virtual void showMinimized()
Overridden from its base class method.
Definition: tdemdichildview.cpp:234
KMdiChildView::mdiParentNowMaximized
void mdiParentNowMaximized(bool)
Internally used to send information to the mainframe that this MDI view is maximized now.
KMdiChildView::youAreDetached
virtual void youAreDetached()
Internally called, if KMdiMainFrm::detach is called.
Definition: tdemdichildview.cpp:358
KMdiChildView::mdiParent
KMdiChildFrm * mdiParent() const
Returns the KMdiChildFrm parent widget (or 0 if the window is not attached)
Definition: tdemdichildview.h:604
KMdiChildView::focusOutEvent
virtual void focusOutEvent(TQFocusEvent *e)
Send the lostFocus signal.
Definition: tdemdichildview.cpp:460
KMdiChildView::isMaximized
bool isMaximized() const
Tells if the window is minimized when attached to the Mdi manager, otherwise returns false.
Definition: tdemdichildview.cpp:318
KMdiChildView::myIconPtr
virtual TQPixmap * myIconPtr()
You should override this function in the derived class.
Definition: tdemdichildview.cpp:395
KMdiChildView::restore
virtual void restore()
Restores this window to its normal size.
Definition: tdemdichildview.cpp:328
KMdiChildView::activate
void activate()
This method does the same as focusInEvent().
Definition: tdemdichildview.cpp:420
KMdiChildView::isDetachedNow
void isDetachedNow()
Signals this has been detached.
KMdiChildView::resizeEvent
virtual void resizeEvent(TQResizeEvent *e)
Internally used for the minimize/maximize/restore mechanism when in attach mode.
Definition: tdemdichildview.cpp:468
KMdiChildView::setFirstFocusableChildWidget
void setFirstFocusableChildWidget(TQWidget *)
Memorizes the first focusable child widget of this widget.
Definition: tdemdichildview.cpp:667
KMdiChildView::clickedInWindowMenu
void clickedInWindowMenu(int)
Is automatically emitted when slot_clickedInWindowMenu is called.
KMdiChildView::activated
void activated(KMdiChildView *)
Is sent when this MDI child was set to the activate view of all MDI views (after actually changing th...
KMdiChildView::KMdiChildView
KMdiChildView(const TQString &caption, TQWidget *parentWidget=0L, const char *name=0L, WFlags f=0)
Constructor.
Definition: tdemdichildview.cpp:47
KMdiChildView::slot_clickedInDockMenu
virtual void slot_clickedInDockMenu()
Called if someone click on the "Dock/Undock..." menu item for this child frame window.
Definition: tdemdichildview.cpp:708
KMdiChildView::m_stateChanged
bool m_stateChanged
Holds a temporary information about if the MDI view state has changed but is not processed yet (pendi...
Definition: tdemdichildview.h:150
KMdiChildView::closeEvent
virtual void closeEvent(TQCloseEvent *e)
Ignores the event and calls KMdiMainFrm::childWindowCloseRequest instead.
Definition: tdemdichildview.cpp:387
KMdiChildView::externalGeometry
TQRect externalGeometry() const
Returns the frame geometry of this window or of the parent if there is any...
Definition: tdemdichildview.cpp:183
KMdiChildView::setCaption
virtual void setCaption(const TQString &szCaption)
Sets the window caption string...
Definition: tdemdichildview.cpp:373
KMdiChildView::setExternalGeometry
void setExternalGeometry(const TQRect &newGeomety)
Sets the geometry of the frame of this MDI child window.
Definition: tdemdichildview.cpp:190
KMdiChildView::raise
virtual void raise()
Calls TQWidget::raise() or it's parent widget raise() if attached.
Definition: tdemdichildview.cpp:766
KMdiChildView::focusedChildWidget
TQWidget * focusedChildWidget()
Returns the current focused child widget of this widget.
Definition: tdemdichildview.cpp:662
KMdiChildView::m_windowMenuID
int m_windowMenuID
Every child view window has an temporary ID in the Window menu of the main frame.
Definition: tdemdichildview.h:144
KMdiChildView::caption
const TQString & caption() const
Returns the caption of the child window (different from the caption on the button in the taskbar)
Definition: tdemdichildview.h:232
KMdiChildView::isAttachedNow
void isAttachedNow()
Signals this has been attached.
KMdiChildView::minimize
virtual void minimize()
Mimimizes the MDI view.
Definition: tdemdichildview.cpp:241
KMdiChildView::m_sTabCaption
TQString m_sTabCaption
See KMdiChildView::tabCaption.
Definition: tdemdichildview.h:124
KMdiChildView::setRestoreGeometry
void setRestoreGeometry(const TQRect &newRestGeo)
Sets the geometry that will be restored by calling restore().
Definition: tdemdichildview.cpp:286
KMdiChildView::isAttached
bool isAttached() const
Returns true if the MDI view is a child window within the MDI mainframe widget or false if the MDI vi...
Definition: tdemdichildview.h:227
KMdiChildView::showMaximized
virtual void showMaximized()
Overridden from its base class method.
Definition: tdemdichildview.cpp:262
KMdiChildView::setWindowMenuID
void setWindowMenuID(int id)
Internally used for setting an ID for the 'Window' menu entry.
Definition: tdemdichildview.cpp:691
KMdiChildView::m_firstFocusableChildWidget
TQWidget * m_firstFocusableChildWidget
See KMdiChildView::setFirstFocusableChildWidget.
Definition: tdemdichildview.h:134
KMdiChildView::setInternalGeometry
void setInternalGeometry(const TQRect &newGeomety)
Sets the geometry of the client area of this MDI child window.
Definition: tdemdichildview.cpp:136
KMdiChildView::windowCaptionChanged
void windowCaptionChanged(const TQString &)
Emitted when the window caption is changed via KMdiChildView::setCaption or KMdiChildView::setMDICapt...
KMdiChildView::isMaximizedNow
void isMaximizedNow()
Signals this has been maximized.
KMdiChildView::detachWindow
void detachWindow(KMdiChildView *, bool)
Internally used by KMdiChildView::detach to send it as command to the mainframe.
KMdiChildView::internalGeometry
TQRect internalGeometry() const
Returns the geometry of this MDI child window as TQWidget::geometry() does.
Definition: tdemdichildview.cpp:113
KMdiChildView::childWindowCloseRequest
void childWindowCloseRequest(KMdiChildView *)
Internally used to send information to the mainframe that this MDI child view wants to be closed.
KMdiChildView::show
virtual void show()
Calls TQWidget::show but also for it's parent widget if attached.
Definition: tdemdichildview.cpp:746
KMdiChildView::setTabCaption
virtual void setTabCaption(const TQString &caption)
Sets the caption of the button referring to this window.
Definition: tdemdichildview.cpp:678
KMdiChildView::clickedInDockMenu
void clickedInDockMenu(int)
Is automatically emitted when slot_clickedInDockMenu is called.
KMdiChildView::setLastFocusableChildWidget
void setLastFocusableChildWidget(TQWidget *)
Memorizes the last focusable child widget of this widget.
Definition: tdemdichildview.cpp:672
KMdiChildView::isMinimizedNow
void isMinimizedNow()
Signals this has been minimized.
KMdiChildView::maximize
virtual void maximize()
Maximizes the MDI view.
Definition: tdemdichildview.cpp:269
KMdiChildView::slot_clickedInWindowMenu
virtual void slot_clickedInWindowMenu()
Called if someone click on the "Window" menu item for this child frame window.
Definition: tdemdichildview.cpp:699
KMdiChildView::restoreGeometry
TQRect restoreGeometry()
Returns the geometry that will be restored by calling restore().
Definition: tdemdichildview.cpp:276
KMdiChildView::isRestoredNow
void isRestoredNow()
Signals this has been restored (normalized)
KMdiChildView::tabCaptionChanged
void tabCaptionChanged(const TQString &)
Emitted when the window caption is changed via KMdiChildView::setTabCaption or KMdiChildView::setMDIC...
KMdiChildView::~KMdiChildView
~KMdiChildView()
Destructor.
Definition: tdemdichildview.cpp:100
KMdiChildView::setMinimumSize
virtual void setMinimumSize(int minw, int minh)
Sets the minimum size of the widget to w by h pixels.
Definition: tdemdichildview.cpp:715
KMdiChildView::focusInEventOccurs
void focusInEventOccurs(KMdiChildView *)
Is sent when this MDI child view is going to receive focus (before actually changing the focus).
KMdiChildView::showNormal
virtual void showNormal()
Overridden from its base class method.
Definition: tdemdichildview.cpp:342
KMdiChildView::m_focusedChildWidget
TQWidget * m_focusedChildWidget
See KMdiChildView::focusedChildWidget.
Definition: tdemdichildview.h:129
KMdiChildView::updateTimeStamp
void updateTimeStamp()
Remember the current time.
Definition: tdemdichildview.h:359
KMdiChildView::hide
virtual void hide()
Calls TQWidget::hide() or it's parent widget hide() if attached.
Definition: tdemdichildview.cpp:756
KMdiChildView::attach
virtual void attach()
Attaches this window to the Mdi manager.
Definition: tdemdichildview.cpp:294
KMdiChildView::setMaximumSize
virtual void setMaximumSize(int maxw, int maxh)
Sets the maximum size of the widget to w by h pixels.
Definition: tdemdichildview.cpp:727
KMdiChildView::setMDICaption
virtual void setMDICaption(const TQString &caption)
Sets the caption of both the window and the button on the taskbar.
Definition: tdemdichildview.cpp:684

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.