libs/flake
KoTool.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KOTOOL_H
00020 #define KOTOOL_H
00021
00022 #include <QString>
00023 #include <QObject>
00024 #include <QCursor>
00025 #include <QStringList>
00026 #include <QtCore/QRectF>
00027
00028 #include "flake_export.h"
00029
00030 class KoCanvasBase;
00031 class KoPointerEvent;
00032 class KoViewConverter;
00033 class KoToolSelection;
00034 class KoToolPrivate;
00035
00036 class KAction;
00037 class QAction;
00038 class QKeyEvent;
00039 class QWidget;
00040 class QPainter;
00041 class QInputMethodEvent;
00042
00052 class FLAKE_EXPORT KoTool : public QObject
00053 {
00054 Q_OBJECT
00055 public:
00060 explicit KoTool(KoCanvasBase *canvas);
00061 virtual ~KoTool();
00062
00067 virtual void repaintDecorations();
00068
00069 public:
00075 virtual bool wantsAutoScroll();
00076
00083 virtual void paint(QPainter &painter, const KoViewConverter &converter) = 0;
00084
00093 QMap<QString, QWidget *> optionWidgets();
00094
00100 virtual KoToolSelection* selection();
00101
00105 QHash<QString, KAction*> actions() const;
00106
00110 KAction *action(const QString &name) const;
00111
00117 virtual void mousePressEvent(KoPointerEvent *event) = 0;
00118
00125 virtual void mouseDoubleClickEvent(KoPointerEvent *event);
00126
00132 virtual void mouseMoveEvent(KoPointerEvent *event) = 0;
00133
00139 virtual void mouseReleaseEvent(KoPointerEvent *event) = 0;
00140
00147 virtual void keyPressEvent(QKeyEvent *event);
00148
00155 virtual void keyReleaseEvent(QKeyEvent *event);
00156
00162 virtual void wheelEvent(KoPointerEvent *event);
00163
00173 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const;
00174
00182 virtual void inputMethodEvent(QInputMethodEvent *event);
00183
00189 virtual void customPressEvent(KoPointerEvent *event);
00190
00196 virtual void customReleaseEvent(KoPointerEvent *event);
00197
00203 virtual void customMoveEvent(KoPointerEvent *event);
00204
00210 void setToolId(const QString &id);
00211
00217 QString toolId() const;
00218
00220 QCursor cursor() const;
00221
00227 virtual void copy() const;
00228
00234 virtual void deleteSelection();
00235
00242 virtual void cut();
00243
00251 virtual bool paste();
00252
00257 virtual QStringList supportedPasteMimeTypes() const;
00258
00262 QList<QAction*> popupActionList() const;
00263
00265 KoCanvasBase * canvas() const;
00266
00267 public slots:
00285 virtual void activate(bool temporary = false);
00286
00292 virtual void deactivate();
00293
00299 virtual void resourceChanged(int key, const QVariant &res);
00300
00305 void setStatusText(const QString &statusText);
00306
00307 signals:
00308
00315 void activateTool(const QString &id);
00316
00324 void activateTemporary(const QString & id);
00325
00330 void done();
00331
00336 void cursorChanged(const QCursor &cursor);
00337
00342 void selectionChanged(bool hasSelection);
00343
00348 void statusTextChanged(const QString &statusText);
00349
00350 protected:
00359 void useCursor(const QCursor &cursor, bool force = false);
00360
00365 virtual QWidget *createOptionWidget();
00366 virtual QMap<QString, QWidget *> createOptionWidgets();
00367
00377 void addAction(const QString &name, KAction *action);
00378
00384 void setPopupActionList(const QList<QAction*> &list);
00385
00394 QRectF handleGrabRect(const QPointF &position);
00395
00404 QRectF handlePaintRect(const QPointF &position);
00405
00406 protected:
00407 KoCanvasBase * const m_canvas;
00408 friend class KoToolProxy;
00409
00410 private:
00411 KoTool();
00412 KoTool(const KoTool&);
00413 KoTool& operator=(const KoTool&);
00414
00415 KoToolPrivate * const d;
00416 };
00417
00418 #endif
|