libs/flake

KoToolProxy.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
00004  * Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 #ifndef _KO_TOOL_PROXY_H_
00022 #define _KO_TOOL_PROXY_H_
00023 
00024 #include <KoViewConverter.h>
00025 #include "flake_export.h"
00026 
00027 #include <QPainter>
00028 
00029 class KAction;
00030 class QAction;
00031 class QMouseEvent;
00032 class QKeyEvent;
00033 class QWheelEvent;
00034 class QTabletEvent;
00035 class KoToolSelection;
00036 class KoTool;
00037 class KoCanvasBase;
00038 class KoCanvasController;
00039 class QInputMethodEvent;
00040 
00050 class FLAKE_EXPORT KoToolProxy : public QObject
00051 {
00052     Q_OBJECT
00053 public:
00059     explicit KoToolProxy(KoCanvasBase *canvas, QObject *parent = 0);
00060     ~KoToolProxy();
00061 
00063     void paint(QPainter &painter, const KoViewConverter &converter);
00065     void repaintDecorations();
00067     void tabletEvent(QTabletEvent *event, const QPointF &point);
00069     void mousePressEvent(QMouseEvent *event, const QPointF &point);
00071     void mouseDoubleClickEvent(QMouseEvent *event, const QPointF &point);
00073     void mouseMoveEvent(QMouseEvent *event, const QPointF &point);
00075     void mouseReleaseEvent(QMouseEvent *event, const QPointF &point);
00077     void keyPressEvent(QKeyEvent *event);
00079     void keyReleaseEvent(QKeyEvent *event);
00081     void wheelEvent(QWheelEvent * event, const QPointF &point);
00083     QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const;
00085     void inputMethodEvent(QInputMethodEvent *event);
00087     QList<QAction*> popupActionList() const;
00089     void deleteSelection();
00090 
00095     QHash<QString, KAction*> actions() const;
00096 
00100     KoToolSelection* selection();
00101 
00103     void cut();
00105     void copy() const;
00107     bool paste();
00109     QStringList supportedPasteMimeTypes() const;
00111     void setActiveTool(KoTool *tool);
00112 
00113 signals:
00118     void selectionChanged(bool hasSelection);
00119 
00125     void toolChanged(const QString &toolId);
00126 
00127 protected:
00128     friend class KoToolManager;
00130     void setCanvasController(KoCanvasController *controller);
00131 
00132 private:
00133     Q_PRIVATE_SLOT(d, void timeout())
00134     Q_PRIVATE_SLOT(d, void selectionChanged(bool))
00135 
00136     class Private;
00137     Private * const d;
00138 };
00139 
00140 
00141 #endif // _KO_TOOL_PROXY_H_