File indexing completed on 2024-06-16 04:12:07

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Dmitry Kazakov <dimula73@gmail.com>
0003  *  SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef __KIS_UNIFORM_PAINT_OP_PROPERTY_H
0009 #define __KIS_UNIFORM_PAINT_OP_PROPERTY_H
0010 
0011 #include <QScopedPointer>
0012 #include <QObject>
0013 
0014 #include "kis_image_export.h"
0015 #include "kis_types.h"
0016 
0017 class KRITAIMAGE_EXPORT KisUniformPaintOpProperty : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     enum Type {
0022         Int = 0,
0023         Double,
0024         Bool,
0025         Combo
0026     };
0027 
0028     /**
0029      * @brief Hint to guess what this property is used for
0030      */
0031     enum SubType {
0032         SubType_None = 0,
0033         SubType_Angle
0034     };
0035 
0036 public:
0037     KisUniformPaintOpProperty(Type type, SubType subType, const KoID &id, KisPaintOpSettingsRestrictedSP settings, QObject *parent);
0038     KisUniformPaintOpProperty(Type type, const KoID &id, KisPaintOpSettingsRestrictedSP settings, QObject *parent);
0039     KisUniformPaintOpProperty(const KoID &id, KisPaintOpSettingsRestrictedSP settings, QObject *parent);
0040     ~KisUniformPaintOpProperty() override;
0041 
0042     QString id() const;
0043     QString name() const;
0044     Type type() const;
0045     SubType subType() const;
0046 
0047     QVariant value() const;
0048 
0049     QWidget *createPropertyWidget();
0050 
0051     KisPaintOpSettingsSP settings() const;
0052 
0053     virtual bool isVisible() const;
0054 
0055 public Q_SLOTS:
0056     void setValue(const QVariant &value);
0057     void requestReadValue();
0058 
0059 Q_SIGNALS:
0060     void valueChanged(const QVariant &value);
0061 
0062 protected:
0063     virtual void readValueImpl();
0064     virtual void writeValueImpl();
0065 
0066 private:
0067     struct Private;
0068     const QScopedPointer<Private> m_d;
0069 };
0070 
0071 template<class T> class QSharedPointer;
0072 template<class T> class QWeakPointer;
0073 template<class T> class QList;
0074 
0075 using KisUniformPaintOpPropertySP = QSharedPointer<KisUniformPaintOpProperty>;
0076 using KisUniformPaintOpPropertyWSP = QWeakPointer<KisUniformPaintOpProperty>;
0077 
0078 #include "kis_callback_based_paintop_property.h"
0079 extern template class KisCallbackBasedPaintopProperty<
0080     KisUniformPaintOpProperty>;
0081 using KisUniformPaintOpPropertyCallback =
0082     KisCallbackBasedPaintopProperty<KisUniformPaintOpProperty>;
0083 
0084 #endif /* __KIS_UNIFORM_PAINT_OP_PROPERTY_H */