Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qwidgetresizehandler_p.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** $Id: qwidgetresizehandler_p.h,v 1.2 2003/07/10 02:40:11 llornkcor Exp $
00003 **
00004 ** Definition of the QWidgetResizeHandler class
00005 **
00006 ** Created : 001010
00007 **
00008 ** Copyright (C) 1992-2002 Trolltech AS.  All rights reserved.
00009 **
00010 ** This file is part of the workspace module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech AS of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00022 ** file in accordance with the Qt Commercial License Agreement provided
00023 ** with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QWIDGETRESIZEHANDLER_P_H
00039 #define QWIDGETRESIZEHANDLER_P_H
00040 
00041 //
00042 //  W A R N I N G
00043 //  -------------
00044 //
00045 // This file is not part of the Qt API.  This header file may
00046 // change from version to version without notice, or even be
00047 // removed.
00048 //
00049 // We mean it.
00050 //
00051 //
00052 
00053 #ifndef QT_H
00054 #include "qobject.h"
00055 #endif // QT_H
00056 #ifndef QT_NO_RESIZEHANDLER
00057 class QMouseEvent;
00058 class QKeyEvent;
00059 
00060 class Q_EXPORT QWidgetResizeHandler : public QObject
00061 {
00062     Q_OBJECT
00063 
00064 public:
00065     QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 );
00066     void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); }
00067     bool isActive() const { return active; }
00068     void setMovingEnabled( bool b ) { moving = b; }
00069     bool isMovingEnabled() const { return moving; }
00070 
00071     bool isButtonDown() const { return buttonDown; }
00072 
00073     void setExtraHeight( int h ) { extrahei = h; }
00074     void setSizeProtection( bool b ) { sizeprotect = b; }
00075 
00076     void doResize();
00077     void doMove();
00078 
00079 signals:
00080     void activate();
00081 
00082 protected:
00083     bool eventFilter( QObject *o, QEvent *e );
00084     void mouseMoveEvent( QMouseEvent *e );
00085     void keyPressEvent( QKeyEvent *e );
00086 
00087 private:
00088     enum MousePosition {
00089         Nowhere,
00090         TopLeft, BottomRight, BottomLeft, TopRight,
00091         Top, Bottom, Left, Right,
00092         Center
00093     };
00094 
00095     QWidget *widget;
00096     QWidget *childWidget;
00097     QPoint moveOffset;
00098     QPoint invertedMoveOffset;
00099     MousePosition mode;
00100     int extrahei;
00101     int range;
00102     uint buttonDown         :1;
00103     uint moveResizeMode     :1;
00104     uint active             :1;
00105     uint sizeprotect        :1;
00106     uint moving             :1; 
00107 
00108     void setMouseCursor( MousePosition m );
00109     bool isMove() const {
00110         return moveResizeMode && mode == Center;
00111     }
00112     bool isResize() const {
00113         return moveResizeMode && !isMove();
00114     }
00115 
00116 private:        // Disabled copy constructor and operator=
00117 #if defined(Q_DISABLE_COPY)
00118     QWidgetResizeHandler( const QWidgetResizeHandler & );
00119     QWidgetResizeHandler& operator=( const QWidgetResizeHandler & );
00120 #endif
00121 
00122 };
00123 
00124 #endif //QT_NO_RESIZEHANDLER
00125 #endif

Generated on Sat Nov 5 16:18:23 2005 for OPIE by  doxygen 1.4.2