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.pagesize; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.rect; 17 import qt.core.shareddata; 18 import qt.core.size; 19 import qt.core.string; 20 import qt.core.typeinfo; 21 import qt.helpers; 22 23 /+ #if defined(B0) 24 #undef B0 // Terminal hang-up. We assume that you do not want that. 25 #endif +/ 26 27 extern(C++, class) struct QPageSizePrivate; 28 29 /// Binding for C++ class [QPageSize](https://doc.qt.io/qt-6/qpagesize.html). 30 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPageSize 31 { 32 public: 33 34 enum PageSizeId { 35 // Old Qt sizes 36 Letter, 37 Legal, 38 Executive, 39 A0, 40 A1, 41 A2, 42 A3, 43 A4, 44 A5, 45 A6, 46 A7, 47 A8, 48 A9, 49 A10, 50 B0, 51 B1, 52 B2, 53 B3, 54 B4, 55 B5, 56 B6, 57 B7, 58 B8, 59 B9, 60 B10, 61 C5E, 62 Comm10E, 63 DLE, 64 Folio, 65 Ledger, 66 Tabloid, 67 Custom, 68 69 // New values derived from PPD standard 70 A3Extra, 71 A4Extra, 72 A4Plus, 73 A4Small, 74 A5Extra, 75 B5Extra, 76 77 JisB0, 78 JisB1, 79 JisB2, 80 JisB3, 81 JisB4, 82 JisB5, 83 JisB6, 84 JisB7, 85 JisB8, 86 JisB9, 87 JisB10, 88 89 // AnsiA = Letter, 90 // AnsiB = Ledger, 91 AnsiC, 92 AnsiD, 93 AnsiE, 94 LegalExtra, 95 LetterExtra, 96 LetterPlus, 97 LetterSmall, 98 TabloidExtra, 99 100 ArchA, 101 ArchB, 102 ArchC, 103 ArchD, 104 ArchE, 105 106 Imperial7x9, 107 Imperial8x10, 108 Imperial9x11, 109 Imperial9x12, 110 Imperial10x11, 111 Imperial10x13, 112 Imperial10x14, 113 Imperial12x11, 114 Imperial15x11, 115 116 ExecutiveStandard, 117 Note, 118 Quarto, 119 Statement, 120 SuperA, 121 SuperB, 122 Postcard, 123 DoublePostcard, 124 Prc16K, 125 Prc32K, 126 Prc32KBig, 127 128 FanFoldUS, 129 FanFoldGerman, 130 FanFoldGermanLegal, 131 132 EnvelopeB4, 133 EnvelopeB5, 134 EnvelopeB6, 135 EnvelopeC0, 136 EnvelopeC1, 137 EnvelopeC2, 138 EnvelopeC3, 139 EnvelopeC4, 140 // EnvelopeC5 = C5E, 141 EnvelopeC6, 142 EnvelopeC65, 143 EnvelopeC7, 144 // EnvelopeDL = DLE, 145 146 Envelope9, 147 // Envelope10 = Comm10E, 148 Envelope11, 149 Envelope12, 150 Envelope14, 151 EnvelopeMonarch, 152 EnvelopePersonal, 153 154 EnvelopeChou3, 155 EnvelopeChou4, 156 EnvelopeInvite, 157 EnvelopeItalian, 158 EnvelopeKaku2, 159 EnvelopeKaku3, 160 EnvelopePrc1, 161 EnvelopePrc2, 162 EnvelopePrc3, 163 EnvelopePrc4, 164 EnvelopePrc5, 165 EnvelopePrc6, 166 EnvelopePrc7, 167 EnvelopePrc8, 168 EnvelopePrc9, 169 EnvelopePrc10, 170 EnvelopeYou4, 171 172 // Last item 173 LastPageSize = PageSizeId.EnvelopeYou4, 174 175 // Convenience overloads for naming consistency 176 AnsiA = PageSizeId.Letter, 177 AnsiB = PageSizeId.Ledger, 178 EnvelopeC5 = PageSizeId.C5E, 179 EnvelopeDL = PageSizeId.DLE, 180 Envelope10 = PageSizeId.Comm10E 181 } 182 183 // NOTE: Must keep in sync with QPageLayout::Unit and QPrinter::Unit 184 enum Unit { 185 Millimeter, 186 Point, 187 Inch, 188 Pica, 189 Didot, 190 Cicero 191 } 192 193 enum SizeMatchPolicy { 194 FuzzyMatch, 195 FuzzyOrientationMatch, 196 ExactMatch 197 } 198 199 @disable this(); 200 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 201 ref typeof(this) rawConstructor(); 202 static typeof(this) create() 203 { 204 typeof(this) r = typeof(this).init; 205 r.rawConstructor(); 206 return r; 207 } 208 209 /+ Q_IMPLICIT +/ this(PageSizeId pageSizeId); 210 /+ explicit +/this(ref const(QSize) pointSize, 211 ref const(QString) name = globalInitVar!QString, 212 SizeMatchPolicy matchPolicy = SizeMatchPolicy.FuzzyMatch); 213 /+ explicit +/this(ref const(QSizeF) size, Unit units, 214 ref const(QString) name = globalInitVar!QString, 215 SizeMatchPolicy matchPolicy = SizeMatchPolicy.FuzzyMatch); 216 @disable this(this); 217 this(ref const(QPageSize) other); 218 /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageSize) +/ 219 /+ref QPageSize operator =(ref const(QPageSize) other);+/ 220 ~this(); 221 222 223 /+ void swap(QPageSize &other) noexcept { qSwap(d, other.d); } +/ 224 225 /+ friend Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs); +/ 226 bool isEquivalentTo(ref const(QPageSize) other) const; 227 228 bool isValid() const; 229 230 QString key() const; 231 QString name() const; 232 233 PageSizeId id() const; 234 235 int windowsId() const; 236 237 QSizeF definitionSize() const; 238 Unit definitionUnits() const; 239 240 QSizeF size(Unit units) const; 241 QSize sizePoints() const; 242 QSize sizePixels(int resolution) const; 243 244 QRectF rect(Unit units) const; 245 QRect rectPoints() const; 246 QRect rectPixels(int resolution) const; 247 248 static QString key(PageSizeId pageSizeId); 249 static QString name(PageSizeId pageSizeId); 250 251 static PageSizeId id(ref const(QSize) pointSize, 252 SizeMatchPolicy matchPolicy = SizeMatchPolicy.FuzzyMatch); 253 static PageSizeId id(ref const(QSizeF) size, Unit units, 254 SizeMatchPolicy matchPolicy = SizeMatchPolicy.FuzzyMatch); 255 256 static PageSizeId id(int windowsId); 257 static int windowsId(PageSizeId pageSizeId); 258 259 static QSizeF definitionSize(PageSizeId pageSizeId); 260 static Unit definitionUnits(PageSizeId pageSizeId); 261 262 static QSizeF size(PageSizeId pageSizeId, Unit units); 263 static QSize sizePoints(PageSizeId pageSizeId); 264 static QSize sizePixels(PageSizeId pageSizeId, int resolution); 265 266 private: 267 /+ friend class QPageSizePrivate; +/ 268 /+ friend class QPlatformPrintDevice; +/ 269 270 bool equals(ref const(QPageSize) other) const; 271 /+ friend inline bool operator==(const QPageSize &lhs, const QPageSize &rhs) 272 { return lhs.equals(rhs); } +/ 273 /+ friend inline bool operator!=(const QPageSize &lhs, const QPageSize &rhs) 274 { return !(lhs == rhs); } +/ 275 276 this(ref const(QString) key, ref const(QSize) pointSize, ref const(QString) name); 277 this(int windowsId, ref const(QSize) pointSize, ref const(QString) name); 278 this(ref QPageSizePrivate dd); 279 QSharedDataPointer!(QPageSizePrivate) d; 280 mixin(CREATE_CONVENIENCE_WRAPPERS); 281 } 282 283 /+ Q_DECLARE_SHARED(QPageSize) 284 285 #ifndef QT_NO_DEBUG_STREAM 286 Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize); 287 #endif 288 289 290 Q_DECLARE_METATYPE(QPageSize) 291 Q_DECLARE_METATYPE(QPageSize::PageSizeId) 292 Q_DECLARE_METATYPE(QPageSize::Unit) +/ 293