F:/KPlato/koffice/libs/flake/KoTool.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 #ifndef KOTOOL_H
00020 #define KOTOOL_H
00021 
00022 #include <QString>
00023 #include <QObject>
00024 #include <QCursor>
00025 
00026 #include <koffice_export.h>
00027 
00028 #include <KoCanvasResourceProvider.h>
00029 
00030 class KoCanvasBase;
00031 class KoPointerEvent;
00032 class KoViewConverter;
00033 
00034 class KActionCollection;
00035 class KRadioAction;
00036 
00037 class QKeyEvent;
00038 class QWidget;
00039 class QPainter;
00040 
00050 class FLAKE_EXPORT KoTool : public QObject
00051 {
00052     Q_OBJECT
00053 public:
00054 
00059     KoTool(KoCanvasBase *canvas );
00060     virtual ~KoTool() {}
00061 
00062 public:
00063 
00068     virtual void repaintDecorations() {};
00069 
00070 public slots:
00086     virtual void activate(bool temporary = false);
00087 
00093     virtual void deactivate();
00094 
00100     virtual void resourceChanged( KoCanvasResource::EnumCanvasResource key, const QVariant & res );
00101 
00102 public:
00103 
00109     virtual bool wantsAutoScroll();
00110 
00117     virtual void paint( QPainter &painter, KoViewConverter &converter ) = 0;
00118 
00127     QWidget * optionWidget();
00128 
00132     virtual QString quickHelp() const { return ""; }
00133 
00134 public: // Events
00135 
00141     virtual void mousePressEvent( KoPointerEvent *event ) = 0;
00142 
00149     virtual void mouseDoubleClickEvent( KoPointerEvent *event );
00150 
00156     virtual void mouseMoveEvent( KoPointerEvent *event ) = 0;
00157 
00163     virtual void mouseReleaseEvent( KoPointerEvent *event ) = 0;
00164 
00171     virtual void keyPressEvent(QKeyEvent *event);
00172 
00179     virtual void keyReleaseEvent(QKeyEvent *event);
00180 
00186     virtual void wheelEvent ( KoPointerEvent * event );
00187 
00188 signals:
00189 
00197     void sigActivateTool(const QString &id );
00198 
00206     void sigActivateTemporary(const QString & id);
00207 
00212     void sigDone();
00213 
00218     void sigCursorChanged(QCursor cursor);
00219 
00220 
00221 
00222 protected:
00231     void useCursor(QCursor cursor, bool force=false);
00232 
00237     virtual void createOptionWidget()
00238         {
00239             m_optionWidget = 0;
00240         }
00241 
00242 protected:
00243 
00244     KoCanvasBase *m_canvas; 
00245     QWidget * m_optionWidget; 
00246 
00247 private:
00248     KoTool();
00249     KoTool(const KoTool&);
00250     KoTool& operator=(const KoTool&);
00251 
00252     QCursor m_previousCursor;
00253 };
00254 
00255 #endif /* KOTOOL_H */

Généré le Wed Nov 22 23:41:00 2006 pour KPlato par  doxygen 1.5.1-p1