Ipelib: ipe::Tool Class Reference

Ipelib

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ipe::Tool Class Referenceabstract
Ipe canvas

`#include <ipetoolbase.h>`

Inherited by ipe::PanTool, ipe::SelectTool, and ipe::TransformTool.

## Public Member Functions
virtual | ~Tool ()
virtual void | draw (Painter &painter) const =0
virtual void | mouseButton (int button, bool press)
virtual void | mouseMove ()
virtual bool | key (String text, int modifiers)
virtual void | snapVtx (const Vector &mouse, Vector &pos, double &bound, bool cp) const

## Protected Member Functions
| Tool (CanvasBase *canvas)

## Protected Attributes
CanvasBase * | iCanvas

## Detailed Description

Abstract base class for various canvas tools.

The Canvas doesn't know about the various modes for object creation, editing, and moving, but delegates the handling to a subclass of Tool.

## Constructor & Destructor Documentation

## ◆ ~Tool()

Tool::~Tool | ( |  | ) |
| virtual

Virtual destructor.

## ◆ Tool()

Tool::Tool | ( | CanvasBase * | canvas | ) |
| protected

Constructor.

## Member Function Documentation

## ◆ draw()

virtual void ipe::Tool::draw | ( | Painter & | painter | ) | const
| pure virtual

Implemented in ipe::TransformTool, ipe::SelectTool, and ipe::PanTool.

## ◆ mouseButton()

void Tool::mouseButton | ( | int | button,
|  | bool | press
| ) |  |
| virtual

Called when a mouse button is pressed or released on the canvas.

button is 1, 2, or 3, with Shift/Ctrl/Alt/Meta modifiers added in (as defined in CanvasBase::TModifiers. press is true for button-down, and false for button-up.

Reimplemented in ipe::TransformTool, ipe::SelectTool, and ipe::PanTool.

Referenced by Canvas::drawRect(), ipe::Canvas::mouseButton(), and ipe::Canvas::tabletEvent().

## ◆ mouseMove()

void Tool::mouseMove | ( |  | ) |
| virtual

Called when the mouse is moved on the canvas.

Reimplemented in ipe::TransformTool, ipe::SelectTool, and ipe::PanTool.

Referenced by Canvas::mouseMove(), ipe::Canvas::mouseMoveEvent(), and ipe::Canvas::tabletEvent().

## ◆ key()

bool Tool::key | ( | String | text,
|  | int | modifiers
| ) |  |
| virtual

Called when a key is pressed.

modifiers are as defined in CanvasBase::TModifiers.

Reimplemented in ipe::SelectTool.

Referenced by Canvas::key(), and ipe::Canvas::keyPressEvent().

## ◆ snapVtx()

void Tool::snapVtx | ( | const Vector & | mouse,
|  | Vector & | pos,
|  | double & | bound,
|  | bool | cp
| ) |  | const
| virtual

Snapping to vertices on object currently being drawn.

## Member Data Documentation

## ◆ iCanvas

CanvasBase* ipe::Tool::iCanvas
| protected

Referenced by ipe::PanTool::draw(), ipe::SelectTool::draw(), ipe::SelectTool::key(), ipe::PanTool::mouseButton(), ipe::SelectTool::mouseButton(), ipe::TransformTool::mouseButton(), ipe::PanTool::mouseMove(), ipe::SelectTool::mouseMove(), ipe::TransformTool::mouseMove(), ipe::PanTool::PanTool(), ipe::SelectTool::SelectTool(), and ipe::TransformTool::TransformTool().

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

- ipetoolbase.h
- ipetoolbase.cpp