1// qboxlayout.sip generated by MetaSIP
2//
3// This file is part of the QtWidgets Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QBoxLayout : QLayout
24{
25%TypeHeaderCode
26#include <qboxlayout.h>
27%End
28
29public:
30    enum Direction
31    {
32        LeftToRight,
33        RightToLeft,
34        TopToBottom,
35        BottomToTop,
36        Down,
37        Up,
38    };
39
40    QBoxLayout(QBoxLayout::Direction direction, QWidget *parent /TransferThis/ = 0);
41    virtual ~QBoxLayout();
42    QBoxLayout::Direction direction() const;
43    void setDirection(QBoxLayout::Direction);
44    void addSpacing(int size);
45    void addStretch(int stretch = 0);
46    void addWidget(QWidget * /GetWrapper/, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
47%MethodCode
48        Py_BEGIN_ALLOW_THREADS
49        sipCpp->addWidget(a0, a1, *a2);
50        Py_END_ALLOW_THREADS
51
52        // The layout's parent widget (if there is one) will now have ownership.
53        QWidget *parent = sipCpp->parentWidget();
54
55        if (parent)
56        {
57            PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
58
59            if (py_parent)
60                sipTransferTo(a0Wrapper, py_parent);
61        }
62        else
63        {
64            // For now give the Python ownership to the layout.  This maintains
65            // compatibility with previous versions and allows addWidget(QWidget()).
66            sipTransferTo(a0Wrapper, sipSelf);
67        }
68%End
69
70    void addLayout(QLayout *layout /Transfer/, int stretch = 0);
71    void addStrut(int);
72    virtual void addItem(QLayoutItem * /Transfer/);
73    void insertSpacing(int index, int size);
74    void insertStretch(int index, int stretch = 0);
75    void insertWidget(int index, QWidget *widget /GetWrapper/, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
76%MethodCode
77        Py_BEGIN_ALLOW_THREADS
78        sipCpp->insertWidget(a0, a1, a2, *a3);
79        Py_END_ALLOW_THREADS
80
81        // The layout's parent widget (if there is one) will now have ownership.
82        QWidget *parent = sipCpp->parentWidget();
83
84        if (parent)
85        {
86            PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
87
88            if (py_parent)
89                sipTransferTo(a1Wrapper, py_parent);
90        }
91        else
92        {
93            // For now give the Python ownership to the layout.  This maintains
94            // compatibility with previous versions and allows insertWidget(QWidget()).
95            sipTransferTo(a1Wrapper, sipSelf);
96        }
97%End
98
99    void insertLayout(int index, QLayout *layout /Transfer/, int stretch = 0);
100    bool setStretchFactor(QWidget *w, int stretch);
101    bool setStretchFactor(QLayout *l, int stretch);
102    virtual QSize sizeHint() const;
103    virtual QSize minimumSize() const;
104    virtual QSize maximumSize() const;
105    virtual bool hasHeightForWidth() const;
106    virtual int heightForWidth(int) const;
107    virtual int minimumHeightForWidth(int) const;
108    virtual Qt::Orientations expandingDirections() const;
109    virtual void invalidate();
110    virtual QLayoutItem *itemAt(int) const;
111    virtual QLayoutItem *takeAt(int) /TransferBack/;
112    virtual int count() const;
113    virtual void setGeometry(const QRect &);
114    int spacing() const;
115    void setSpacing(int spacing);
116    void addSpacerItem(QSpacerItem *spacerItem /Transfer/);
117    void insertSpacerItem(int index, QSpacerItem *spacerItem /Transfer/);
118    void setStretch(int index, int stretch);
119    int stretch(int index) const;
120    void insertItem(int index, QLayoutItem * /TransferThis/);
121};
122
123class QHBoxLayout : QBoxLayout
124{
125%TypeHeaderCode
126#include <qboxlayout.h>
127%End
128
129public:
130    QHBoxLayout();
131    explicit QHBoxLayout(QWidget *parent /TransferThis/);
132    virtual ~QHBoxLayout();
133};
134
135class QVBoxLayout : QBoxLayout
136{
137%TypeHeaderCode
138#include <qboxlayout.h>
139%End
140
141public:
142    QVBoxLayout();
143    explicit QVBoxLayout(QWidget *parent /TransferThis/);
144    virtual ~QVBoxLayout();
145};
146