# kmdi Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmdichildfrm.h

    00001 //----------------------------------------------------------------------------
    00002 //    filename             : kmdichildfrm.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              : */2000        Lars Beikirch (Lars.Beikirch@gmx.net)
    00013 //
    00014 //    copyright            : (C) 1999-2003 by Falk Brettschneider
    00015 //                                         and
    00016 //                                         Szymon Stefanek (stefanek@tin.it)
    00017 //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
    00018 //----------------------------------------------------------------------------
    00019 //
    00020 //----------------------------------------------------------------------------
    00021 //
    00022 //    This program is free software; you can redistribute it and/or modify
    00023 //    it under the terms of the GNU Library General Public License as
    00024 //    published by the Free Software Foundation; either version 2 of the
    00025 //    License, or (at your option) any later version.
    00026 //
    00027 //------------------------------------------------------------------------------
    00028 #ifndef _KMDI_CHILD_FRM_H_
    00029 #define _KMDI_CHILD_FRM_H_
    00030
    00031 #include <qptrlist.h>
    00032 #include <qpixmap.h>
    00033 #include <qpushbutton.h>
    00034 #include <qlabel.h>
    00035 #include <qdatetime.h>
    00036 #include <qlayout.h>
    00037
    00038 #include <qdict.h>
    00039
    00040 #include "kmdichildfrmcaption.h"
    00041
    00042 class KMdiChildArea;
    00043 class KMdiChildView;
    00044 class QPopupMenu;
    00045 class QToolButton;
    00046
    00047 //==============================================================================
    00052 class KMDI_EXPORT KMdiWin32IconButton : public QLabel
    00053 {
    00054     Q_OBJECT
    00055 public:
    00056     KMdiWin32IconButton( QWidget* parent, const char* name = 0 );
    00057     virtual void mousePressEvent( QMouseEvent* );
    00058
    00059 signals:
    00060     void pressed();
    00061 };
    00062
    00063 //==============================================================================
    00064 /* some special events, see kmdidefines.h
    00065 */
    00066 //------------------------------------------------------------------------------
    00071 class KMDI_EXPORT KMdiChildFrmMoveEvent : public QCustomEvent
    00072 {
    00073 public:
    00074     KMdiChildFrmMoveEvent( QMoveEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_Move ) ), e ) {}
    00075
    00076 };
    00077
    00078 //------------------------------------------------------------------------------
    00083 class KMDI_EXPORT KMdiChildFrmDragBeginEvent : public QCustomEvent
    00084 {
    00085 public:
    00086     KMdiChildFrmDragBeginEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_DragBegin ) ), e ) {}
    00087 };
    00088
    00089 //------------------------------------------------------------------------------
    00094 class KMDI_EXPORT KMdiChildFrmDragEndEvent : public QCustomEvent
    00095 {
    00096 public:
    00097     KMdiChildFrmDragEndEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_DragEnd ) ), e ) {}
    00098 };
    00099
    00100 //------------------------------------------------------------------------------
    00105 class KMDI_EXPORT KMdiChildFrmResizeBeginEvent : public QCustomEvent
    00106 {
    00107 public:
    00108     KMdiChildFrmResizeBeginEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_ResizeBegin ) ), e ) {}
    00109 };
    00110
    00111 //------------------------------------------------------------------------------
    00116 class KMDI_EXPORT KMdiChildFrmResizeEndEvent : public QCustomEvent
    00117 {
    00118 public:
    00119     KMdiChildFrmResizeEndEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_ResizeEnd ) ), e ) {}
    00120 };
    00121
    00122
    00123 class KMdiChildFrmPrivate;
    00124 //==============================================================================
    00129 //------------------------------------------------------------------------------
    00130 class KMDI_EXPORT KMdiChildFrm : public QFrame
    00131 {
    00132     friend class KMdiChildArea;
    00133     friend class KMdiChildFrmCaption;
    00134
    00135     Q_OBJECT
    00136
    00137     // attributes
    00138 public:
    00139     enum MdiWindowState { Normal, Maximized, Minimized };
    00140     //positions same in h and cpp for fast order check
    00141     KMdiChildView* m_pClient;
    00142
    00143 protected:
    00144     KMdiChildArea* m_pManager;
    00145     KMdiChildFrmCaption* m_pCaption;
    00146     KMdiWin32IconButton* m_pWinIcon;
    00147     QToolButton* m_pUnixIcon;
    00148     QToolButton* m_pMinimize;
    00149     QToolButton* m_pMaximize;
    00150     QToolButton* m_pClose;
    00151     QToolButton* m_pUndock;
    00152     MdiWindowState m_state;
    00153     QRect m_restoredRect;
    00154     int m_iResizeCorner;
    00155     int m_iLastCursorCorner;
    00156     bool m_bResizing;
    00157     bool m_bDragging;
    00158     QPixmap* m_pIconButtonPixmap;
    00159     QPixmap* m_pMinButtonPixmap;
    00160     QPixmap* m_pMaxButtonPixmap;
    00161     QPixmap* m_pRestoreButtonPixmap;
    00162     QPixmap* m_pCloseButtonPixmap;
    00163     QPixmap* m_pUndockButtonPixmap;
    00164
    00168     int m_windowMenuID;
    00169
    00173     QPopupMenu* m_pSystemMenu;
    00174
    00175     QSize m_oldClientMinSize;
    00176     QSize m_oldClientMaxSize;
    00177     QLayout::ResizeMode m_oldLayoutResizeMode;
    00178     QTime m_timeMeasure;
    00179
    00180     // methods
    00181 public:
    00182
    00186     KMdiChildFrm( KMdiChildArea *parent );
    00187
    00192     ~KMdiChildFrm();
    00193
    00199     void setClient( KMdiChildView *w, bool bAutomaticResize = false );
    00200
    00205     void unsetClient( QPoint positionOffset = QPoint( 0, 0 ) );
    00206
    00210     void setIcon( const QPixmap &pxm );
    00211
    00215     QPixmap* icon() const;
    00216
    00220     void enableClose( bool bEnable );
    00221
    00225     void setCaption( const QString& text );
    00226
    00230     const QString& caption() { return m_pCaption->m_szCaption; }
    00231
    00235     void setState( MdiWindowState state, bool bAnimate = true );
    00236
    00240     inline MdiWindowState state() const { return m_state; }
    00241
    00245     QRect mdiAreaContentsRect() const;
    00246
    00250     QRect restoreGeometry() const;
    00251
    00255     void setRestoreGeometry( const QRect& newRestGeo );
    00256
    00261     void updateRects() { resizeEvent( 0 ); }
    00262
    00266     QPopupMenu* systemMenu() const;
    00267
    00271     inline int captionHeight() const { return m_pCaption->height(); }
    00272
    00276     void redecorateButtons();
    00277
    00281     bool isInDrag() const { return m_bDragging; }
    00282
    00286     bool isInResize() const { return m_bResizing; }
    00287
    00292     void raiseAndActivate();
    00293
    00299     virtual void setMinimumSize ( int minw, int minh );
    00300
    00301 public slots:
    00302
    00303     void slot_resizeViaSystemMenu();
    00304
    00305 protected:
    00306
    00312     virtual void resizeEvent( QResizeEvent * );
    00313
    00319     virtual void mouseMoveEvent( QMouseEvent *e );
    00320
    00326     virtual void mousePressEvent( QMouseEvent *e );
    00327
    00332     virtual void mouseReleaseEvent( QMouseEvent * );
    00333
    00339     virtual void moveEvent( QMoveEvent* me );
    00340
    00344     virtual void leaveEvent( QEvent * );
    00345
    00352     virtual bool eventFilter( QObject*, QEvent* );
    00353
    00358     void resizeWindow( int resizeCorner, int x, int y );
    00359
    00363     void setResizeCursor( int resizeCorner );
    00364
    00368     void unsetResizeCursor();
    00369
    00374     virtual void switchToMinimizeLayout();
    00375
    00379     void doResize();
    00380
    00385     void doResize( bool captionOnly );
    00386
    00387 protected slots:
    00388
    00392     void maximizePressed();
    00393
    00397     void restorePressed();
    00398
    00402     void minimizePressed();
    00403
    00407     void closePressed();
    00408
    00412     void undockPressed();
    00413
    00417     void showSystemMenu();
    00418
    00419 protected:
    00420
    00425     void linkChildren( QDict<FocusPolicy>* pFocPolDict );
    00426
    00431     QDict<QWidget::FocusPolicy>* unlinkChildren();
    00432
    00438     int getResizeCorner( int ax, int ay );
    00439
    00440 private:
    00441     KMdiChildFrmPrivate *d;
    00442 };
    00443
    00444 #endif //_KMDICHILDFRM_H_
    00445
    00446 // kate: space-indent off; replace-tabs off; tab-width 4; indent-mode csands;

This file is part of the documentation for kmdi Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:32:06 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003