Diffstat (limited to 'qmake/include/private/qwidgetresizehandler_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/include/private/qwidgetresizehandler_p.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/qmake/include/private/qwidgetresizehandler_p.h b/qmake/include/private/qwidgetresizehandler_p.h index ca229db..9297832 100644 --- a/qmake/include/private/qwidgetresizehandler_p.h +++ b/qmake/include/private/qwidgetresizehandler_p.h | |||
@@ -1,113 +1,125 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of the QWidgetResizeHandler class | 4 | ** Definition of the QWidgetResizeHandler class |
5 | ** | 5 | ** |
6 | ** Created : 001010 | 6 | ** Created : 001010 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the workspace module of the Qt GUI Toolkit. | 10 | ** This file is part of the workspace module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QWIDGETRESIZEHANDLER_H | 38 | #ifndef QWIDGETRESIZEHANDLER_P_H |
39 | #define QWIDGETRESIZEHANDLER_H | 39 | #define QWIDGETRESIZEHANDLER_P_H |
40 | |||
41 | // | ||
42 | // W A R N I N G | ||
43 | // ------------- | ||
44 | // | ||
45 | // This file is not part of the Qt API. This header file may | ||
46 | // change from version to version without notice, or even be | ||
47 | // removed. | ||
48 | // | ||
49 | // We mean it. | ||
50 | // | ||
51 | // | ||
40 | 52 | ||
41 | #ifndef QT_H | 53 | #ifndef QT_H |
42 | #include "qobject.h" | 54 | #include "qobject.h" |
43 | #endif // QT_H | 55 | #endif // QT_H |
44 | #ifndef QT_NO_RESIZEHANDLER | 56 | #ifndef QT_NO_RESIZEHANDLER |
45 | class QMouseEvent; | 57 | class QMouseEvent; |
46 | class QKeyEvent; | 58 | class QKeyEvent; |
47 | 59 | ||
48 | class Q_EXPORT QWidgetResizeHandler : public QObject | 60 | class Q_EXPORT QWidgetResizeHandler : public QObject |
49 | { | 61 | { |
50 | Q_OBJECT | 62 | Q_OBJECT |
51 | 63 | ||
52 | public: | 64 | public: |
53 | QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 ); | 65 | QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 ); |
54 | void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); } | 66 | void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); } |
55 | bool isActive() const { return active; } | 67 | bool isActive() const { return active; } |
56 | void setMovingEnabled( bool b ) { moving = b; } | 68 | void setMovingEnabled( bool b ) { moving = b; } |
57 | bool isMovingEnabled() const { return moving; } | 69 | bool isMovingEnabled() const { return moving; } |
58 | 70 | ||
59 | bool isButtonDown() const { return buttonDown; } | 71 | bool isButtonDown() const { return buttonDown; } |
60 | 72 | ||
61 | void setExtraHeight( int h ) { extrahei = h; } | 73 | void setExtraHeight( int h ) { extrahei = h; } |
62 | void setSizeProtection( bool b ) { sizeprotect = b; } | 74 | void setSizeProtection( bool b ) { sizeprotect = b; } |
63 | 75 | ||
64 | void doResize(); | 76 | void doResize(); |
65 | void doMove(); | 77 | void doMove(); |
66 | 78 | ||
67 | signals: | 79 | signals: |
68 | void activate(); | 80 | void activate(); |
69 | 81 | ||
70 | protected: | 82 | protected: |
71 | bool eventFilter( QObject *o, QEvent *e ); | 83 | bool eventFilter( QObject *o, QEvent *e ); |
72 | void mouseMoveEvent( QMouseEvent *e ); | 84 | void mouseMoveEvent( QMouseEvent *e ); |
73 | void keyPressEvent( QKeyEvent *e ); | 85 | void keyPressEvent( QKeyEvent *e ); |
74 | 86 | ||
75 | private: | 87 | private: |
76 | enum MousePosition { | 88 | enum MousePosition { |
77 | Nowhere, | 89 | Nowhere, |
78 | TopLeft, BottomRight, BottomLeft, TopRight, | 90 | TopLeft, BottomRight, BottomLeft, TopRight, |
79 | Top, Bottom, Left, Right, | 91 | Top, Bottom, Left, Right, |
80 | Center | 92 | Center |
81 | }; | 93 | }; |
82 | 94 | ||
83 | QWidget *widget; | 95 | QWidget *widget; |
84 | QWidget *childWidget; | 96 | QWidget *childWidget; |
85 | QPoint moveOffset; | 97 | QPoint moveOffset; |
86 | QPoint invertedMoveOffset; | 98 | QPoint invertedMoveOffset; |
87 | MousePosition mode; | 99 | MousePosition mode; |
88 | int extrahei; | 100 | int extrahei; |
89 | int range; | 101 | int range; |
90 | uint buttonDown :1; | 102 | uint buttonDown :1; |
91 | uint moveResizeMode :1; | 103 | uint moveResizeMode :1; |
92 | uint active :1; | 104 | uint active :1; |
93 | uint sizeprotect :1; | 105 | uint sizeprotect :1; |
94 | uint moving :1; | 106 | uint moving :1; |
95 | 107 | ||
96 | void setMouseCursor( MousePosition m ); | 108 | void setMouseCursor( MousePosition m ); |
97 | bool isMove() const { | 109 | bool isMove() const { |
98 | return moveResizeMode && mode == Center; | 110 | return moveResizeMode && mode == Center; |
99 | } | 111 | } |
100 | bool isResize() const { | 112 | bool isResize() const { |
101 | return moveResizeMode && !isMove(); | 113 | return moveResizeMode && !isMove(); |
102 | } | 114 | } |
103 | 115 | ||
104 | private:// Disabled copy constructor and operator= | 116 | private:// Disabled copy constructor and operator= |
105 | #if defined(Q_DISABLE_COPY) | 117 | #if defined(Q_DISABLE_COPY) |
106 | QWidgetResizeHandler( const QWidgetResizeHandler & ); | 118 | QWidgetResizeHandler( const QWidgetResizeHandler & ); |
107 | QWidgetResizeHandler& operator=( const QWidgetResizeHandler & ); | 119 | QWidgetResizeHandler& operator=( const QWidgetResizeHandler & ); |
108 | #endif | 120 | #endif |
109 | 121 | ||
110 | }; | 122 | }; |
111 | 123 | ||
112 | #endif //QT_NO_RESIZEHANDLER | 124 | #endif //QT_NO_RESIZEHANDLER |
113 | #endif | 125 | #endif |