1// qsize.sip generated by MetaSIP
2//
3// This file is part of the QtCore 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 QSize
24{
25%TypeHeaderCode
26#include <qsize.h>
27%End
28
29%PickleCode
30    sipRes = Py_BuildValue((char *)"ii", sipCpp->width(), sipCpp->height());
31%End
32
33public:
34    void transpose();
35    void scale(const QSize &s, Qt::AspectRatioMode mode);
36    QSize();
37    QSize(int w, int h);
38    SIP_PYOBJECT __repr__() const /TypeHint="str"/;
39%MethodCode
40        if (sipCpp->isNull())
41        {
42        #if PY_MAJOR_VERSION >= 3
43            sipRes = PyUnicode_FromString("PyQt5.QtCore.QSize()");
44        #else
45            sipRes = PyString_FromString("PyQt5.QtCore.QSize()");
46        #endif
47        }
48        else
49        {
50            sipRes =
51        #if PY_MAJOR_VERSION >= 3
52                PyUnicode_FromFormat
53        #else
54                PyString_FromFormat
55        #endif
56                    ("PyQt5.QtCore.QSize(%i, %i)", sipCpp->width(), sipCpp->height());
57        }
58%End
59
60    bool isNull() const;
61    bool isEmpty() const;
62    bool isValid() const;
63    int __bool__() const;
64%MethodCode
65        sipRes = sipCpp->isValid();
66%End
67
68    int width() const;
69    int height() const;
70    void setWidth(int w);
71    void setHeight(int h);
72    void scale(int w, int h, Qt::AspectRatioMode mode);
73    QSize &operator+=(const QSize &s);
74    QSize &operator-=(const QSize &s);
75    QSize &operator*=(qreal c);
76    QSize &operator/=(qreal c);
77    QSize expandedTo(const QSize &otherSize) const;
78    QSize boundedTo(const QSize &otherSize) const;
79    QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const;
80    QSize scaled(int w, int h, Qt::AspectRatioMode mode) const;
81    QSize transposed() const;
82%If (Qt_5_14_0 -)
83    QSize grownBy(QMargins m) const;
84%End
85%If (Qt_5_14_0 -)
86    QSize shrunkBy(QMargins m) const;
87%End
88};
89
90QDataStream &operator<<(QDataStream &, const QSize & /Constrained/) /ReleaseGIL/;
91QDataStream &operator>>(QDataStream &, QSize & /Constrained/) /ReleaseGIL/;
92bool operator==(const QSize &s1, const QSize &s2);
93bool operator!=(const QSize &s1, const QSize &s2);
94const QSize operator+(const QSize &s1, const QSize &s2);
95const QSize operator-(const QSize &s1, const QSize &s2);
96const QSize operator*(const QSize &s, qreal c);
97const QSize operator*(qreal c, const QSize &s);
98const QSize operator/(const QSize &s, qreal c);
99
100class QSizeF
101{
102%TypeHeaderCode
103#include <qsize.h>
104%End
105
106%PickleCode
107    sipRes = Py_BuildValue((char *)"dd", sipCpp->width(), sipCpp->height());
108%End
109
110public:
111    void transpose();
112    void scale(const QSizeF &s, Qt::AspectRatioMode mode);
113    QSizeF();
114    QSizeF(const QSize &sz);
115    QSizeF(qreal w, qreal h);
116    SIP_PYOBJECT __repr__() const /TypeHint="str"/;
117%MethodCode
118        if (sipCpp->isNull())
119        {
120        #if PY_MAJOR_VERSION >= 3
121            sipRes = PyUnicode_FromString("PyQt5.QtCore.QSizeF()");
122        #else
123            sipRes = PyString_FromString("PyQt5.QtCore.QSizeF()");
124        #endif
125        }
126        else
127        {
128            PyObject *w = PyFloat_FromDouble(sipCpp->width());
129            PyObject *h = PyFloat_FromDouble(sipCpp->height());
130
131            if (w && h)
132            {
133        #if PY_MAJOR_VERSION >= 3
134                sipRes = PyUnicode_FromFormat("PyQt5.QtCore.QSizeF(%R, %R)", w, h);
135        #else
136                sipRes = PyString_FromString("PyQt5.QtCore.QSizeF(");
137                PyString_ConcatAndDel(&sipRes, PyObject_Repr(w));
138                PyString_ConcatAndDel(&sipRes, PyString_FromString(", "));
139                PyString_ConcatAndDel(&sipRes, PyObject_Repr(h));
140                PyString_ConcatAndDel(&sipRes, PyString_FromString(")"));
141        #endif
142            }
143
144            Py_XDECREF(w);
145            Py_XDECREF(h);
146        }
147%End
148
149    bool isNull() const;
150    bool isEmpty() const;
151    bool isValid() const;
152    int __bool__() const;
153%MethodCode
154        sipRes = sipCpp->isValid();
155%End
156
157    qreal width() const;
158    qreal height() const;
159    void setWidth(qreal w);
160    void setHeight(qreal h);
161    void scale(qreal w, qreal h, Qt::AspectRatioMode mode);
162    QSizeF &operator+=(const QSizeF &s);
163    QSizeF &operator-=(const QSizeF &s);
164    QSizeF &operator*=(qreal c);
165    QSizeF &operator/=(qreal c);
166    QSizeF expandedTo(const QSizeF &otherSize) const;
167    QSizeF boundedTo(const QSizeF &otherSize) const;
168    QSize toSize() const;
169    QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const;
170    QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const;
171    QSizeF transposed() const;
172%If (Qt_5_14_0 -)
173    QSizeF grownBy(QMarginsF m) const;
174%End
175%If (Qt_5_14_0 -)
176    QSizeF shrunkBy(QMarginsF m) const;
177%End
178};
179
180QDataStream &operator<<(QDataStream &, const QSizeF & /Constrained/) /ReleaseGIL/;
181QDataStream &operator>>(QDataStream &, QSizeF & /Constrained/) /ReleaseGIL/;
182bool operator==(const QSizeF &s1, const QSizeF &s2);
183bool operator!=(const QSizeF &s1, const QSizeF &s2);
184const QSizeF operator+(const QSizeF &s1, const QSizeF &s2);
185const QSizeF operator-(const QSizeF &s1, const QSizeF &s2);
186const QSizeF operator*(const QSizeF &s, qreal c);
187const QSizeF operator*(qreal c, const QSizeF &s);
188const QSizeF operator/(const QSizeF &s, qreal c);
189