-rw-r--r-- | libqtaux/qsplitter.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/libqtaux/qsplitter.h b/libqtaux/qsplitter.h new file mode 100644 index 0000000..8625c4d --- a/dev/null +++ b/libqtaux/qsplitter.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Defintion of QSplitter class | ||
5 | ** | ||
6 | ** Created: 980105 | ||
7 | ** | ||
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | ||
9 | ** | ||
10 | ** This file is part of the widgets 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 or Qt Professional Edition | ||
22 | ** licenses may use this file in accordance with the Qt Commercial License | ||
23 | ** Agreement provided 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 | #ifndef QSPLITTER_H | ||
38 | #define QSPLITTER_H | ||
39 | |||
40 | #ifndef QT_H | ||
41 | #include "qframe.h" | ||
42 | #include "qvaluelist.h" | ||
43 | #endif // QT_H | ||
44 | |||
45 | class QSplitterHandle; | ||
46 | class QSplitterData; | ||
47 | class QSplitterLayoutStruct; | ||
48 | |||
49 | class Q_EXPORT QSplitter : public QFrame | ||
50 | { | ||
51 | Q_OBJECT | ||
52 | Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) | ||
53 | |||
54 | public: | ||
55 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; | ||
56 | |||
57 | QSplitter( QWidget *parent=0, const char *name=0 ); | ||
58 | QSplitter( Orientation, QWidget *parent=0, const char *name=0 ); | ||
59 | ~QSplitter(); | ||
60 | |||
61 | virtual void setOrientation( Orientation ); | ||
62 | Orientation orientation() const { return orient; } | ||
63 | |||
64 | virtual void setResizeMode( QWidget *w, ResizeMode ); | ||
65 | virtual void setOpaqueResize( bool = TRUE ); | ||
66 | bool opaqueResize() const; | ||
67 | |||
68 | void moveToFirst( QWidget * ); | ||
69 | void moveToLast( QWidget * ); | ||
70 | |||
71 | void refresh() { recalc( TRUE ); } | ||
72 | QSize sizeHint() const; | ||
73 | QSize minimumSizeHint() const; | ||
74 | QSizePolicy sizePolicy() const; | ||
75 | |||
76 | QValueList<int> sizes() const; | ||
77 | void setSizes( QValueList<int> ); | ||
78 | |||
79 | protected: | ||
80 | void childEvent( QChildEvent * ); | ||
81 | |||
82 | bool event( QEvent * ); | ||
83 | void resizeEvent( QResizeEvent * ); | ||
84 | |||
85 | int idAfter( QWidget* ) const; | ||
86 | |||
87 | void moveSplitter( QCOORD pos, int id ); | ||
88 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, | ||
89 | QCOORD w, QCOORD h ); | ||
90 | void styleChange( QStyle& ); | ||
91 | int adjustPos( int , int ); | ||
92 | virtual void setRubberband( int ); | ||
93 | void getRange( int id, int*, int* ); | ||
94 | |||
95 | private: | ||
96 | void init(); | ||
97 | void recalc( bool update = FALSE ); | ||
98 | void doResize(); | ||
99 | void storeSizes(); | ||
100 | void processChildEvents(); | ||
101 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); | ||
102 | void recalcId(); | ||
103 | void moveBefore( int pos, int id, bool upLeft ); | ||
104 | void moveAfter( int pos, int id, bool upLeft ); | ||
105 | void setG( QWidget *w, int p, int s ); | ||
106 | |||
107 | QCOORD pick( const QPoint &p ) const | ||
108 | { return orient == Horizontal ? p.x() : p.y(); } | ||
109 | QCOORD pick( const QSize &s ) const | ||
110 | { return orient == Horizontal ? s.width() : s.height(); } | ||
111 | |||
112 | QCOORD trans( const QPoint &p ) const | ||
113 | { return orient == Vertical ? p.x() : p.y(); } | ||
114 | QCOORD trans( const QSize &s ) const | ||
115 | { return orient == Vertical ? s.width() : s.height(); } | ||
116 | |||
117 | QSplitterData *data; | ||
118 | |||
119 | Orientation orient; | ||
120 | friend class QSplitterHandle; | ||
121 | private:// Disabled copy constructor and operator= | ||
122 | #if defined(Q_DISABLE_COPY) | ||
123 | QSplitter( const QSplitter & ); | ||
124 | QSplitter& operator=( const QSplitter & ); | ||
125 | #endif | ||
126 | }; | ||
127 | |||
128 | #endif // QSPLITTER_H | ||