File indexing completed on 2024-12-22 04:12:31

0001 /*
0002  *  SPDX-FileCopyrightText: 2006 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_NODE_SHAPE_H_
0008 #define KIS_NODE_SHAPE_H_
0009 
0010 #include <QObject>
0011 
0012 #include <KoShapeLayer.h>
0013 
0014 #include <kritaui_export.h>
0015 #include <kis_types.h>
0016 
0017 
0018 #define KIS_NODE_SHAPE_ID "KisNodeShape"
0019 
0020 /**
0021  * A KisNodeShape is a flake wrapper around Krita nodes. It is used
0022  * for dealing with currently active node for tools.
0023  */
0024 class KRITAUI_EXPORT KisNodeShape : public QObject, public KoShapeLayer
0025 {
0026     Q_OBJECT
0027 public:
0028     KisNodeShape(KisNodeSP node);
0029     ~KisNodeShape() override;
0030 
0031     KisNodeSP node();
0032 
0033     // Empty implementations as the node is not painted anywhere
0034     QSizeF size() const override;
0035     QRectF boundingRect() const override;
0036     void setPosition(const QPointF &) override;
0037     void paint(QPainter &painter) const override;
0038 
0039 private Q_SLOTS:
0040     void editabilityChanged();
0041 
0042 private:
0043     bool checkIfDescendant(KoShapeLayer *activeLayer);
0044 
0045 private:
0046     struct Private;
0047     Private * const m_d;
0048 };
0049 
0050 #endif