1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the gui module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include "QtCore/qobject.h"
33
#include "QtGui/qlayoutitem.h"
34
#include "QtGui/qsizepolicy.h"
35
#include "QtCore/qrect.h"
43
class Q_GUI_EXPORT QLayoutIterator
46
inline QT3_SUPPORT_CONSTRUCTOR QLayoutIterator(QLayout *i) : layout(i), index(0) {}
47
inline QLayoutIterator(const QLayoutIterator &i)
48
: layout(i.layout), index(i.index) {}
49
inline QLayoutIterator &operator=(const QLayoutIterator &i) {
54
inline QT3_SUPPORT QLayoutItem *operator++();
55
inline QT3_SUPPORT QLayoutItem *current();
56
inline QT3_SUPPORT QLayoutItem *takeCurrent();
57
inline QT3_SUPPORT void deleteCurrent();
60
// hack to avoid deprecated warning
62
inline QLayoutIterator(QLayout *i, bool) : layout(i), index(0) {}
70
class Q_GUI_EXPORT QLayout : public QObject, public QLayoutItem
73
Q_DECLARE_PRIVATE(QLayout)
75
Q_ENUMS(SizeConstraint)
76
Q_PROPERTY(int margin READ margin WRITE setMargin)
77
Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
78
Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint)
88
#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
89
, Auto = SetDefaultConstraint,
90
FreeResize = SetNoConstraint,
91
Minimum = SetMinimumSize,
96
QLayout(QWidget *parent);
104
void setSpacing(int);
106
bool setAlignment(QWidget *w, Qt::Alignment alignment);
107
bool setAlignment(QLayout *l, Qt::Alignment alignment);
108
#ifdef Q_NO_USING_KEYWORD
109
inline void setAlignment(Qt::Alignment alignment) { QLayoutItem::setAlignment(alignment); }
111
using QLayoutItem::setAlignment;
114
void setSizeConstraint(SizeConstraint);
115
SizeConstraint sizeConstraint() const;
117
inline QT3_SUPPORT void setResizeMode(SizeConstraint s) {setSizeConstraint(s);}
118
inline QT3_SUPPORT SizeConstraint resizeMode() const {return sizeConstraint();}
120
void setMenuBar(QWidget *w);
121
QWidget *menuBar() const;
123
QWidget *parentWidget() const;
126
QRect geometry() const;
130
void addWidget(QWidget *w);
131
virtual void addItem(QLayoutItem *) = 0;
133
void removeWidget(QWidget *w);
134
void removeItem(QLayoutItem *);
136
Qt::Orientations expandingDirections() const;
137
QSize minimumSize() const;
138
QSize maximumSize() const;
139
void setGeometry(const QRect&) = 0;
140
virtual QLayoutItem *itemAt(int index) const = 0;
141
virtual QLayoutItem *takeAt(int index) = 0;
142
virtual int indexOf(QWidget *) const;
143
virtual int count() const = 0;
144
bool isEmpty() const;
146
int totalHeightForWidth(int w) const;
147
QSize totalMinimumSize() const;
148
QSize totalMaximumSize() const;
149
QSize totalSizeHint() const;
152
void setEnabled(bool);
153
bool isEnabled() const;
156
QT3_SUPPORT void freeze(int w=0, int h=0);
157
QT3_SUPPORT bool isTopLevel() const;
160
static QSize closestAcceptableSize(const QWidget *w, const QSize &s);
163
void widgetEvent(QEvent *);
164
void childEvent(QChildEvent *e);
165
void addChildLayout(QLayout *l);
166
void addChildWidget(QWidget *w);
168
QT3_SUPPORT void deleteAllItems();
171
QRect alignmentRect(const QRect&) const;
173
QLayout(QLayoutPrivate &d, QLayout*, QWidget*);
176
Q_DISABLE_COPY(QLayout)
178
static void activateRecursiveHelper(QLayoutItem *item);
180
friend class QApplicationPrivate;
181
friend class QWidget;
185
QT3_SUPPORT_CONSTRUCTOR QLayout(QWidget *parent, int margin, int spacing = -1,
186
const char *name = 0);
187
QT3_SUPPORT_CONSTRUCTOR QLayout(QLayout *parentLayout, int spacing = -1, const char *name = 0);
188
QT3_SUPPORT_CONSTRUCTOR QLayout(int spacing, const char *name = 0);
189
inline QT3_SUPPORT QWidget *mainWidget() const { return parentWidget(); }
190
inline QT3_SUPPORT void remove(QWidget *w) { removeWidget(w); }
191
inline QT3_SUPPORT void add(QWidget *w) { addWidget(w); }
193
QT3_SUPPORT void setAutoAdd(bool a);
194
QT3_SUPPORT bool autoAdd() const;
195
inline QT3_SUPPORT QLayoutIterator iterator() { return QLayoutIterator(this,true); }
197
inline QT3_SUPPORT int defaultBorder() const { return spacing(); }
202
inline QLayoutItem *QLayoutIterator::operator++() { return layout->itemAt(++index); }
203
inline QLayoutItem *QLayoutIterator::current() { return layout->itemAt(index); }
204
inline QLayoutItem *QLayoutIterator::takeCurrent() { return layout->takeAt(index); }
205
inline void QLayoutIterator::deleteCurrent() { delete layout->takeAt(index); }
211
//### support old includes
212
#if 1 //def QT3_SUPPORT
213
#include "QtGui/qboxlayout.h"
214
#include "QtGui/qgridlayout.h"