libs/flake
KoInteractionStrategy Class Reference
Abstract interface to define what actions a KoInteractionTool can do based on the Strategy design. More...
#include <KoInteractionStrategy.h>

Public Member Functions | |
| virtual | ~KoInteractionStrategy () |
| virtual void | cancelInteraction () |
| virtual QUndoCommand * | createCommand ()=0 |
| virtual void | finishInteraction (Qt::KeyboardModifiers modifiers)=0 |
| virtual void | handleCustomEvent (KoPointerEvent *event) |
| virtual void | handleMouseMove (const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers)=0 |
| virtual void | paint (QPainter &painter, const KoViewConverter &converter) |
Protected Member Functions | |
| KoInteractionStrategy (KoTool *parent, KoCanvasBase *canvas) | |
Protected Attributes | |
| KoCanvasBase * | m_canvas |
| KoTool * | m_parent |
| QList< KoShape * > | m_selectedShapes |
Detailed Description
Abstract interface to define what actions a KoInteractionTool can do based on the Strategy design.
e.g, move, select, transform.
KoInteractionStrategy is a Strategy for the KoInteractionTool and it defines the behavior in case the user clicks or drags the mouse. The strategy is created in the createPolicy() function which defines the resulting behavior and initiates a move or a resize, for example. The mouseMove events are forwarded to the handleMouseMove() method and the interaction is either finished with finishInteraction() or cancelInteraction() (never both).
Definition at line 48 of file KoInteractionStrategy.h.
Constructor & Destructor Documentation
| KoInteractionStrategy::~KoInteractionStrategy | ( | ) | [virtual] |
Destructor.
Definition at line 51 of file KoInteractionStrategy.cpp.
| KoInteractionStrategy::KoInteractionStrategy | ( | KoTool * | parent, | |
| KoCanvasBase * | canvas | |||
| ) | [protected] |
protected constructor. Use the createStrategy method()
Definition at line 45 of file KoInteractionStrategy.cpp.
Member Function Documentation
| void KoInteractionStrategy::cancelInteraction | ( | ) | [virtual] |
This method will undo frames based interactions by calling createCommand() and unexecuting that.
Reimplemented in KoZoomStrategy.
Definition at line 36 of file KoInteractionStrategy.cpp.
| virtual QUndoCommand* KoInteractionStrategy::createCommand | ( | ) | [pure virtual] |
For interactions that are undo-able this method should be implemented to return such a command.
Implementations should return 0 otherwise.
- Returns:
- a command, or 0.
Implemented in KoCreateShapeStrategy, KoParameterChangeStrategy, KoPathConnectionPointStrategy, KoPathControlPointMoveStrategy, KoPathPointMoveStrategy, KoPathSegmentChangeStrategy, and KoShapeRubberSelectStrategy.
| virtual void KoInteractionStrategy::finishInteraction | ( | Qt::KeyboardModifiers | modifiers | ) | [pure virtual] |
Override to make final changes to the data on the end of an interaction.
Implemented in KoCreateShapeStrategy, KoParameterChangeStrategy, KoPathConnectionPointStrategy, KoPathControlPointMoveStrategy, KoPathPointMoveStrategy, KoPathPointRubberSelectStrategy, KoPathSegmentChangeStrategy, KoShapeRubberSelectStrategy, and KoZoomStrategy.
| void KoInteractionStrategy::handleCustomEvent | ( | KoPointerEvent * | event | ) | [virtual] |
Extending classes should implement this method to update the selectedShapes based on the new pointer event.
The default implementations does nothing.
- Parameters:
-
event the new pointer event
Definition at line 56 of file KoInteractionStrategy.cpp.
| virtual void KoInteractionStrategy::handleMouseMove | ( | const QPointF & | mouseLocation, | |
| Qt::KeyboardModifiers | modifiers | |||
| ) | [pure virtual] |
Extending classes should implement this method to update the selectedShapes based on the new mouse position.
- Parameters:
-
mouseLocation the new location in pt modifiers OR-ed set of keys pressed.
Implemented in KoCreateShapeStrategy, KoParameterChangeStrategy, KoPathConnectionPointStrategy, KoPathControlPointMoveStrategy, KoPathPointMoveStrategy, KoPathSegmentChangeStrategy, and KoShapeRubberSelectStrategy.
| virtual void KoInteractionStrategy::paint | ( | QPainter & | painter, | |
| const KoViewConverter & | converter | |||
| ) | [inline, virtual] |
Reimplement this if the action needs to draw a "blob" on the canvas; that is, a transient decoration like a rubber band.
Reimplemented in KoCreateShapeStrategy, and KoShapeRubberSelectStrategy.
Definition at line 58 of file KoInteractionStrategy.h.
Member Data Documentation
KoCanvasBase* KoInteractionStrategy::m_canvas [protected] |
the canvas which contains getters for document-data
Definition at line 99 of file KoInteractionStrategy.h.
KoTool* KoInteractionStrategy::m_parent [protected] |
the KoTool instance that controls this strategy.
Definition at line 97 of file KoInteractionStrategy.h.
QList<KoShape*> KoInteractionStrategy::m_selectedShapes [protected] |
the objects this strategy will act on.
Definition at line 98 of file KoInteractionStrategy.h.
The documentation for this class was generated from the following files:
