tdemdichildview.h
00001 //---------------------------------------------------------------------------- 00002 // filename : tdemdichildview.h 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 an 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 Falk Brettschneider 00018 // and 00019 // Szymon Stefanek (stefanek@tin.it) 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 #ifndef _TDEMDI_CHILD_VIEW_H_ 00032 #define _TDEMDI_CHILD_VIEW_H_ 00033 00034 #include <tqwidget.h> 00035 #include <tqpixmap.h> 00036 #include <tqrect.h> 00037 #include <tqapplication.h> 00038 #include <tqdatetime.h> 00039 00040 #include "tdemdichildfrm.h" 00041 00042 class KMdiChildViewPrivate; 00043 00108 class KMDI_EXPORT KMdiChildView : public TQWidget 00109 { 00110 friend class KMdiMainFrm; 00111 friend class KMdiChildFrm; 00112 Q_OBJECT 00113 00114 // attributes 00115 protected: 00119 TQString m_szCaption; 00120 00124 TQString m_sTabCaption; 00125 00129 TQWidget* m_focusedChildWidget; 00130 00134 TQWidget* m_firstFocusableChildWidget; 00135 00139 TQWidget* m_lastFocusableChildWidget; 00140 00144 int m_windowMenuID; 00145 00150 bool m_stateChanged; 00151 00155 TQDateTime m_time; 00156 00157 private: 00161 bool m_bToolView; 00162 00168 bool m_bInterruptActivation; 00169 00173 bool m_bMainframesActivateViewIsPending; 00174 00178 bool m_bFocusInEventIsPending; 00179 00180 // methods 00181 public: 00185 KMdiChildView( const TQString& caption, TQWidget* parentWidget = 0L, const char* name = 0L, WFlags f = 0 ); 00186 00191 KMdiChildView( TQWidget* parentWidget = 0L, const char* name = 0L, WFlags f = 0 ); 00192 00196 ~KMdiChildView(); 00197 00206 void activate(); 00207 00211 void setFirstFocusableChildWidget( TQWidget* ); 00212 00216 void setLastFocusableChildWidget( TQWidget* ); 00217 00221 TQWidget* focusedChildWidget(); 00222 00227 bool isAttached() const { return ( mdiParent() != 0L ); } 00228 00232 const TQString& caption() const { return m_szCaption; } 00233 00237 const TQString& tabCaption() const { return m_sTabCaption; } 00238 00243 virtual void setCaption( const TQString& szCaption ); 00244 00248 virtual void setTabCaption( const TQString& caption ); 00249 00253 virtual void setMDICaption( const TQString &caption ); 00254 00258 KMdiChildFrm *mdiParent() const; 00259 00264 bool isMinimized() const; 00265 00270 bool isMaximized() const; 00271 00275 TQRect internalGeometry() const; 00276 00284 void setInternalGeometry( const TQRect& newGeomety ); 00285 00289 TQRect externalGeometry() const; 00290 00298 void setExternalGeometry( const TQRect& newGeomety ); 00299 00303 virtual TQPixmap* myIconPtr(); 00304 00309 virtual void minimize( bool bAnimate ); 00310 00315 virtual void maximize( bool bAnimate ); 00316 00320 TQRect restoreGeometry(); 00321 00325 void setRestoreGeometry( const TQRect& newRestGeo ); 00326 00330 void removeEventFilterForAllChildren(); 00331 00335 void setWindowMenuID( int id ); 00336 00342 virtual void setMinimumSize ( int minw, int minh ); 00343 00349 virtual void setMaximumSize ( int maxw, int maxh ); 00350 00354 inline bool isToolView() const { return m_bToolView; } 00355 00359 inline void updateTimeStamp() 00360 { 00361 m_time.setDate( TQDate::currentDate() ); 00362 m_time.setTime( TQTime::currentTime() ); 00363 } 00364 00368 inline const TQDateTime& getTimeStamp() const { return m_time; } 00369 00370 public slots: 00376 virtual void attach(); 00377 00383 virtual void detach(); 00384 00390 virtual void minimize(); 00391 00397 virtual void maximize(); 00398 00402 virtual void restore(); 00403 00408 virtual void youAreAttached( KMdiChildFrm *lpC ); 00409 00414 virtual void youAreDetached(); 00415 00419 virtual void slot_clickedInWindowMenu(); 00420 00424 virtual void slot_clickedInDockMenu(); 00425 00429 virtual void show(); 00430 00434 virtual void hide(); 00435 00439 virtual void raise(); 00440 00445 virtual void showMinimized(); 00446 00451 virtual void showMaximized(); 00452 00457 virtual void showNormal(); 00458 00459 00460 protected: 00465 virtual void closeEvent( TQCloseEvent *e ); 00466 00473 virtual bool eventFilter( TQObject *obj, TQEvent *e ); 00474 00481 virtual void focusInEvent( TQFocusEvent *e ); 00482 00486 virtual void focusOutEvent( TQFocusEvent *e ); 00487 00491 virtual void resizeEvent( TQResizeEvent *e ); 00492 00493 void trackIconAndCaptionChanges( TQWidget *view ); 00494 00495 protected slots: 00496 void slot_childDestroyed(); 00497 00498 signals: 00502 void attachWindow( KMdiChildView*, bool ); 00503 00507 void detachWindow( KMdiChildView*, bool ); 00508 00514 void focusInEventOccurs( KMdiChildView* ); 00515 00520 void gotFocus( KMdiChildView* ); 00521 00526 void activated( KMdiChildView* ); 00527 00531 void lostFocus( KMdiChildView* ); 00532 00536 void deactivated( KMdiChildView* ); 00537 00542 void childWindowCloseRequest( KMdiChildView* ); 00543 00547 void windowCaptionChanged( const TQString& ); 00548 00552 void tabCaptionChanged( const TQString& ); 00553 00558 void mdiParentNowMaximized( bool ); 00559 00563 void clickedInWindowMenu( int ); 00564 00568 void clickedInDockMenu( int ); 00569 00573 void isMaximizedNow(); 00574 00578 void isMinimizedNow(); 00579 00583 void isRestoredNow(); 00584 00588 void isAttachedNow(); 00589 00593 void isDetachedNow(); 00594 00595 void iconUpdated( TQWidget*, TQPixmap ); 00596 void captionUpdated( TQWidget*, const TQString& ); 00597 00598 00599 private: 00600 KMdiChildViewPrivate *d; 00601 TQWidget *m_trackChanges; 00602 }; 00603 00604 inline KMdiChildFrm *KMdiChildView::mdiParent() const 00605 { 00606 TQWidget * pw = parentWidget(); 00607 if ( pw != 0L ) 00608 if ( pw->inherits( "KMdiChildFrm" ) ) 00609 return ( KMdiChildFrm * ) pw; 00610 return 0L; 00611 } 00612 00613 #endif //_TDEMDI_CHILD_VIEW_H_ 00614 00615 // kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;