Krita Source Code Documentation
Loading...
Searching...
No Matches
KoToolProxy.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 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8#ifndef _KO_TOOL_PROXY_H_
9#define _KO_TOOL_PROXY_H_
10
11#include "kritaflake_export.h"
12
13#include <QObject>
14
15class QAction;
16class QAction;
17class QMouseEvent;
18class QKeyEvent;
19class QWheelEvent;
20class QTabletEvent;
21class KoCanvasBase;
22class KoViewConverter;
23class KoToolBase;
25class QInputMethodEvent;
26class KoPointerEvent;
27class QDragMoveEvent;
28class QDragLeaveEvent;
29class QDropEvent;
30class QTouchEvent;
31class QFocusEvent;
32class QPainter;
33class QPointF;
34class QMenu;
36
47class KRITAFLAKE_EXPORT KoToolProxy : public QObject
48{
49 Q_OBJECT
50public:
56 explicit KoToolProxy(KoCanvasBase *canvas, QObject *parent = 0);
57 ~KoToolProxy() override;
58
60 void paint(QPainter &painter, const KoViewConverter &converter);
61
63 void repaintDecorations();
64
66 void tabletEvent(QTabletEvent *event, const QPointF &point);
67
69 void mousePressEvent(QMouseEvent *event, const QPointF &point);
70 void mousePressEvent(KoPointerEvent *event);
71
73 void mouseDoubleClickEvent(QMouseEvent *event, const QPointF &point);
74 void mouseDoubleClickEvent(KoPointerEvent *event);
75
77 void mouseMoveEvent(QMouseEvent *event, const QPointF &point);
78 void mouseMoveEvent(KoPointerEvent *event);
79
81 void mouseReleaseEvent(QMouseEvent *event, const QPointF &point);
82 void mouseReleaseEvent(KoPointerEvent *event);
83
85 void keyPressEvent(QKeyEvent *event);
86
88 void keyReleaseEvent(QKeyEvent *event);
89
91 void explicitUserStrokeEndRequest();
92
94 QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
95
97 void inputMethodEvent(QInputMethodEvent *event);
98
100 void focusInEvent(QFocusEvent *event);
101
103 void focusOutEvent(QFocusEvent *event);
104
106 QMenu* popupActionsMenu();
107
109 KisPopupWidgetInterface* popupWidget();
110
112 void deleteSelection();
113
116 void processEvent(QEvent *) const;
117
119 bool hasSelection() const;
120
122 void cut();
123
125 void copy() const;
126
128 bool paste();
129
131 bool selectAll();
132
134 void deselect();
135
137 void dragMoveEvent(QDragMoveEvent *event, const QPointF &point);
138
140 void dragLeaveEvent(QDragLeaveEvent *event);
141
143 void dropEvent(QDropEvent *event, const QPointF &point);
144
146 virtual void setActiveTool(KoToolBase *tool);
147
148 void touchEvent(QTouchEvent* event, const QPointF& point);
149
150 KoPointerEvent* lastDeliveredPointerEvent() const;
151
152 QVector<QKeySequence> toolPriorityShortcuts() const;
153
155 KoToolProxyPrivate *priv();
156
157protected Q_SLOTS:
159 void requestUndoDuringStroke();
160
162 void requestRedoDuringStroke();
163
165 void requestStrokeCancellation();
166
168 void requestStrokeEnd();
169
170Q_SIGNALS:
175 void selectionChanged(bool hasSelection);
176
182 void toolChanged(const QString &toolId);
183
184protected:
185 virtual QPointF widgetToDocument(const QPointF &widgetPoint) const = 0;
186 virtual QPointF documentToWidget(const QPointF &documentPoint) const = 0;
187 KoCanvasBase* canvas() const;
188
189
190private:
191 Q_PRIVATE_SLOT(d, void timeout())
192 Q_PRIVATE_SLOT(d, void selectionChanged(bool))
193
194 void countMultiClick(KoPointerEvent *ev, int eventType);
195
196 friend class KoToolProxyPrivate;
198};
199
200#endif // _KO_TOOL_PROXY_H_
The PopupWidgetInterface abstract class defines the basic interface that will be used by all popup wi...
virtual QPointF widgetToDocument(const QPointF &widgetPoint) const =0
virtual QPointF documentToWidget(const QPointF &documentPoint) const =0
void toolChanged(const QString &toolId)
void selectionChanged(bool hasSelection)
void processEvent(NSEvent *event)