File indexing completed on 2024-05-12 16:01:30

0001 /*
0002  *  SPDX-FileCopyrightText: 2006 Bart Coppens <kde@bartcoppens.be>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_CUSTOM_PATTERN_H_
0008 #define KIS_CUSTOM_PATTERN_H_
0009 
0010 #include <QObject>
0011 #include <QShowEvent>
0012 
0013 #include <KoResourceServer.h>
0014 
0015 #include "ui_wdgcustompattern.h"
0016 
0017 #include <KoPattern.h>
0018 #include <KoResource.h>
0019 
0020 class KisViewManager;
0021 
0022 class KisWdgCustomPattern : public QWidget, public Ui::KisWdgCustomPattern
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     KisWdgCustomPattern(QWidget *parent, const char *name) : QWidget(parent) {
0028         setObjectName(name); setupUi(this);
0029     }
0030 };
0031 
0032 class KisCustomPattern : public KisWdgCustomPattern
0033 {
0034     Q_OBJECT
0035 public:
0036     KisCustomPattern(QWidget *parent, const char* name, const QString& caption, KisViewManager* view);
0037     ~KisCustomPattern() override;
0038 
0039 Q_SIGNALS:
0040     void activatedResource(KoResourceSP);
0041     void patternAdded(KoResourceSP);
0042     void patternUpdated(KoResourceSP);
0043 
0044 private Q_SLOTS:
0045     void slotAddPredefined();
0046     void slotUsePattern();
0047     void slotUpdateCurrentPattern();
0048 
0049 private:
0050     void createPattern();
0051     KisViewManager* m_view {0};
0052     KoPatternSP m_pattern;
0053     KoResourceServer<KoPattern>* m_rServer {0};
0054 };
0055 
0056 
0057 #endif // KIS_CUSTOM_PATTERN_H_