NShape Reference
Tool Class

<< Click to Display Table of Contents >>

Navigation:  Class Reference > Namespace Dataweb.NShape >

NShape Reference
Tool Class

Previous pageReturn to chapter overviewNext page

Controls a user operation on a diagram.

Syntax

public class Tool: IDisposable

Description

A tool is the strategy class of a complex user operation, like dragging a resize grid or placing a new shape on a diagram. It receives the user activities through its ProcessMouseEvent and ProcessKeyEvent methods.

Public Properties

Name

Description

Category

Specifies a tool category. used for grouping tools in categories in the ToolSetPresenter.

Description

Specifies a culture depending description for the tool.

DoubleClickTime

Specifies the interval (in ms) used for determine if two subsequent clicks are interpreted as double click.

IsToolActionPending

Specifies whether the tool has a pending action.

LargeIcon

Specifies a large culture invariant icon to display the tool.

MinimumDragDistance

Specifies the distance (in pixels) the mouse has to move while a button is pressed before a drag action starts.
This setting is read from the OS.

Name

Specifies the culture invariant name of the tool.

SmallIcon

Specifies a small culture invariant icon to display the tool.

Title

Specifies a culture depending title of the tool.

ToolActionPending

Same as IsToolActionPending.

Obsolete in NShape 2.0

ToolTipText

Specifies a culture depending tool tip text for the tool.

WantsAutoScroll

Specifies whether the display should scroll while dragging objects with the mouse.

Public Methods

Name

Description

Cancel

Cancels the tool execution.

Draw

Draws the tool into the IDiagramPresenter's display.

EnterDisplay

Notifies the tool that the mouse pointer has entered an IDiagramPresenter's display.

GetMenuItemDefs

Returns a collection of MenuItemDefs for constructing a context menu.

Invalidate

Invalidates the tool in the IDiagramPresenter's display.

LeaveDisplay

Notifies the tool that the mouse pointer is leaving an IDiagramPresenter's display.

ProcessKeyEvent

Processes a key event.

ProcessMouseEvent

Processes a mouse event.

RefreshIcons

Refreshes the tool's icons used in the tool box.

Protected Methods

Name

Description

CancelCore

Perform all necessary actions to cancel the current tool actions.

CanConnectTo

Indicates whether the given shape can connect to the given targetShape with the specified glue point.

DeletePreviewShape

Disconnect, disposes and deletes the given preview Dataweb.NShape.Advanced.Shape.

DrawConnectionTargets

Draws all connection targets in range.

EndToolAction

Ends a tool's action.

When overriding this method, the base class' implementation has to be called at last.

FindConnectionTarget

Find the topmost shape that is not selected and has a valid ConnectionPoint (or ReferencePoint) in range of the given point.

FindNearestControlPoint

Finds the nearest ControlPoint in range of the given shape's ControlPoint. If there is no ControlPoint in range, the snap distance to the nearest grid line will be calculated.

FindNearestSnapPoint

Finds the nearest snap point for a point.

FindShapeAtCursor

Find the topmost shape that is at the given point or has a control point with the given capabilities in range of the given point. If parameter onlyUnselected is true, only shapes that are not selected will be returned.

FindVisibleShapes

Finds all shapes that meet the given requirements and are *not* invisible due to layer restrictions.

GetResizeModifier

Returns the resize modifiers that have to be applied.

InvalidateConnectionTargets

Invalidates all connection targets in range.

IsGripHit

Indicates whether a grip was hit.

OnToolExecuted

Called when a tool action has finished. Raises the ToolExecuted event.

StartToolAction

Sets the start coordinates for an action as well as the display to use for the action.

Tool

Constructor

Derived Classes

Some frequently used derived classes are:

PointerTool

TemplateTool

Requirements

Namespace: Dataweb.NShape.Advanced

Assembly: Dataweb.NShape