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

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002 
00003    Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
00004    Copyright (C) 2006 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 
00022 #ifndef KOINTERACTIONTOOL_H
00023 #define KOINTERACTIONTOOL_H
00024 
00025 #include "KoTool.h"
00026 #include "KoSelection.h"
00027 
00028 #include <koffice_export.h>
00029 
00030 //#include <kstaticdeleter.h>
00031 
00032 #include <QImage>
00033 #include <QTime>
00034 
00035 class KoInteractionStrategy;
00036 class KoShapeMoveCommand;
00037 
00038 #define KoInteractionTool_ID "InteractionTool"
00039 
00048 class FLAKE_EXPORT KoInteractionTool : public KoTool
00049 {
00050 public:
00056     KoInteractionTool( KoCanvasBase *canvas );
00057     virtual ~KoInteractionTool();
00058 
00059 public:
00060 
00061     virtual bool wantsAutoScroll();
00062     virtual void paint( QPainter &painter, KoViewConverter &converter );
00063 
00064     void repaintDecorations();
00073     KoFlake::SelectionHandle handleAt(const QPointF &point, bool *innerHandleMeaning = 0);
00074 
00075 public slots:
00076     void activate(bool temporary = false);
00077 
00078 public: // Events
00079 
00080     virtual void mousePressEvent( KoPointerEvent *event );
00081     virtual void mouseMoveEvent( KoPointerEvent *event );
00082     virtual void mouseReleaseEvent( KoPointerEvent *event );
00083 
00084     virtual void keyPressEvent(QKeyEvent *event);
00085     virtual void keyReleaseEvent(QKeyEvent *event);
00086 
00087 signals:
00088 
00089     void sigActivateTool( const QString &id );
00090     void sigActivateTemporary(const QString &id);
00091     void sigDone();
00092 
00093 
00094 protected:
00095     KoInteractionStrategy *m_currentStrategy; 
00096 
00097 private:
00098     void recalcSelectionBox();
00099     void updateCursor();
00100 
00101     KoInteractionTool(const KoInteractionTool&);
00102     KoInteractionTool& operator=(const KoInteractionTool&);
00103 
00104     QRectF handlesSize();
00105 
00106     // convenience method;
00107     KoSelection * selection();
00108     KoFlake::SelectionHandle m_lastHandle;
00109     bool m_mouseWasInsideHandles;
00110     QPointF m_selectionBox[8];
00111     QPolygonF m_selectionOutline;
00112     QPointF m_lastPoint;
00113     KoShapeMoveCommand *m_moveCommand;
00114     QTime m_lastUsedMoveCommand;
00115 
00116     // TODO alter these 3 arrays to be static const instead
00117     QCursor m_sizeCursors[8];
00118     QCursor m_rotateCursors[8];
00119     QCursor m_shearCursors[8];
00120     double m_angle;
00121 };
00122 
00126 class SelectionDecorator {
00127 public:
00134     SelectionDecorator(KoFlake::SelectionHandle arrows, bool rotationHandles, bool shearHandles);
00135     ~SelectionDecorator() {}
00136 
00142     void paint(QPainter &painter, KoViewConverter &converter);
00143 
00148     void setSelection(KoSelection *selection);
00149 
00150 private:
00151     bool m_rotationHandles, m_shearHandles;
00152     KoFlake::SelectionHandle m_arrows;
00153     KoSelection *m_selection;
00154 
00155     static QImage *s_rotateCursor;
00156 };
00157 
00158 #endif /* KOINTERACTIONTOOL_H */

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