1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.widgets.layout;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.coreevent;
19 import qt.core.margins;
20 import qt.core.namespace;
21 import qt.core.object;
22 import qt.core.rect;
23 import qt.core.size;
24 import qt.helpers;
25 import qt.widgets.layoutitem;
26 import qt.widgets.sizepolicy;
27 import qt.widgets.widget;
28 
29 /+ class QLayout;
30 class QSize; +/
31 
32 
33 extern(C++, class) struct QLayoutPrivate;
34 
35 class /+ Q_WIDGETS_EXPORT +/ QLayout : QObject, QLayoutItemInterface
36 {
37     QLayoutItemFakeInheritance baseQLayoutItem;
38     mixin(Q_OBJECT);
39     /+ Q_DECLARE_PRIVATE(QLayout) +/
40 
41 /+ #if QT_DEPRECATED_SINCE(5, 13)
42     Q_PROPERTY(int margin READ margin WRITE setMargin)
43 #endif
44     Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
45     Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint) +/
46 public:
47     enum SizeConstraint {
48         SetDefaultConstraint,
49         SetNoConstraint,
50         SetMinimumSize,
51         SetFixedSize,
52         SetMaximumSize,
53         SetMinAndMaxSize
54     }
55     /+ Q_ENUM(SizeConstraint) +/
56 
57     this(QWidget parent);
58     this();
59     ~this();
60 
61 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
62     final int margin() const;
63     final void setMargin(int);
64 /+ #endif +/
65 
66     final int spacing() const;
67     final void setSpacing(int);
68 
69     final void setContentsMargins(int left, int top, int right, int bottom);
70     final void setContentsMargins(ref const(QMargins) margins);
71     final void getContentsMargins(int* left, int* top, int* right, int* bottom) const;
72     final QMargins contentsMargins() const;
73     final QRect contentsRect() const;
74 
75     final bool setAlignment(QWidget w, /+ Qt:: +/qt.core.namespace.Alignment alignment);
76     final bool setAlignment(QLayout l, /+ Qt:: +/qt.core.namespace.Alignment alignment);
77     /+ using QLayoutItem::setAlignment; +/
78 
79     final void setSizeConstraint(SizeConstraint);
80     final SizeConstraint sizeConstraint() const;
81     final void setMenuBar(QWidget w);
82     final QWidget menuBar() const;
83 
84     final QWidget parentWidget() const;
85 
86     override void invalidate();
87     override QRect geometry() const;
88     final bool activate();
89     final void update();
90 
91     final void addWidget(QWidget w);
92     /+ virtual +/ abstract void addItem(QLayoutItem );
93 
94     final void removeWidget(QWidget w);
95     final void removeItem(QLayoutItem );
96 
97     override /+ Qt:: +/qt.core.namespace.Orientations expandingDirections() const;
98     override QSize minimumSize() const;
99     override QSize maximumSize() const;
100     /+ virtual +/ override void setGeometry(ref const(QRect));
101     /+ virtual +/ abstract QLayoutItem itemAt(int index) const;
102     /+ virtual +/ abstract QLayoutItem takeAt(int index);
103     /+ virtual +/ int indexOf(QWidget ) const;
104     /+ QT6_VIRTUAL +/ final int indexOf(QLayoutItem ) const;
105     /+ virtual +/ abstract int count() const;
106     override bool isEmpty() const;
107     override QSizePolicy.ControlTypes controlTypes() const;
108 
109     /+ QT6_VIRTUAL +/ final QLayoutItem replaceWidget(QWidget from, QWidget to,
110                                                /+ Qt:: +/qt.core.namespace.FindChildOptions options = /+ Qt:: +/qt.core.namespace.FindChildOption.FindChildrenRecursively);
111 
112     final int totalHeightForWidth(int w) const;
113     final QSize totalMinimumSize() const;
114     final QSize totalMaximumSize() const;
115     final QSize totalSizeHint() const;
116     override QLayout layout();
117 
118     final void setEnabled(bool);
119     final bool isEnabled() const;
120 
121 
122     static QSize closestAcceptableSize(const(QWidget) w, ref const(QSize) s);
123 
124     override QSize sizeHint() const
125     {
126         assert(0);
127     }
128     override bool hasHeightForWidth() const
129     {
130         assert(0);
131     }
132     override int heightForWidth(int w) const
133     {
134         assert(0);
135     }
136     override int minimumHeightForWidth(int w) const
137     {
138         assert(0);
139     }
140     override QWidget widget()
141     {
142         assert(0);
143     }
144     override QSpacerItem spacerItem()
145     {
146         assert(0);
147     }
148 
149 protected:
150     final void widgetEvent(QEvent );
151     override void childEvent(QChildEvent e);
152     final void addChildLayout(QLayout l);
153     final void addChildWidget(QWidget w);
154     final bool adoptLayout(QLayout layout);
155 
156     final QRect alignmentRect(ref const(QRect)) const;
157 protected:
158     this(ref QLayoutPrivate d, QLayout, QWidget);
159 
160 private:
161     /+ Q_DISABLE_COPY(QLayout) +/
162 
163     static void activateRecursiveHelper(QLayoutItem item);
164 
165     /+ friend class QApplicationPrivate; +/
166     /+ friend class QWidget; +/
167 
168 }
169 
170 
171 //### support old includes
172