File indexing completed on 2024-05-12 16:02:10
0001 /* 0002 * Made by Tomislav Lukman (tomislav.lukman@ck.tel.hr) 0003 * SPDX-FileCopyrightText: 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com> 0004 * SPDX-FileCopyrightText: 2019 Boudewijn Rempt <boud@valdyas.org> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KORESOURCEPOPUPACTION_H 0010 #define KORESOURCEPOPUPACTION_H 0011 0012 #include <QAction> 0013 0014 #include <QSharedPointer> 0015 0016 #include <KoResource.h> 0017 0018 class KoShapeBackground; 0019 class QModelIndex; 0020 0021 class KoCanvasResourcesInterface; 0022 using KoCanvasResourcesInterfaceSP = QSharedPointer<KoCanvasResourcesInterface>; 0023 0024 #include "kritawidgets_export.h" 0025 0026 class KRITAWIDGETS_EXPORT KoResourcePopupAction : public QAction 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 /** 0032 * Constructs a KoResourcePopupAction (gradient or pattern) with the specified parent. 0033 * 0034 * @param gradientResourceAdapter pointer to the gradient or pattern 0035 * @param parent The parent for this action. 0036 */ 0037 explicit KoResourcePopupAction(const QString &resourceType, KoCanvasResourcesInterfaceSP canvasResourcesInterface, QObject *parent = 0); 0038 0039 /** 0040 * Destructor 0041 */ 0042 ~KoResourcePopupAction() override; 0043 0044 QSharedPointer<KoShapeBackground> currentBackground() const; 0045 void setCurrentBackground(QSharedPointer<KoShapeBackground> background); 0046 0047 void setCurrentResource(KoResourceSP resource); 0048 KoResourceSP currentResource() const; 0049 0050 void setCanvasResourcesInterface(KoCanvasResourcesInterfaceSP canvasResourcesInterface); 0051 0052 Q_SIGNALS: 0053 /// Emitted when a resource was selected 0054 void resourceSelected(QSharedPointer<KoShapeBackground> background); 0055 0056 public Q_SLOTS: 0057 void updateIcon(); 0058 0059 private Q_SLOTS: 0060 void indexChanged(const QModelIndex &modelIndex); 0061 0062 private: 0063 class Private; 0064 Private * const d; 0065 }; 0066 0067 #endif /* KORESOURCEPOPUPACTION_H */