Krita Source Code Documentation
Loading...
Searching...
No Matches
KoCanvasResourceProvider.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2006, 2011 Boudewijn Rempt (boud@valdyas.org)
3 SPDX-FileCopyrightText: 2007, 2009, 2010 Thomas Zander <zander@kde.org>
4 SPDX-FileCopyrightText: 2008 Carlos Licea <carlos.licea@kdemail.net>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8#ifndef KO_CANVASRESOURCEMANAGER_H
9#define KO_CANVASRESOURCEMANAGER_H
10
11#include <QObject>
12
13#include "kritaflake_export.h"
19
20template<class T> class QSharedPointer;
23
24class KoShape;
25class KoShapeStroke;
26class KoColor;
27class KoUnit;
28
29class QVariant;
30class QSizeF;
31
53class KRITAFLAKE_EXPORT KoCanvasResourceProvider : public QObject
54{
55 Q_OBJECT
56
57public:
59 NoSpecial = 0,
60 NoAdvancedText = 1
61 };
62
67 explicit KoCanvasResourceProvider(QObject *parent = 0);
69
70public Q_SLOTS:
77 void setResource(int key, const QVariant &value);
78
85 void setResource(int key, const KoColor &color);
86
93 void setResource(int key, KoShape *shape);
94
101 void setResource(int key, const KoUnit &unit);
102
109 void setAbstractResource(KoAbstractCanvasResourceInterfaceSP abstractResource);
110
111public:
118 QVariant resource(int key) const;
119
124 void setForegroundColor(const KoColor &color);
125
129 KoColor foregroundColor() const;
130
135 void setBackgroundColor(const KoColor &color);
139 KoColor backgroundColor() const;
140
146 bool boolResource(int key) const;
147
153 int intResource(int key) const;
154
160 KoColor koColorResource(int key) const;
161
167 KoShape *koShapeResource(int key) const;
168
174 QString stringResource(int key) const;
175
181 QSizeF sizeResource(int key) const;
182
188 KoUnit unitResource(int key) const;
189
195 void setHandleRadius(int handleSize);
197 int handleRadius() const;
198
204 void setDecorationThickness(int decorationThickness);
205
210 int decorationThickness() const;
211
217 void setUsingOtherColor(bool usingOtherColor);
218
223 bool isUsingOtherColor() const;
224
230 bool hasResource(int key) const;
231
238 void clearResource(int key);
239
243 void addDerivedResourceConverter(KoDerivedResourceConverterSP converter);
244
248 bool hasDerivedResourceConverter(int key);
249
253 void removeDerivedResourceConverter(int key);
254
258 bool hasAbstractResource(int key);
259
263 void removeAbstractResource(int key);
264
268 void addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator);
269
273 bool hasResourceUpdateMediator(int key);
274
278 void removeResourceUpdateMediator(int key);
279
283 void addActiveCanvasResourceDependency(KoActiveCanvasResourceDependencySP dep);
284
288 bool hasActiveCanvasResourceDependency(int sourceKey, int targetKey) const;
289
293 void removeActiveCanvasResourceDependency(int sourceKey, int targetKey);
294
299 KoCanvasResourcesInterfaceSP canvasResourcesInterface() const;
300
301Q_SIGNALS:
309 void canvasResourceChanged(int key, const QVariant &value);
310
320 void canvasResourceChangeAttempted(int key, const QVariant &value);
321
322private:
325
326 class Private;
327 Private *const d;
328};
329
330#endif
float value(const T *src, size_t ch)
KoCanvasResourceProvider(const KoCanvasResourceProvider &)
void canvasResourceChanged(int key, const QVariant &value)
KoCanvasResourceProvider & operator=(const KoCanvasResourceProvider &)
void canvasResourceChangeAttempted(int key, const QVariant &value)
An abstract class for providing access to canvas resources like current gradient and Fg/Bg colors.