karbon

VTool Class Reference

#include <vtool.h>

Inheritance diagram for VTool:

VGradientTool VImageTool VPatternTool VPencilTool VPolylineTool VRotateTool VSelectNodesTool VSelectTool VShapeTool VShearTool VTextTool VZoomTool List of all members.

Detailed Description

The base class for all karbon tools.

Each tool has an icon, name and category. Basic mouse event and key handling is implemented here.

Definition at line 51 of file vtool.h.


Public Slots

virtual void activate ()

Public Member Functions

 VTool (KarbonView *view, const char *name)
virtual ~VTool ()
virtual void registerTool (VTool *tool)
virtual void deactivate ()
virtual bool showDialog () const
virtual QString uiname ()
virtual QString contextHelp ()
virtual enumToolType toolType ()
virtual QString statusText ()
virtual uint priority ()
QString icon ()
bool mouseEvent (QMouseEvent *event, const KoPoint &)
bool keyEvent (QEvent *event)
virtual void refreshUnit ()
virtual void setup (KActionCollection *)
KRadioAction * action () const
virtual void draw (VPainter *painter)

Protected Member Functions

bool isDragging () const
virtual void draw ()
virtual void setCursor () const
virtual void mouseButtonPress ()
virtual void rightMouseButtonPress ()
virtual void mouseButtonRelease ()
virtual void rightMouseButtonRelease ()
virtual void mouseButtonDblClick ()
virtual void mouseMove ()
virtual void mouseDrag ()
virtual void mouseDragRelease ()
virtual void mouseDragShiftPressed ()
virtual void mouseDragCtrlPressed ()
virtual void mouseDragShiftReleased ()
virtual void mouseDragCtrlReleased ()
virtual void arrowKeyReleased (Qt::Key)
virtual bool keyReleased (Qt::Key)
virtual void cancel ()
virtual void cancelStep ()
virtual void accept ()
KarbonViewview () const
const KoPoint & first () const
const KoPoint & last () const
bool shiftPressed () const
bool ctrlPressed () const
bool altPressed () const
VToolControllertoolController () const

Protected Attributes

KRadioAction * m_action

Constructor & Destructor Documentation

VTool::VTool ( KarbonView view,
const char *  name 
)

Constructs a new tool connected to the specified karbon view.

Parameters:
view the karbon view the tool is connected to
name unused

Definition at line 34 of file vtool.cc.

VTool::~VTool (  )  [virtual]

Destroys the tool and unregisters it from the connected part.

Definition at line 44 of file vtool.cc.


Member Function Documentation

void VTool::registerTool ( VTool tool  )  [virtual]

Registers the specified tool at the connected part.

Tools should register themselves by calling this function.

Parameters:
tool the tool to register

Definition at line 54 of file vtool.cc.

virtual void VTool::deactivate (  )  [inline, virtual]

Deactivates the tool.

Reimplemented in VImageTool, VZoomTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, and VTextTool.

Definition at line 82 of file vtool.h.

virtual bool VTool::showDialog (  )  const [inline, virtual]

Shows the tools option dialog.

Reimplemented in VEllipseTool, VGradientTool, VPatternTool, VPencilTool, VPolygonTool, VRectangleTool, VRoundRectTool, VSelectTool, VSinusTool, VSpiralTool, VStarTool, and VTextTool.

Definition at line 87 of file vtool.h.

virtual QString VTool::uiname (  )  [inline, virtual]

virtual QString VTool::contextHelp (  )  [inline, virtual]

The context help of the tool.

Reimplemented in VImageTool, VZoomTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, VSelectTool, VShapeTool, and VTextTool.

Definition at line 97 of file vtool.h.

virtual enumToolType VTool::toolType (  )  [inline, virtual]

The tool type.

Reimplemented in VPencilTool, VPolylineTool, VRotateTool, VSelectNodesTool, VSelectTool, VShapeTool, and VShearTool.

Definition at line 102 of file vtool.h.

virtual QString VTool::statusText (  )  [inline, virtual]

The tool status text.

Reimplemented in VImageTool, VZoomTool, VGradientTool, VRotateTool, VSelectNodesTool, VSelectTool, VShapeTool, and VShearTool.

Definition at line 107 of file vtool.h.

virtual uint VTool::priority (  )  [inline, virtual]

Position in toolbox.

Zero means no preferred position, other values indicate the true position.

Reimplemented in VRotateTool, VSelectNodesTool, VSelectTool, and VShearTool.

Definition at line 113 of file vtool.h.

QString VTool::icon (  )  [inline]

The tool icon name.

Definition at line 118 of file vtool.h.

bool VTool::mouseEvent ( QMouseEvent *  event,
const KoPoint &   
)

This function processes every important mouse event.

It then calls suiting functions like mouseMoved() so deriving tools don't need to directly deal with events themselves.

Definition at line 72 of file vtool.cc.

bool VTool::keyEvent ( QEvent *  event  ) 

This function processes every important key event.

It then calls suiting functions like mouseButtonPress() so deriving tools don't need to directly deal with events themselves.

Definition at line 148 of file vtool.cc.

virtual void VTool::refreshUnit (  )  [inline, virtual]

This function is called when the documents unit setting were changed.

Reimplemented in VEllipseTool, VPolygonTool, VRectangleTool, VRoundRectTool, VSelectTool, VSinusTool, VSpiralTool, and VStarTool.

Definition at line 137 of file vtool.h.

virtual void VTool::setup ( KActionCollection *   )  [inline, virtual]

Called after tool creation.

A tool is supposed to hook its associated action into the specified action collection here.

Reimplemented in VImageTool, VZoomTool, VEllipseTool, VGradientTool, VPatternTool, VPencilTool, VPolygonTool, VPolylineTool, VRectangleTool, VRotateTool, VRoundRectTool, VSelectNodesTool, VSelectTool, VShearTool, VSinusTool, VSpiralTool, VStarTool, and VTextTool.

Definition at line 143 of file vtool.h.

KRadioAction* VTool::action (  )  const [inline]

Returns the tool's associated action object.

Returns:
the associated action

Definition at line 150 of file vtool.h.

virtual void VTool::draw ( VPainter painter  )  [inline, virtual]

Draws the actual tool state.

Parameters:
painter the painter on which to paint

Reimplemented in VGradientTool, VPatternTool, and VTextTool.

Definition at line 157 of file vtool.h.

void VTool::activate (  )  [virtual, slot]

Called during the tool activation.

A tool is supposed to set a mouse cursor and/or the statusbar properly here.

Reimplemented in VImageTool, VZoomTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, VRotateTool, VSelectNodesTool, VSelectTool, VShapeTool, VShearTool, and VTextTool.

Definition at line 252 of file vtool.cc.

bool VTool::isDragging (  )  const [inline, protected]

Returns the current dagging state.

Returns:
true if the mouse is currently dragged, else false

Definition at line 172 of file vtool.h.

virtual void VTool::setCursor (  )  const [inline, protected, virtual]

This function is called on each mouse event the tool receives.

Reimplemented in VGradientTool, VPatternTool, VSelectNodesTool, VSelectTool, and VShearTool.

Definition at line 179 of file vtool.h.

virtual void VTool::mouseButtonPress (  )  [inline, protected, virtual]

Left mouse button press.

Reimplemented in VZoomTool, VEllipseTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, VRotateTool, VSelectNodesTool, VSelectTool, VShapeTool, VShearTool, and VTextTool.

Definition at line 184 of file vtool.h.

virtual void VTool::rightMouseButtonPress (  )  [inline, protected, virtual]

Right mouse button press.

Reimplemented in VSelectNodesTool, and VSelectTool.

Definition at line 189 of file vtool.h.

virtual void VTool::mouseButtonRelease (  )  [inline, protected, virtual]

Left mouse button release.

The mouse wasn't moved.

Reimplemented in VImageTool, VZoomTool, VEllipseTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, VSelectNodesTool, VSelectTool, VShapeTool, and VTextTool.

Definition at line 194 of file vtool.h.

virtual void VTool::rightMouseButtonRelease (  )  [inline, protected, virtual]

Right mouse button release.

The mouse wasn't moved.

Reimplemented in VZoomTool, VPolylineTool, VSelectNodesTool, and VSelectTool.

Definition at line 199 of file vtool.h.

virtual void VTool::mouseButtonDblClick (  )  [inline, protected, virtual]

Mouse button double click.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 204 of file vtool.h.

virtual void VTool::mouseMove (  )  [inline, protected, virtual]

Mouse move.

No mouse button is pressed.

Reimplemented in VEllipseTool, VPencilTool, and VPolylineTool.

Definition at line 209 of file vtool.h.

virtual void VTool::mouseDrag (  )  [inline, protected, virtual]

virtual void VTool::mouseDragRelease (  )  [inline, protected, virtual]

Mouse button release.

The mouse was moved before.

Reimplemented in VZoomTool, VEllipseTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, VRotateTool, VSelectNodesTool, VSelectTool, VShapeTool, VShearTool, and VTextTool.

Definition at line 219 of file vtool.h.

virtual void VTool::mouseDragShiftPressed (  )  [inline, protected, virtual]

Mouse drag with "Shift" key pressed at the same time.

Reimplemented in VPencilTool, VPolylineTool, VSelectTool, VShapeTool, and VTextTool.

Definition at line 224 of file vtool.h.

virtual void VTool::mouseDragCtrlPressed (  )  [inline, protected, virtual]

Mouse drag with "Ctrl" key pressed at the same time.

Reimplemented in VPencilTool, VPolylineTool, VSelectTool, and VShapeTool.

Definition at line 229 of file vtool.h.

virtual void VTool::mouseDragShiftReleased (  )  [inline, protected, virtual]

"Shift" key released while mouse drag.

Reimplemented in VPencilTool, VPolylineTool, VSelectTool, VShapeTool, and VTextTool.

Definition at line 234 of file vtool.h.

virtual void VTool::mouseDragCtrlReleased (  )  [inline, protected, virtual]

"Ctrl" key released while mouse drag.

Reimplemented in VPencilTool, VPolylineTool, VSelectTool, and VShapeTool.

Definition at line 239 of file vtool.h.

virtual void VTool::arrowKeyReleased ( Qt::Key   )  [inline, protected, virtual]

"Arrow" key released up, down, left, right

Reimplemented in VPolygonTool, VSelectTool, VSpiralTool, and VStarTool.

Definition at line 244 of file vtool.h.

virtual bool VTool::keyReleased ( Qt::Key   )  [inline, protected, virtual]

Specified key released.

Reimplemented in VZoomTool, VGradientTool, VPatternTool, VSelectNodesTool, and VSelectTool.

Definition at line 249 of file vtool.h.

virtual void VTool::cancel (  )  [inline, protected, virtual]

Cancels all tool operations.

This event is invoked when ESC is pressed.

Reimplemented in VEllipseTool, VGradientTool, VPatternTool, VPencilTool, VPolylineTool, VRotateTool, VSelectNodesTool, VSelectTool, VShapeTool, VShearTool, and VTextTool.

Definition at line 254 of file vtool.h.

virtual void VTool::cancelStep (  )  [inline, protected, virtual]

Cancels the last tool step (if any).

This event is invoked when Backspace is pressed.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 259 of file vtool.h.

virtual void VTool::accept (  )  [inline, protected, virtual]

Terminates the current tool drawing (if any).

This event is invoked when Enter/Return is pressed.

Reimplemented in VPencilTool, VPolylineTool, and VTextTool.

Definition at line 264 of file vtool.h.

KarbonView * VTool::view (  )  const [protected]

Returns the connected karbon view.

Definition at line 66 of file vtool.cc.

const KoPoint& VTool::first (  )  const [inline, protected]

Most tools need to know the first mouse coordinate.

Definition at line 279 of file vtool.h.

const KoPoint& VTool::last (  )  const [inline, protected]

The last mouse coordinate.

Definition at line 284 of file vtool.h.

bool VTool::shiftPressed (  )  const [inline, protected]

The status of the shift key.

Returns:
true if key is pressed, else false

Definition at line 291 of file vtool.h.

bool VTool::ctrlPressed (  )  const [inline, protected]

The status of the ctrl key.

Returns:
true if key is pressed, else false

Definition at line 298 of file vtool.h.

bool VTool::altPressed (  )  const [inline, protected]

The status of the alt key.

Returns:
true if key is pressed, else false

Definition at line 305 of file vtool.h.

VToolController * VTool::toolController (  )  const [protected]

Helper function.

Returns the parent view's toolcontroller.

Definition at line 60 of file vtool.cc.


Member Data Documentation

KRadioAction* VTool::m_action [protected]

The tool's action object.

Definition at line 308 of file vtool.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys