|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtGui module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QBOXLAYOUT_H |
|
43 #define QBOXLAYOUT_H |
|
44 |
|
45 #include <QtGui/qlayout.h> |
|
46 #ifdef QT_INCLUDE_COMPAT |
|
47 #include <QtGui/qwidget.h> |
|
48 #endif |
|
49 |
|
50 #include <limits.h> |
|
51 |
|
52 QT_BEGIN_HEADER |
|
53 |
|
54 QT_BEGIN_NAMESPACE |
|
55 |
|
56 QT_MODULE(Gui) |
|
57 |
|
58 class QBoxLayoutPrivate; |
|
59 |
|
60 class Q_GUI_EXPORT QBoxLayout : public QLayout |
|
61 { |
|
62 Q_OBJECT |
|
63 Q_DECLARE_PRIVATE(QBoxLayout) |
|
64 public: |
|
65 enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop, |
|
66 Down = TopToBottom, Up = BottomToTop }; |
|
67 |
|
68 explicit QBoxLayout(Direction, QWidget *parent = 0); |
|
69 |
|
70 #ifdef QT3_SUPPORT |
|
71 QT3_SUPPORT_CONSTRUCTOR QBoxLayout(QWidget *parent, Direction, int border = 0, int spacing = -1, |
|
72 const char *name = 0); |
|
73 QT3_SUPPORT_CONSTRUCTOR QBoxLayout(QLayout *parentLayout, Direction, int spacing = -1, |
|
74 const char *name = 0); |
|
75 QT3_SUPPORT_CONSTRUCTOR QBoxLayout(Direction, int spacing, const char *name = 0); |
|
76 #endif |
|
77 ~QBoxLayout(); |
|
78 |
|
79 Direction direction() const; |
|
80 void setDirection(Direction); |
|
81 |
|
82 void addSpacing(int size); |
|
83 void addStretch(int stretch = 0); |
|
84 void addSpacerItem(QSpacerItem *spacerItem); |
|
85 void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = 0); |
|
86 void addLayout(QLayout *layout, int stretch = 0); |
|
87 void addStrut(int); |
|
88 void addItem(QLayoutItem *); |
|
89 |
|
90 void insertSpacing(int index, int size); |
|
91 void insertStretch(int index, int stretch = 0); |
|
92 void insertSpacerItem(int index, QSpacerItem *spacerItem); |
|
93 void insertWidget(int index, QWidget *widget, int stretch = 0, Qt::Alignment alignment = 0); |
|
94 void insertLayout(int index, QLayout *layout, int stretch = 0); |
|
95 |
|
96 int spacing() const; |
|
97 void setSpacing(int spacing); |
|
98 |
|
99 bool setStretchFactor(QWidget *w, int stretch); |
|
100 bool setStretchFactor(QLayout *l, int stretch); |
|
101 void setStretch(int index, int stretch); |
|
102 int stretch(int index) const; |
|
103 |
|
104 QSize sizeHint() const; |
|
105 QSize minimumSize() const; |
|
106 QSize maximumSize() const; |
|
107 |
|
108 bool hasHeightForWidth() const; |
|
109 int heightForWidth(int) const; |
|
110 int minimumHeightForWidth(int) const; |
|
111 |
|
112 Qt::Orientations expandingDirections() const; |
|
113 void invalidate(); |
|
114 QLayoutItem *itemAt(int) const; |
|
115 QLayoutItem *takeAt(int); |
|
116 int count() const; |
|
117 void setGeometry(const QRect&); |
|
118 #ifdef QT3_SUPPORT |
|
119 inline QT3_SUPPORT int findWidget(QWidget* w) {return indexOf(w);} |
|
120 #endif |
|
121 protected: |
|
122 // ### Qt 5: make public |
|
123 void insertItem(int index, QLayoutItem *); |
|
124 |
|
125 private: |
|
126 Q_DISABLE_COPY(QBoxLayout) |
|
127 }; |
|
128 |
|
129 class Q_GUI_EXPORT QHBoxLayout : public QBoxLayout |
|
130 { |
|
131 Q_OBJECT |
|
132 public: |
|
133 QHBoxLayout(); |
|
134 explicit QHBoxLayout(QWidget *parent); |
|
135 ~QHBoxLayout(); |
|
136 |
|
137 #ifdef QT3_SUPPORT |
|
138 QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(QWidget *parent, int border, |
|
139 int spacing = -1, const char *name = 0); |
|
140 QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(QLayout *parentLayout, |
|
141 int spacing = -1, const char *name = 0); |
|
142 QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(int spacing, const char *name = 0); |
|
143 #endif |
|
144 |
|
145 private: |
|
146 Q_DISABLE_COPY(QHBoxLayout) |
|
147 }; |
|
148 |
|
149 class Q_GUI_EXPORT QVBoxLayout : public QBoxLayout |
|
150 { |
|
151 Q_OBJECT |
|
152 public: |
|
153 QVBoxLayout(); |
|
154 explicit QVBoxLayout(QWidget *parent); |
|
155 ~QVBoxLayout(); |
|
156 |
|
157 #ifdef QT3_SUPPORT |
|
158 QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(QWidget *parent, int border, |
|
159 int spacing = -1, const char *name = 0); |
|
160 QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(QLayout *parentLayout, |
|
161 int spacing = -1, const char *name = 0); |
|
162 QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(int spacing, const char *name = 0); |
|
163 #endif |
|
164 |
|
165 private: |
|
166 Q_DISABLE_COPY(QVBoxLayout) |
|
167 }; |
|
168 |
|
169 QT_END_NAMESPACE |
|
170 |
|
171 QT_END_HEADER |
|
172 |
|
173 #endif // QBOXLAYOUT_H |