| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
|---|
| 4 | ** Contact: https://www.qt.io/licensing/ | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial License Usage | 
|---|
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
|---|
| 11 | ** accordance with the commercial license agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
|---|
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
|---|
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
|---|
| 16 | ** | 
|---|
| 17 | ** GNU Lesser General Public License Usage | 
|---|
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 19 | ** General Public License version 3 as published by the Free Software | 
|---|
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | 
|---|
| 21 | ** packaging of this file. Please review the following information to | 
|---|
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | 
|---|
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | 
|---|
| 24 | ** | 
|---|
| 25 | ** GNU General Public License Usage | 
|---|
| 26 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | 
|---|
| 28 | ** Public license version 3 or any later version approved by the KDE Free | 
|---|
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | 
|---|
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | 
|---|
| 31 | ** included in the packaging of this file. Please review the following | 
|---|
| 32 | ** information to ensure the GNU General Public License requirements will | 
|---|
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | 
|---|
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** $QT_END_LICENSE$ | 
|---|
| 37 | ** | 
|---|
| 38 | ****************************************************************************/ | 
|---|
| 39 |  | 
|---|
| 40 | #ifndef QBOXLAYOUT_H | 
|---|
| 41 | #define QBOXLAYOUT_H | 
|---|
| 42 |  | 
|---|
| 43 | #include <QtWidgets/qtwidgetsglobal.h> | 
|---|
| 44 | #include <QtWidgets/qlayout.h> | 
|---|
| 45 | #ifdef QT_INCLUDE_COMPAT | 
|---|
| 46 | #include <QtWidgets/qwidget.h> | 
|---|
| 47 | #endif | 
|---|
| 48 |  | 
|---|
| 49 | #include <limits.h> | 
|---|
| 50 |  | 
|---|
| 51 | QT_BEGIN_NAMESPACE | 
|---|
| 52 |  | 
|---|
| 53 |  | 
|---|
| 54 | class QBoxLayoutPrivate; | 
|---|
| 55 |  | 
|---|
| 56 | class Q_WIDGETS_EXPORT QBoxLayout : public QLayout | 
|---|
| 57 | { | 
|---|
| 58 | Q_OBJECT | 
|---|
| 59 | Q_DECLARE_PRIVATE(QBoxLayout) | 
|---|
| 60 | public: | 
|---|
| 61 | enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop, | 
|---|
| 62 | Down = TopToBottom, Up = BottomToTop }; | 
|---|
| 63 |  | 
|---|
| 64 | explicit QBoxLayout(Direction, QWidget *parent = nullptr); | 
|---|
| 65 |  | 
|---|
| 66 | ~QBoxLayout(); | 
|---|
| 67 |  | 
|---|
| 68 | Direction direction() const; | 
|---|
| 69 | void setDirection(Direction); | 
|---|
| 70 |  | 
|---|
| 71 | void addSpacing(int size); | 
|---|
| 72 | void addStretch(int stretch = 0); | 
|---|
| 73 | void addSpacerItem(QSpacerItem *spacerItem); | 
|---|
| 74 | void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = Qt::Alignment()); | 
|---|
| 75 | void addLayout(QLayout *layout, int stretch = 0); | 
|---|
| 76 | void addStrut(int); | 
|---|
| 77 | void addItem(QLayoutItem *) override; | 
|---|
| 78 |  | 
|---|
| 79 | void insertSpacing(int index, int size); | 
|---|
| 80 | void insertStretch(int index, int stretch = 0); | 
|---|
| 81 | void insertSpacerItem(int index, QSpacerItem *spacerItem); | 
|---|
| 82 | void insertWidget(int index, QWidget *widget, int stretch = 0, Qt::Alignment alignment = Qt::Alignment()); | 
|---|
| 83 | void insertLayout(int index, QLayout *layout, int stretch = 0); | 
|---|
| 84 | void insertItem(int index, QLayoutItem *); | 
|---|
| 85 |  | 
|---|
| 86 | int spacing() const; | 
|---|
| 87 | void setSpacing(int spacing); | 
|---|
| 88 |  | 
|---|
| 89 | bool setStretchFactor(QWidget *w, int stretch); | 
|---|
| 90 | bool setStretchFactor(QLayout *l, int stretch); | 
|---|
| 91 | void setStretch(int index, int stretch); | 
|---|
| 92 | int stretch(int index) const; | 
|---|
| 93 |  | 
|---|
| 94 | QSize sizeHint() const override; | 
|---|
| 95 | QSize minimumSize() const override; | 
|---|
| 96 | QSize maximumSize() const override; | 
|---|
| 97 |  | 
|---|
| 98 | bool hasHeightForWidth() const override; | 
|---|
| 99 | int heightForWidth(int) const override; | 
|---|
| 100 | int minimumHeightForWidth(int) const override; | 
|---|
| 101 |  | 
|---|
| 102 | Qt::Orientations expandingDirections() const override; | 
|---|
| 103 | void invalidate() override; | 
|---|
| 104 | QLayoutItem *itemAt(int) const override; | 
|---|
| 105 | QLayoutItem *takeAt(int) override; | 
|---|
| 106 | int count() const override; | 
|---|
| 107 | void setGeometry(const QRect&) override; | 
|---|
| 108 |  | 
|---|
| 109 | private: | 
|---|
| 110 | Q_DISABLE_COPY(QBoxLayout) | 
|---|
| 111 | }; | 
|---|
| 112 |  | 
|---|
| 113 | class Q_WIDGETS_EXPORT QHBoxLayout : public QBoxLayout | 
|---|
| 114 | { | 
|---|
| 115 | Q_OBJECT | 
|---|
| 116 | public: | 
|---|
| 117 | QHBoxLayout(); | 
|---|
| 118 | explicit QHBoxLayout(QWidget *parent); | 
|---|
| 119 | ~QHBoxLayout(); | 
|---|
| 120 |  | 
|---|
| 121 |  | 
|---|
| 122 | private: | 
|---|
| 123 | Q_DISABLE_COPY(QHBoxLayout) | 
|---|
| 124 | }; | 
|---|
| 125 |  | 
|---|
| 126 | class Q_WIDGETS_EXPORT QVBoxLayout : public QBoxLayout | 
|---|
| 127 | { | 
|---|
| 128 | Q_OBJECT | 
|---|
| 129 | public: | 
|---|
| 130 | QVBoxLayout(); | 
|---|
| 131 | explicit QVBoxLayout(QWidget *parent); | 
|---|
| 132 | ~QVBoxLayout(); | 
|---|
| 133 |  | 
|---|
| 134 |  | 
|---|
| 135 | private: | 
|---|
| 136 | Q_DISABLE_COPY(QVBoxLayout) | 
|---|
| 137 | }; | 
|---|
| 138 |  | 
|---|
| 139 | QT_END_NAMESPACE | 
|---|
| 140 |  | 
|---|
| 141 | #endif // QBOXLAYOUT_H | 
|---|
| 142 |  | 
|---|