1// qsgnode.sip generated by MetaSIP 2// 3// This file is part of the QtQuick 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 QSGNode /Supertype=sip.wrapper/ 24{ 25%TypeHeaderCode 26#include <qsgnode.h> 27%End 28 29%TypeCode 30static sipErrorState qsgnode_handle_flags(QSGNode *node, PyObject *self, QSGNode::Flags old_flags) 31{ 32 QSGNode::Flags new_flags = node->flags(); 33 34 if (node->parent()) 35 { 36 if ((old_flags & QSGNode::OwnedByParent) != (new_flags & QSGNode::OwnedByParent)) 37 { 38 if (old_flags & QSGNode::OwnedByParent) 39 { 40 sipTransferBack(self); 41 } 42 else 43 { 44 PyObject *parent = sipConvertFromType(node->parent(), sipType_QSGNode, 0); 45 46 if (!parent) 47 return sipErrorFail; 48 49 sipTransferTo(self, parent); 50 Py_DECREF(parent); 51 } 52 } 53 } 54 55 QSGNode::NodeType ntype = node->type(); 56 57 if (ntype == QSGNode::BasicNodeType || ntype == QSGNode::GeometryNodeType || ntype == QSGNode::ClipNodeType) 58 { 59 QSGBasicGeometryNode *bg_node = (QSGBasicGeometryNode *)node; 60 61 if (bg_node->geometry()) 62 { 63 if ((old_flags & QSGNode::OwnsGeometry) != (new_flags & QSGNode::OwnsGeometry)) 64 { 65 PyObject *geom = sipConvertFromType(bg_node->geometry(), sipType_QSGGeometry, 0); 66 67 if (!geom) 68 return sipErrorFail; 69 70 if (old_flags & QSGNode::OwnsGeometry) 71 sipTransferBack(geom); 72 else 73 sipTransferTo(geom, self); 74 75 Py_DECREF(geom); 76 } 77 } 78 } 79 80 if (ntype == QSGNode::GeometryNodeType) 81 { 82 QSGGeometryNode *g_node = (QSGGeometryNode *)node; 83 84 if (g_node->material()) 85 { 86 if ((old_flags & QSGNode::OwnsMaterial) != (new_flags & QSGNode::OwnsMaterial)) 87 { 88 PyObject *mat = sipConvertFromType(g_node->material(), sipType_QSGMaterial, 0); 89 90 if (!mat) 91 return sipErrorFail; 92 93 if (old_flags & QSGNode::OwnsMaterial) 94 sipTransferBack(mat); 95 else 96 sipTransferTo(mat, self); 97 98 Py_DECREF(mat); 99 } 100 } 101 102 if (g_node->opaqueMaterial()) 103 { 104 if ((old_flags & QSGNode::OwnsOpaqueMaterial) != (new_flags & QSGNode::OwnsOpaqueMaterial)) 105 { 106 PyObject *omat = sipConvertFromType(g_node->opaqueMaterial(), sipType_QSGMaterial, 0); 107 108 if (!omat) 109 return sipErrorFail; 110 111 if (old_flags & QSGNode::OwnsOpaqueMaterial) 112 sipTransferBack(omat); 113 else 114 sipTransferTo(omat, self); 115 116 Py_DECREF(omat); 117 } 118 } 119 } 120 121 return sipErrorNone; 122} 123%End 124 125%ConvertToSubClassCode 126 switch (sipCpp->type()) 127 { 128 case QSGNode::BasicNodeType: 129 sipType = sipType_QSGBasicGeometryNode; 130 break; 131 132 case QSGNode::GeometryNodeType: 133 sipType = sipType_QSGGeometryNode; 134 break; 135 136 case QSGNode::TransformNodeType: 137 sipType = sipType_QSGClipNode; 138 break; 139 140 case QSGNode::ClipNodeType: 141 sipType = sipType_QSGTransformNode; 142 break; 143 144 case QSGNode::OpacityNodeType: 145 sipType = sipType_QSGOpacityNode; 146 break; 147 148 default: 149 sipType = 0; 150 } 151%End 152 153public: 154 enum NodeType 155 { 156 BasicNodeType, 157 GeometryNodeType, 158 TransformNodeType, 159 ClipNodeType, 160 OpacityNodeType, 161 }; 162 163 enum Flag 164 { 165 OwnedByParent, 166 UsePreprocess, 167 OwnsGeometry, 168 OwnsMaterial, 169 OwnsOpaqueMaterial, 170 }; 171 172 typedef QFlags<QSGNode::Flag> Flags; 173 174 enum DirtyStateBit 175 { 176 DirtyMatrix, 177 DirtyNodeAdded, 178 DirtyNodeRemoved, 179 DirtyGeometry, 180 DirtyMaterial, 181 DirtyOpacity, 182 }; 183 184 typedef QFlags<QSGNode::DirtyStateBit> DirtyState; 185 QSGNode(); 186 virtual ~QSGNode(); 187 QSGNode *parent() const; 188 void removeChildNode(QSGNode *node); 189 void removeAllChildNodes(); 190 void prependChildNode(QSGNode *node /GetWrapper/); 191%MethodCode 192 sipCpp->prependChildNode(a0); 193 194 if (a0->flags() & QSGNode::OwnedByParent) 195 sipTransferTo(a0Wrapper, sipSelf); 196%End 197 198 void appendChildNode(QSGNode *node /GetWrapper/); 199%MethodCode 200 sipCpp->appendChildNode(a0); 201 202 if (a0->flags() & QSGNode::OwnedByParent) 203 sipTransferTo(a0Wrapper, sipSelf); 204%End 205 206 void insertChildNodeBefore(QSGNode *node /GetWrapper/, QSGNode *before); 207%MethodCode 208 sipCpp->insertChildNodeBefore(a0, a1); 209 210 if (a0->flags() & QSGNode::OwnedByParent) 211 sipTransferTo(a0Wrapper, sipSelf); 212%End 213 214 void insertChildNodeAfter(QSGNode *node /GetWrapper/, QSGNode *after); 215%MethodCode 216 sipCpp->insertChildNodeAfter(a0, a1); 217 218 if (a0->flags() & QSGNode::OwnedByParent) 219 sipTransferTo(a0Wrapper, sipSelf); 220%End 221 222 int childCount() const /__len__/; 223 QSGNode *childAtIndex(int i) const; 224 QSGNode *firstChild() const; 225 QSGNode *lastChild() const; 226 QSGNode *nextSibling() const; 227 QSGNode *previousSibling() const; 228 QSGNode::NodeType type() const; 229 void markDirty(QSGNode::DirtyState bits); 230 virtual bool isSubtreeBlocked() const; 231 QSGNode::Flags flags() const; 232 void setFlag(QSGNode::Flag, bool enabled = true); 233%MethodCode 234 QSGNode::Flags old_flags = sipCpp->flags(); 235 236 sipCpp->setFlag(a0, a1); 237 238 sipError = qsgnode_handle_flags(sipCpp, sipSelf, old_flags); 239%End 240 241 void setFlags(QSGNode::Flags, bool enabled = true); 242 virtual void preprocess(); 243 244private: 245 QSGNode(const QSGNode &); 246}; 247 248class QSGBasicGeometryNode : QSGNode /NoDefaultCtors/ 249{ 250%TypeHeaderCode 251#include <qsgnode.h> 252%End 253 254public: 255 virtual ~QSGBasicGeometryNode(); 256 void setGeometry(QSGGeometry *geometry /GetWrapper/); 257%MethodCode 258 sipCpp->setGeometry(a0); 259 260 if (sipCpp->flags() & QSGNode::OwnsGeometry) 261 sipTransferTo(a0Wrapper, sipSelf); 262%End 263 264 QSGGeometry *geometry(); 265}; 266 267class QSGGeometryNode : QSGBasicGeometryNode 268{ 269%TypeHeaderCode 270#include <qsgnode.h> 271%End 272 273public: 274 QSGGeometryNode(); 275 virtual ~QSGGeometryNode(); 276 void setMaterial(QSGMaterial *material /GetWrapper/); 277%MethodCode 278 sipCpp->setMaterial(a0); 279 280 if (sipCpp->flags() & QSGNode::OwnsMaterial) 281 sipTransferTo(a0Wrapper, sipSelf); 282%End 283 284 QSGMaterial *material() const; 285 void setOpaqueMaterial(QSGMaterial *material /GetWrapper/); 286%MethodCode 287 sipCpp->setOpaqueMaterial(a0); 288 289 if (sipCpp->flags() & QSGNode::OwnsOpaqueMaterial) 290 sipTransferTo(a0Wrapper, sipSelf); 291%End 292 293 QSGMaterial *opaqueMaterial() const; 294}; 295 296class QSGClipNode : QSGBasicGeometryNode 297{ 298%TypeHeaderCode 299#include <qsgnode.h> 300%End 301 302public: 303 QSGClipNode(); 304 virtual ~QSGClipNode(); 305 void setIsRectangular(bool rectHint); 306 bool isRectangular() const; 307 void setClipRect(const QRectF &); 308 QRectF clipRect() const; 309}; 310 311class QSGTransformNode : QSGNode 312{ 313%TypeHeaderCode 314#include <qsgnode.h> 315%End 316 317public: 318 QSGTransformNode(); 319 virtual ~QSGTransformNode(); 320 void setMatrix(const QMatrix4x4 &matrix); 321 const QMatrix4x4 &matrix() const; 322}; 323 324class QSGOpacityNode : QSGNode 325{ 326%TypeHeaderCode 327#include <qsgnode.h> 328%End 329 330public: 331 QSGOpacityNode(); 332 virtual ~QSGOpacityNode(); 333 void setOpacity(qreal opacity); 334 qreal opacity() const; 335}; 336 337QFlags<QSGNode::DirtyStateBit> operator|(QSGNode::DirtyStateBit f1, QFlags<QSGNode::DirtyStateBit> f2); 338QFlags<QSGNode::Flag> operator|(QSGNode::Flag f1, QFlags<QSGNode::Flag> f2); 339