File indexing completed on 2024-10-27 04:07:34
0001 /* 0002 * SPDX-FileCopyrightText: 2007 Sven Langkamp <sven.langkamp@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KIS_SHAPE_SELECTION_MODEL_H 0008 #define KIS_SHAPE_SELECTION_MODEL_H 0009 0010 #include <QObject> 0011 #include <QRect> 0012 #include "KoShapeContainerModel.h" 0013 #include "kis_types.h" 0014 #include "kis_signal_compressor.h" 0015 #include "KisImageResolutionProxy.h" 0016 0017 class KisShapeSelection; 0018 0019 /** 0020 * 0021 */ 0022 class KisShapeSelectionModel: public QObject, public KoShapeContainerModel 0023 { 0024 Q_OBJECT 0025 public: 0026 KisShapeSelectionModel(KisImageResolutionProxySP resolutionProxy, KisSelectionWSP selection, KisShapeSelection* shapeSelection); 0027 ~KisShapeSelectionModel() override; 0028 0029 void add(KoShape *child) override; 0030 void remove(KoShape *child) override; 0031 0032 void setUpdatesEnabled(bool enabled); 0033 bool updatesEnabled() const; 0034 0035 void setClipped(const KoShape *child, bool clipping) override; 0036 bool isClipped(const KoShape *child) const override; 0037 void setInheritsTransform(const KoShape *shape, bool inherit) override; 0038 bool inheritsTransform(const KoShape *shape) const override; 0039 0040 int count() const override; 0041 QList<KoShape*> shapes() const override; 0042 0043 void containerChanged(KoShapeContainer *, KoShape::ChangeType) override; 0044 void childChanged(KoShape * child, KoShape::ChangeType type) override; 0045 void setShapeSelection(KisShapeSelection* selection); 0046 0047 void setResolutionProxy(KisImageResolutionProxySP newResolutionProxy); 0048 KisImageResolutionProxySP resolutionProxy() const; 0049 0050 private Q_SLOTS: 0051 void requestUpdate(const QRect &updateRect); 0052 0053 private: 0054 QMap<KoShape*, QRectF> m_shapeMap; 0055 KisImageResolutionProxySP m_resolutionProxy; 0056 KisSelectionWSP m_parentSelection; 0057 KisShapeSelection* m_shapeSelection; 0058 0059 bool m_updatesEnabled; 0060 }; 0061 0062 #endif