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.gui.pagelayout;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.global;
19 import qt.core.margins;
20 import qt.core.rect;
21 import qt.core.shareddata;
22 import qt.core.typeinfo;
23 import qt.gui.pagesize;
24 import qt.helpers;
25 
26 extern(C++, class) struct QPageLayoutPrivate;
27 /+ class QMarginsF; +/
28 
29 @Q_MOVABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPageLayout
30 {
31 public:
32 
33     // NOTE: Must keep in sync with QPageSize::Unit and QPrinter::Unit
34     enum Unit {
35         Millimeter,
36         Point,
37         Inch,
38         Pica,
39         Didot,
40         Cicero
41     }
42 
43     // NOTE: Must keep in sync with QPrinter::Orientation
44     enum Orientation {
45         Portrait,
46         Landscape
47     }
48 
49     enum Mode {
50         StandardMode,  // Paint Rect includes margins
51         FullPageMode   // Paint Rect excludes margins
52     }
53 
54     @disable this();
55     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
56     ref typeof(this) rawConstructor();
57     static typeof(this) create()
58     {
59         typeof(this) r = typeof(this).init;
60         r.rawConstructor();
61         return r;
62     }
63 
64     this(ref const(QPageSize) pageSize, Orientation orientation,
65                     ref const(QMarginsF) margins, Unit units = Unit.Point,
66                     ref const(QMarginsF) minMargins = globalInitVar!QMarginsF);
67     @disable this(this);
68     this(ref const(QPageLayout) other);
69     /+ QPageLayout &operator=(QPageLayout &&other) noexcept { swap(other); return *this; } +/
70     /+ref QPageLayout operator =(ref const(QPageLayout) other);+/
71     ~this();
72 
73     /+ void swap(QPageLayout &other) noexcept { qSwap(d, other.d); } +/
74 
75     /+ friend Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs); +/
76     bool isEquivalentTo(ref const(QPageLayout) other) const;
77 
78     bool isValid() const;
79 
80     void setMode(Mode mode);
81     Mode mode() const;
82 
83     void setPageSize(ref const(QPageSize) pageSize,
84                          ref const(QMarginsF) minMargins /+ = QMarginsF(0, 0, 0, 0) +/);
85     QPageSize pageSize() const;
86 
87     void setOrientation(Orientation orientation);
88     Orientation orientation() const;
89 
90     void setUnits(Unit units);
91     Unit units() const;
92 
93     bool setMargins(ref const(QMarginsF) margins);
94     bool setLeftMargin(qreal leftMargin);
95     bool setRightMargin(qreal rightMargin);
96     bool setTopMargin(qreal topMargin);
97     bool setBottomMargin(qreal bottomMargin);
98 
99     QMarginsF margins() const;
100     QMarginsF margins(Unit units) const;
101     QMargins marginsPoints() const;
102     QMargins marginsPixels(int resolution) const;
103 
104     void setMinimumMargins(ref const(QMarginsF) minMargins);
105     QMarginsF minimumMargins() const;
106     QMarginsF maximumMargins() const;
107 
108     QRectF fullRect() const;
109     QRectF fullRect(Unit units) const;
110     QRect fullRectPoints() const;
111     QRect fullRectPixels(int resolution) const;
112 
113     QRectF paintRect() const;
114     QRectF paintRect(Unit units) const;
115     QRect paintRectPoints() const;
116     QRect paintRectPixels(int resolution) const;
117 
118 private:
119     /+ friend class QPageLayoutPrivate; +/
120     QExplicitlySharedDataPointer!(QPageLayoutPrivate) d;
121 }
122 
123 /+ Q_DECLARE_SHARED(QPageLayout) +/
124 
125 /+/+ Q_GUI_EXPORT +/ bool operator ==(ref const(QPageLayout) lhs, ref const(QPageLayout) rhs);+/
126 /+pragma(inline, true) bool operator !=(ref const(QPageLayout) lhs, ref const(QPageLayout) rhs)
127 { return !operator==(lhs, rhs); }+/
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