karbon

#include <vtool.h>

Inheritance diagram for VTool:
VPencilTool VPolylineTool

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 TQString uiname ()
virtual TQString contextHelp ()
virtual enumToolType toolType ()
virtual TQString statusText ()
virtual uint priority ()
TQString icon ()
bool mouseEvent (TQMouseEvent *event, const KoPoint &)
bool keyEvent (TQEvent *event)
virtual void refreshUnit ()
virtual void setup (TDEActionCollection *)
TDERadioAction * 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 (TQt::Key)
virtual bool keyReleased (TQt::Key)
virtual void cancel ()
virtual void cancelStep ()
virtual void accept ()
KarbonView * view () const
const KoPoint & first () const
const KoPoint & last () const
bool shiftPressed () const
bool ctrlPressed () const
bool altPressed () const
VToolController * toolController () const

Protected Attributes

TDERadioAction * m_action

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.

Constructor & Destructor Documentation

◆ VTool()

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

Constructs a new tool connected to the specified karbon view.

Parameters
viewthe karbon view the tool is connected to
nameunused

Definition at line 34 of file vtool.cpp.

◆ ~VTool()

VTool::~VTool ( )
virtual

Destroys the tool and unregisters it from the connected part.

Definition at line 44 of file vtool.cpp.

Member Function Documentation

◆ accept()

virtual void VTool::accept ( )
inlineprotectedvirtual

Terminates the current tool drawing (if any).

This event is invoked when Enter/Return is pressed.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 265 of file vtool.h.

◆ action()

TDERadioAction * VTool::action ( ) const
inline

Returns the tool's associated action object.

Returns
the associated action

Definition at line 151 of file vtool.h.

◆ activate

void VTool::activate ( )
virtualslot

Called during the tool activation.

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

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 252 of file vtool.cpp.

◆ altPressed()

bool VTool::altPressed ( ) const
inlineprotected

The status of the alt key.

Returns
true if key is pressed, else false

Definition at line 306 of file vtool.h.

◆ arrowKeyReleased()

virtual void VTool::arrowKeyReleased ( TQt::Key )
inlineprotectedvirtual

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

Definition at line 245 of file vtool.h.

◆ cancel()

virtual void VTool::cancel ( )
inlineprotectedvirtual

Cancels all tool operations.

This event is invoked when ESC is pressed.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 255 of file vtool.h.

◆ cancelStep()

virtual void VTool::cancelStep ( )
inlineprotectedvirtual

Cancels the last tool step (if any).

This event is invoked when Backspace is pressed.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 260 of file vtool.h.

◆ contextHelp()

virtual TQString VTool::contextHelp ( )
inlinevirtual

The context help of the tool.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 98 of file vtool.h.

◆ ctrlPressed()

bool VTool::ctrlPressed ( ) const
inlineprotected

The status of the ctrl key.

Returns
true if key is pressed, else false

Definition at line 299 of file vtool.h.

◆ deactivate()

virtual void VTool::deactivate ( )
inlinevirtual

Deactivates the tool.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 83 of file vtool.h.

◆ draw() [1/2]

virtual void VTool::draw ( )
inlineprotectedvirtual

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 175 of file vtool.h.

◆ draw() [2/2]

virtual void VTool::draw ( VPainter * painter)
inlinevirtual

Draws the actual tool state.

Parameters
painterthe painter on which to paint

Definition at line 158 of file vtool.h.

◆ first()

const KoPoint & VTool::first ( ) const
inlineprotected

Most tools need to know the first mouse coordinate.

Definition at line 280 of file vtool.h.

◆ icon()

TQString VTool::icon ( )
inline

The tool icon name.

Definition at line 119 of file vtool.h.

◆ isDragging()

bool VTool::isDragging ( ) const
inlineprotected

Returns the current dagging state.

Returns
true if the mouse is currently dragged, else false

Definition at line 173 of file vtool.h.

◆ keyEvent()

bool VTool::keyEvent ( TQEvent * 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.cpp.

◆ keyReleased()

virtual bool VTool::keyReleased ( TQt::Key )
inlineprotectedvirtual

Specified key released.

Definition at line 250 of file vtool.h.

◆ last()

const KoPoint & VTool::last ( ) const
inlineprotected

The last mouse coordinate.

Definition at line 285 of file vtool.h.

◆ mouseButtonDblClick()

virtual void VTool::mouseButtonDblClick ( )
inlineprotectedvirtual

Mouse button double click.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 205 of file vtool.h.

◆ mouseButtonPress()

virtual void VTool::mouseButtonPress ( )
inlineprotectedvirtual

Left mouse button press.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 185 of file vtool.h.

◆ mouseButtonRelease()

virtual void VTool::mouseButtonRelease ( )
inlineprotectedvirtual

Left mouse button release.

The mouse wasn't moved.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 195 of file vtool.h.

◆ mouseDrag()

virtual void VTool::mouseDrag ( )
inlineprotectedvirtual

Mouse drag.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 215 of file vtool.h.

◆ mouseDragCtrlPressed()

virtual void VTool::mouseDragCtrlPressed ( )
inlineprotectedvirtual

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

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 230 of file vtool.h.

◆ mouseDragCtrlReleased()

virtual void VTool::mouseDragCtrlReleased ( )
inlineprotectedvirtual

"Ctrl" key released while mouse drag.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 240 of file vtool.h.

◆ mouseDragRelease()

virtual void VTool::mouseDragRelease ( )
inlineprotectedvirtual

Mouse button release.

The mouse was moved before.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 220 of file vtool.h.

◆ mouseDragShiftPressed()

virtual void VTool::mouseDragShiftPressed ( )
inlineprotectedvirtual

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

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 225 of file vtool.h.

◆ mouseDragShiftReleased()

virtual void VTool::mouseDragShiftReleased ( )
inlineprotectedvirtual

"Shift" key released while mouse drag.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 235 of file vtool.h.

◆ mouseEvent()

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

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.cpp.

◆ mouseMove()

virtual void VTool::mouseMove ( )
inlineprotectedvirtual

Mouse move.

No mouse button is pressed.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 210 of file vtool.h.

◆ priority()

virtual uint VTool::priority ( )
inlinevirtual

Position in toolbox.

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

Definition at line 114 of file vtool.h.

◆ refreshUnit()

virtual void VTool::refreshUnit ( )
inlinevirtual

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

Definition at line 138 of file vtool.h.

◆ registerTool()

void VTool::registerTool ( VTool * tool)
virtual

Registers the specified tool at the connected part.

Tools should register themselves by calling this function.

Parameters
toolthe tool to register

Definition at line 54 of file vtool.cpp.

◆ rightMouseButtonPress()

virtual void VTool::rightMouseButtonPress ( )
inlineprotectedvirtual

Right mouse button press.

Definition at line 190 of file vtool.h.

◆ rightMouseButtonRelease()

virtual void VTool::rightMouseButtonRelease ( )
inlineprotectedvirtual

Right mouse button release.

The mouse wasn't moved.

Reimplemented in VPolylineTool.

Definition at line 200 of file vtool.h.

◆ setCursor()

virtual void VTool::setCursor ( ) const
inlineprotectedvirtual

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

Definition at line 180 of file vtool.h.

◆ setup()

virtual void VTool::setup ( TDEActionCollection * )
inlinevirtual

Called after tool creation.

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

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 144 of file vtool.h.

◆ shiftPressed()

bool VTool::shiftPressed ( ) const
inlineprotected

The status of the shift key.

Returns
true if key is pressed, else false

Definition at line 292 of file vtool.h.

◆ showDialog()

virtual bool VTool::showDialog ( ) const
inlinevirtual

Shows the tools option dialog.

Reimplemented in VPencilTool.

Definition at line 88 of file vtool.h.

◆ statusText()

virtual TQString VTool::statusText ( )
inlinevirtual

The tool status text.

Definition at line 108 of file vtool.h.

◆ toolController()

VToolController * VTool::toolController ( ) const
protected

Helper function.

Returns the parent view's toolcontroller.

Definition at line 60 of file vtool.cpp.

◆ toolType()

virtual enumToolType VTool::toolType ( )
inlinevirtual

The tool type.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 103 of file vtool.h.

◆ uiname()

virtual TQString VTool::uiname ( )
inlinevirtual

The name of the tool.

Reimplemented in VPencilTool, and VPolylineTool.

Definition at line 93 of file vtool.h.

◆ view()

KarbonView * VTool::view ( ) const
protected

Returns the connected karbon part.

Returns the connected karbon view.

Definition at line 66 of file vtool.cpp.

Member Data Documentation

◆ m_action

TDERadioAction* VTool::m_action
protected

The tool's action object.

Definition at line 309 of file vtool.h.


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