Krita Source Code Documentation
Loading...
Searching...
No Matches
KoCanvasBase.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2
3 SPDX-FileCopyrightText: 2006, 2010 Boudewijn Rempt <boud@valdyas.org>
4 SPDX-FileCopyrightText: 2006, 2010 Thomas Zander <zander@kde.org>
5 SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#ifndef KOCANVASBASE_H
11#define KOCANVASBASE_H
12
13#include <QPoint>
14
15#include "kritaflake_export.h"
16
17class KUndo2Command;
18
19class KoUnit;
21class KoShapeManager;
22class KoToolProxy;
23class KoViewConverter;
27class KoShape;
28class KoSnapGuide;
30
31class QWidget;
32class QCursor;
33class QPointF;
34class QRectF;
35class QSizeF;
36
37#include <QObject>
38
44class KRITAFLAKE_EXPORT KoCanvasBase : public QObject
45{
46 Q_OBJECT
47public:
48
54 explicit KoCanvasBase(KoShapeControllerBase *shapeController, KoCanvasResourceProvider *sharedResourceManager = 0);
55 ~KoCanvasBase() override;
56
57public:
58
62 virtual bool canvasIsOpenGL() const { return false; }
63
70 virtual void gridSize(QPointF *offset, QSizeF *spacing) const = 0;
71
76 virtual bool snapToGrid() const = 0;
77
78
85 virtual void setCursor(const QCursor &cursor) = 0;
86
98 virtual void addCommand(KUndo2Command *command) = 0;
99
108 virtual KoShapeManager *shapeManager() const = 0;
109
117
137 return nullptr;
138 }
139
153 Q_UNUSED(source)
154 }
159 virtual void updateCanvas(const QRectF &rc) = 0;
160
166 virtual KoToolProxy *toolProxy() const = 0;
167
172 virtual const KoViewConverter *viewConverter() const = 0;
174
179 virtual QPointF viewToDocument(const QPointF &viewPoint) const;
180
184 virtual QWidget *canvasWidget() = 0;
185
189 virtual const QWidget *canvasWidget() const = 0;
190
196 virtual KoUnit unit() const = 0;
197
207 virtual void clipToDocument(const KoShape *shape, QPointF &move) const;
208
214 virtual QPoint documentOrigin() const {
215 return QPoint(0, 0);
216 }
217
223 virtual void disconnectCanvasObserver(QObject *object);
224
237
243
247 KoCanvasController *canvasController() const;
248
253
255 void setCanvasController(KoCanvasController *controller);
256
257private:
258 // we need a KoShapeControllerBase so that it can work
260
261 class Private;
262 Private * const d;
263};
264
265#endif // KOCANVASBASE_H
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
virtual KoShape * currentShapeManagerOwnerShape() const
the shape that owns the currently active shape manager
virtual void setCurrentShapeManagerOwnerShape(KoShape *source)
sets the group shape that is supposed to be "entered"
virtual KoViewConverter * viewConverter()=0
KoShapeController * shapeController() const
virtual void setCursor(const QCursor &cursor)=0
virtual void gridSize(QPointF *offset, QSizeF *spacing) const =0
virtual KoShapeManager * shapeManager() const =0
virtual const QWidget * canvasWidget() const =0
Private *const d
virtual bool canvasIsOpenGL() const
KoCanvasResourceProvider * resourceManager() const
virtual KoUnit unit() const =0
virtual KoToolProxy * toolProxy() const =0
virtual QPoint documentOrigin() const
virtual const KoViewConverter * viewConverter() const =0
virtual void updateCanvas(const QRectF &rc)=0
virtual void addCommand(KUndo2Command *command)=0
virtual QWidget * canvasWidget()=0
KoSnapGuide * snapGuide() const
virtual KoSelectedShapesProxy * selectedShapesProxy() const =0
selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged...
virtual bool snapToGrid() const =0
The KoSelectedShapesProxy class is a special interface of KoCanvasBase to have a stable connection to...