libs/flake

KoCreateShapesTool Class Reference

A tool to create shapes with. More...

#include <KoCreateShapesTool.h>

Inheritance diagram for KoCreateShapesTool:

List of all members.

Public Member Functions

 KoCreateShapesTool (KoCanvasBase *canvas)
virtual ~KoCreateShapesTool ()
virtual void activate (bool temporary=false)
virtual void mouseReleaseEvent (KoPointerEvent *event)
void paint (QPainter &painter, const KoViewConverter &converter)
void setShapeId (const QString &id)
void setShapeProperties (KoProperties *properties)
const QStringshapeId () const
KoProperties const * shapeProperties ()

Protected Member Functions

virtual KoInteractionStrategycreateStrategy (KoPointerEvent *event)

Detailed Description

A tool to create shapes with.

Definition at line 39 of file KoCreateShapesTool.h.


Constructor & Destructor Documentation

KoCreateShapesTool::KoCreateShapesTool ( KoCanvasBase canvas  )  [explicit]

Create a new tool; typically not called by applications, only by the KoToolManager.

Parameters:
canvas the canvas this tool works for.

Definition at line 41 of file KoCreateShapesTool.cpp.

KoCreateShapesTool::~KoCreateShapesTool (  )  [virtual]

destructor

Definition at line 47 of file KoCreateShapesTool.cpp.


Member Function Documentation

void KoCreateShapesTool::activate ( bool  temporary = false  )  [virtual]

This method is called when this tool instance is activated.

For any main window there is only one tool active at a time, which then gets all user input. Switching between tools will call deactivate on one and activate on the new tool allowing the tool to flush items (like a selection) when it is not in use.

There is one case where two tools are activated at the same. This is the case where one tool delegates work to another temporarily. For example, while shift is being held down. The second tool will get activated with temporary=true and it should emit done() when the state that activated it is ended.

One of the important tasks of activate is to call useCursor()

Parameters:
temporary if true, this tool is only temporarily actived and should emit done when it is done.
See also:
deactivate()

Reimplemented from KoTool.

Definition at line 64 of file KoCreateShapesTool.cpp.

KoInteractionStrategy * KoCreateShapesTool::createStrategy ( KoPointerEvent event  )  [protected, virtual]

Reimplement this factory method to create your strategy to be used for mouse interaction.

Returns:
a new strategy, or 0 when there is nothing to do.

Implements KoInteractionTool.

Definition at line 89 of file KoCreateShapesTool.cpp.

void KoCreateShapesTool::mouseReleaseEvent ( KoPointerEvent event  )  [virtual]

Called when (one of) the mouse or stylus buttons is released.

Implementors should call event->ignore() if they do not actually use the event.

Parameters:
event state and reason of this mouse or stylus release

Reimplemented from KoInteractionTool.

Definition at line 58 of file KoCreateShapesTool.cpp.

void KoCreateShapesTool::paint ( QPainter painter,
const KoViewConverter converter 
) [virtual]

Called by the canvas to paint any decorations that the tool deems needed.

The painter has the top left of the canvas as its origin.

Parameters:
painter used for painting the shape
converter to convert between internal and view coordinates.

Reimplemented from KoInteractionTool.

Definition at line 52 of file KoCreateShapesTool.cpp.

void KoCreateShapesTool::setShapeId ( const QString id  ) 

Each shape-type has an Id; as found in KoShapeFactory::id().id(), to choose which shape this controller should actually create; set the id before the user starts to create the new shape.

Parameters:
id the SHAPEID of the to be generated shape

Definition at line 69 of file KoCreateShapesTool.cpp.

void KoCreateShapesTool::setShapeProperties ( KoProperties *  properties  ) 

Set the shape properties that the create controller will use for the next shape it will create.

Parameters:
properties the properties or 0 if the default shape should be created.

Definition at line 79 of file KoCreateShapesTool.cpp.

const QString & KoCreateShapesTool::shapeId (  )  const

return the shape Id that is to be created.

Returns:
the shape Id that is to be created.

Definition at line 74 of file KoCreateShapesTool.cpp.

KoProperties const * KoCreateShapesTool::shapeProperties (  ) 

return the properties to be used for creating the next shape

Returns:
the properties to be used for creating the next shape

Definition at line 84 of file KoCreateShapesTool.cpp.


The documentation for this class was generated from the following files: