summaryrefslogtreecommitdiff
path: root/qmake/include/private/qwidgetresizehandler_p.h
Unidiff
Diffstat (limited to 'qmake/include/private/qwidgetresizehandler_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/private/qwidgetresizehandler_p.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/qmake/include/private/qwidgetresizehandler_p.h b/qmake/include/private/qwidgetresizehandler_p.h
new file mode 100644
index 0000000..ca229db
--- a/dev/null
+++ b/qmake/include/private/qwidgetresizehandler_p.h
@@ -0,0 +1,113 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of the QWidgetResizeHandler class
5**
6** Created : 001010
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the workspace module of the Qt GUI Toolkit.
11**
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
14** LICENSE.QPL included in the packaging of this file.
15**
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
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition licenses may use this
22** file in accordance with the Qt Commercial License Agreement provided
23** with the Software.
24**
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.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QWIDGETRESIZEHANDLER_H
39#define QWIDGETRESIZEHANDLER_H
40
41#ifndef QT_H
42#include "qobject.h"
43#endif // QT_H
44#ifndef QT_NO_RESIZEHANDLER
45class QMouseEvent;
46class QKeyEvent;
47
48class Q_EXPORT QWidgetResizeHandler : public QObject
49{
50 Q_OBJECT
51
52public:
53 QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 );
54 void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); }
55 bool isActive() const { return active; }
56 void setMovingEnabled( bool b ) { moving = b; }
57 bool isMovingEnabled() const { return moving; }
58
59 bool isButtonDown() const { return buttonDown; }
60
61 void setExtraHeight( int h ) { extrahei = h; }
62 void setSizeProtection( bool b ) { sizeprotect = b; }
63
64 void doResize();
65 void doMove();
66
67signals:
68 void activate();
69
70protected:
71 bool eventFilter( QObject *o, QEvent *e );
72 void mouseMoveEvent( QMouseEvent *e );
73 void keyPressEvent( QKeyEvent *e );
74
75private:
76 enum MousePosition {
77 Nowhere,
78 TopLeft, BottomRight, BottomLeft, TopRight,
79 Top, Bottom, Left, Right,
80 Center
81 };
82
83 QWidget *widget;
84 QWidget *childWidget;
85 QPoint moveOffset;
86 QPoint invertedMoveOffset;
87 MousePosition mode;
88 int extrahei;
89 int range;
90 uint buttonDown :1;
91 uint moveResizeMode :1;
92 uint active :1;
93 uint sizeprotect :1;
94 uint moving :1;
95
96 void setMouseCursor( MousePosition m );
97 bool isMove() const {
98 return moveResizeMode && mode == Center;
99 }
100 bool isResize() const {
101 return moveResizeMode && !isMove();
102 }
103
104 private:// Disabled copy constructor and operator=
105#if defined(Q_DISABLE_COPY)
106 QWidgetResizeHandler( const QWidgetResizeHandler & );
107 QWidgetResizeHandler& operator=( const QWidgetResizeHandler & );
108#endif
109
110};
111
112#endif //QT_NO_RESIZEHANDLER
113#endif