File: qsgnode.sip

package info (click to toggle)
pyqt5 5.11.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,956 kB
  • sloc: python: 93,806; cpp: 21,390; xml: 285; makefile: 266; sh: 31
file content (335 lines) | stat: -rw-r--r-- 8,839 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
// qsgnode.sip generated by MetaSIP
//
// This file is part of the QtQuick Python extension module.
//
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt5.
// 
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file.  Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
// 
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license.  For more information contact
// info@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


class QSGNode /NoDefaultCtors,Supertype=sip.wrapper/
{
%TypeHeaderCode
#include <qsgnode.h>
%End

%TypeCode
static sipErrorState qsgnode_handle_flags(QSGNode *node, PyObject *self, QSGNode::Flags old_flags)
{
    QSGNode::Flags new_flags = node->flags();
    
    if (node->parent())
    {
        if ((old_flags & QSGNode::OwnedByParent) != (new_flags & QSGNode::OwnedByParent))
        {
            if (old_flags & QSGNode::OwnedByParent)
            {
                sipTransferBack(self);
            }
            else
            {
                PyObject *parent = sipConvertFromType(node->parent(), sipType_QSGNode, 0);

                if (!parent)
                    return sipErrorFail;

                sipTransferTo(self, parent);
                Py_DECREF(parent);
            }
        }
    }
    
    QSGNode::NodeType ntype = node->type();
        
    if (ntype == QSGNode::BasicNodeType || ntype == QSGNode::GeometryNodeType || ntype == QSGNode::ClipNodeType)
    {
        QSGBasicGeometryNode *bg_node = (QSGBasicGeometryNode *)node;
            
        if (bg_node->geometry())
        {
            if ((old_flags & QSGNode::OwnsGeometry) != (new_flags & QSGNode::OwnsGeometry))
            {
                PyObject *geom = sipConvertFromType(bg_node->geometry(), sipType_QSGGeometry, 0);

                if (!geom)
                    return sipErrorFail;

                if (old_flags & QSGNode::OwnsGeometry)
                    sipTransferBack(geom);
                else
                    sipTransferTo(geom, self);

                Py_DECREF(geom);
            }
        }
    }
    
    if (ntype == QSGNode::GeometryNodeType)
    {
        QSGGeometryNode *g_node = (QSGGeometryNode *)node;
            
        if (g_node->material())
        {
            if ((old_flags & QSGNode::OwnsMaterial) != (new_flags & QSGNode::OwnsMaterial))
            {
                PyObject *mat = sipConvertFromType(g_node->material(), sipType_QSGMaterial, 0);

                if (!mat)
                    return sipErrorFail;

                if (old_flags & QSGNode::OwnsMaterial)
                    sipTransferBack(mat);
                else
                    sipTransferTo(mat, self);

                Py_DECREF(mat);
            }
        }

        if (g_node->opaqueMaterial())
        {
            if ((old_flags & QSGNode::OwnsOpaqueMaterial) != (new_flags & QSGNode::OwnsOpaqueMaterial))
            {
                PyObject *omat = sipConvertFromType(g_node->opaqueMaterial(), sipType_QSGMaterial, 0);

                if (!omat)
                    return sipErrorFail;

                if (old_flags & QSGNode::OwnsOpaqueMaterial)
                    sipTransferBack(omat);
                else
                    sipTransferTo(omat, self);

                Py_DECREF(omat);
            }
        }
    }

    return sipErrorNone;
}
%End

%ConvertToSubClassCode
    switch (sipCpp->type())
    {
    case QSGNode::BasicNodeType:
        sipType = sipType_QSGBasicGeometryNode;
        break;
    
    case QSGNode::GeometryNodeType:
        sipType = sipType_QSGGeometryNode;
        break;
    
    case QSGNode::TransformNodeType:
        sipType = sipType_QSGClipNode;
        break;
    
    case QSGNode::ClipNodeType:
        sipType = sipType_QSGTransformNode;
        break;
    
    case QSGNode::OpacityNodeType:
        sipType = sipType_QSGOpacityNode;
        break;
    
    default:
        sipType = 0;
    }
%End

public:
    enum NodeType
    {
        BasicNodeType,
        GeometryNodeType,
        TransformNodeType,
        ClipNodeType,
        OpacityNodeType,
    };

    enum Flag
    {
        OwnedByParent,
        UsePreprocess,
        OwnsGeometry,
        OwnsMaterial,
        OwnsOpaqueMaterial,
    };

    typedef QFlags<QSGNode::Flag> Flags;

    enum DirtyStateBit
    {
        DirtyMatrix,
        DirtyNodeAdded,
        DirtyNodeRemoved,
        DirtyGeometry,
        DirtyMaterial,
        DirtyOpacity,
    };

    typedef QFlags<QSGNode::DirtyStateBit> DirtyState;
    QSGNode();
    virtual ~QSGNode();
    QSGNode *parent() const;
    void removeChildNode(QSGNode *node);
    void removeAllChildNodes();
    void prependChildNode(QSGNode *node /GetWrapper/);
%MethodCode
        sipCpp->prependChildNode(a0);
        
        if (a0->flags() & QSGNode::OwnedByParent)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    void appendChildNode(QSGNode *node /GetWrapper/);
%MethodCode
        sipCpp->appendChildNode(a0);
        
        if (a0->flags() & QSGNode::OwnedByParent)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    void insertChildNodeBefore(QSGNode *node /GetWrapper/, QSGNode *before);
%MethodCode
        sipCpp->insertChildNodeBefore(a0, a1);
        
        if (a0->flags() & QSGNode::OwnedByParent)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    void insertChildNodeAfter(QSGNode *node /GetWrapper/, QSGNode *after);
%MethodCode
        sipCpp->insertChildNodeAfter(a0, a1);
        
        if (a0->flags() & QSGNode::OwnedByParent)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    int childCount() const /__len__/;
    QSGNode *childAtIndex(int i) const;
    QSGNode *firstChild() const;
    QSGNode *lastChild() const;
    QSGNode *nextSibling() const;
    QSGNode *previousSibling() const;
    QSGNode::NodeType type() const;
    void markDirty(QSGNode::DirtyState bits);
    virtual bool isSubtreeBlocked() const;
    QSGNode::Flags flags() const;
    void setFlag(QSGNode::Flag, bool enabled = true);
%MethodCode
        QSGNode::Flags old_flags = sipCpp->flags();
        
        sipCpp->setFlag(a0, a1);
        
        sipError = qsgnode_handle_flags(sipCpp, sipSelf, old_flags);
%End

    void setFlags(QSGNode::Flags, bool enabled = true);
    virtual void preprocess();
};

class QSGBasicGeometryNode : QSGNode /NoDefaultCtors/
{
%TypeHeaderCode
#include <qsgnode.h>
%End

public:
    virtual ~QSGBasicGeometryNode();
    void setGeometry(QSGGeometry *geometry /GetWrapper/);
%MethodCode
        sipCpp->setGeometry(a0);
        
        if (sipCpp->flags() & QSGNode::OwnsGeometry)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    QSGGeometry *geometry();
};

class QSGGeometryNode : QSGBasicGeometryNode /NoDefaultCtors/
{
%TypeHeaderCode
#include <qsgnode.h>
%End

public:
    QSGGeometryNode();
    virtual ~QSGGeometryNode();
    void setMaterial(QSGMaterial *material /GetWrapper/);
%MethodCode
        sipCpp->setMaterial(a0);
        
        if (sipCpp->flags() & QSGNode::OwnsMaterial)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    QSGMaterial *material() const;
    void setOpaqueMaterial(QSGMaterial *material /GetWrapper/);
%MethodCode
        sipCpp->setOpaqueMaterial(a0);
        
        if (sipCpp->flags() & QSGNode::OwnsOpaqueMaterial)
            sipTransferTo(a0Wrapper, sipSelf);
%End

    QSGMaterial *opaqueMaterial() const;
};

class QSGClipNode : QSGBasicGeometryNode /NoDefaultCtors/
{
%TypeHeaderCode
#include <qsgnode.h>
%End

public:
    QSGClipNode();
    virtual ~QSGClipNode();
    void setIsRectangular(bool rectHint);
    bool isRectangular() const;
    void setClipRect(const QRectF &);
    QRectF clipRect() const;
};

class QSGTransformNode : QSGNode /NoDefaultCtors/
{
%TypeHeaderCode
#include <qsgnode.h>
%End

public:
    QSGTransformNode();
    virtual ~QSGTransformNode();
    void setMatrix(const QMatrix4x4 &matrix);
    const QMatrix4x4 &matrix() const;
};

class QSGOpacityNode : QSGNode /NoDefaultCtors/
{
%TypeHeaderCode
#include <qsgnode.h>
%End

public:
    QSGOpacityNode();
    virtual ~QSGOpacityNode();
    void setOpacity(qreal opacity);
    qreal opacity() const;
};

QFlags<QSGNode::DirtyStateBit> operator|(QSGNode::DirtyStateBit f1, QFlags<QSGNode::DirtyStateBit> f2);
QFlags<QSGNode::Flag> operator|(QSGNode::Flag f1, QFlags<QSGNode::Flag> f2);