1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.gui.pagelayout;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.global;
17 import qt.core.margins;
18 import qt.core.rect;
19 import qt.core.shareddata;
20 import qt.core.typeinfo;
21 import qt.gui.pagesize;
22 import qt.helpers;
23 
24 extern(C++, class) struct QPageLayoutPrivate;
25 
26 /// Binding for C++ class [QPageLayout](https://doc.qt.io/qt-6/qpagelayout.html).
27 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPageLayout
28 {
29 public:
30 
31     // NOTE: Must keep in sync with QPageSize::Unit and QPrinter::Unit
32     enum Unit {
33         Millimeter,
34         Point,
35         Inch,
36         Pica,
37         Didot,
38         Cicero
39     }
40 
41     enum Orientation {
42         Portrait,
43         Landscape
44     }
45 
46     enum Mode {
47         StandardMode,  // Paint Rect includes margins
48         FullPageMode   // Paint Rect excludes margins
49     }
50 
51     @disable this();
52     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
53     ref typeof(this) rawConstructor();
54     static typeof(this) create()
55     {
56         typeof(this) r = typeof(this).init;
57         r.rawConstructor();
58         return r;
59     }
60 
61     this(ref const(QPageSize) pageSize, Orientation orientation,
62                     ref const(QMarginsF) margins, Unit units = Unit.Point,
63                     ref const(QMarginsF) minMargins = globalInitVar!QMarginsF);
64     @disable this(this);
65     this(ref const(QPageLayout) other);
66     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageLayout) +/
67     /+ref QPageLayout operator =(ref const(QPageLayout) other);+/
68     ~this();
69 
70     /+ void swap(QPageLayout &other) noexcept { qSwap(d, other.d); } +/
71 
72     bool isEquivalentTo(ref const(QPageLayout) other) const;
73 
74     bool isValid() const;
75 
76     void setMode(Mode mode);
77     Mode mode() const;
78 
79     void setPageSize(ref const(QPageSize) pageSize,
80                          ref const(QMarginsF) minMargins /+ = QMarginsF(0, 0, 0, 0) +/);
81     QPageSize pageSize() const;
82 
83     void setOrientation(Orientation orientation);
84     Orientation orientation() const;
85 
86     void setUnits(Unit units);
87     Unit units() const;
88 
89     bool setMargins(ref const(QMarginsF) margins);
90     bool setLeftMargin(qreal leftMargin);
91     bool setRightMargin(qreal rightMargin);
92     bool setTopMargin(qreal topMargin);
93     bool setBottomMargin(qreal bottomMargin);
94 
95     QMarginsF margins() const;
96     QMarginsF margins(Unit units) const;
97     QMargins marginsPoints() const;
98     QMargins marginsPixels(int resolution) const;
99 
100     void setMinimumMargins(ref const(QMarginsF) minMargins);
101     QMarginsF minimumMargins() const;
102     QMarginsF maximumMargins() const;
103 
104     QRectF fullRect() const;
105     QRectF fullRect(Unit units) const;
106     QRect fullRectPoints() const;
107     QRect fullRectPixels(int resolution) const;
108 
109     QRectF paintRect() const;
110     QRectF paintRect(Unit units) const;
111     QRect paintRectPoints() const;
112     QRect paintRectPixels(int resolution) const;
113 
114 private:
115     /+ friend class QPageLayoutPrivate; +/
116     bool equals(ref const(QPageLayout) other) const;
117 
118     /+ friend inline bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
119     { return lhs.equals(rhs); } +/
120     /+ friend inline bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
121     { return !lhs.equals(rhs); } +/
122 
123     QExplicitlySharedDataPointer!(QPageLayoutPrivate) d;
124     mixin(CREATE_CONVENIENCE_WRAPPERS);
125 }
126 
127 /+ Q_DECLARE_SHARED(QPageLayout)
128 
129 #ifndef QT_NO_DEBUG_STREAM
130 Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageLayout &pageLayout);
131 #endif
132 
133 
134 Q_DECLARE_METATYPE(QPageLayout)
135 Q_DECLARE_METATYPE(QPageLayout::Unit)
136 Q_DECLARE_METATYPE(QPageLayout::Orientation) +/
137