Class ToolManager
This special Tool is responsible for managing all of the Diagram's
mode-less tools, which you can access as the Tool
Mode-less tools are tools that are present in one of the following lists:
Mouse
Namespace: Northwoods.Go.Tools
Assembly: Northwoods.GoDiagram.Avalonia.dll
Syntax
public class ToolManager : Tool
Remarks
When this tool is running as the current tool, it handles mouse-down,
mouse-move, and mouse-up events and the corresponding touch events.
For each event it iterates over each of the tools in the corresponding list,
calling the tool's Can
Because this tool is typically the one running as the diagram's current tool when the user isn't "doing" anything, this tool can also handle other events, such as mouse wheel events and keyboard commands.
Keyboard events are just passed on to the Command
This tool also is responsible for showing tooltips.
Tooltip Adornments may be declared as any Tool
This tool does not utilize any tool handles. This tool does not conduct any transactions. But of course some of the tools that the ToolManager starts can show tool handles and/or conduct their own transactions.
Constructors
ToolManager()
You do not normally need to create an instance of this tool
because one already exists as the Tool
The Name of this tool is "ToolManager".
Declaration
public ToolManager()
Remarks
The constructor produces a ToolManager that manages no tools.
Call Initialize
Properties
ActionTool
Gets or sets the mode-less Action
Declaration
public ActionTool ActionTool { get; set; }
Property Value
Type | Description |
---|---|
Action |
Remarks
You can disable this tool by setting its Is
ClickCreatingTool
Gets or sets the mode-less Click
Declaration
public ClickCreatingTool ClickCreatingTool { get; set; }
Property Value
Type | Description |
---|---|
Click |
Remarks
You can disable this tool by setting its Is
ClickSelectingTool
Gets or sets the mode-less Click
Declaration
public ClickSelectingTool ClickSelectingTool { get; set; }
Property Value
Type | Description |
---|---|
Click |
Remarks
You can disable this tool by setting its Is
ContextMenuTool
Gets or sets the mode-less Context
Declaration
public ContextMenuTool ContextMenuTool { get; set; }
Property Value
Type | Description |
---|---|
Context |
Remarks
You can disable this tool by setting its Is
CurrentToolTip
This read-only property returns the currently showing tooltip, or null if there is none.
Declaration
public IShowHidable CurrentToolTip { get; }
Property Value
Type | Description |
---|---|
IShow |
DraggingTool
Gets or sets the mode-less Dragging
Declaration
public DraggingTool DraggingTool { get; set; }
Property Value
Type | Description |
---|---|
Dragging |
Remarks
You can disable this tool by setting its Is
DragSelectingTool
Gets or sets the mode-less Drag
Declaration
public DragSelectingTool DragSelectingTool { get; set; }
Property Value
Type | Description |
---|---|
Drag |
Remarks
You can disable this tool by setting its Is
DragSize
Gets or sets the distance in view coordinates within which a mouse down-and-up is considered a click and beyond which a mouse movement is considered a drag.
Declaration
public Size DragSize { get; set; }
Property Value
Type | Description |
---|---|
Size |
Remarks
The default value is 2 pixels horizontally and vertically for mouse events, and increases by 6 pixels for touch events.
This value is used by Is
GestureBehavior
Gets or sets the ToolManager's touch pinching behavior. Allowed values are Zoom and Cancel and None.
Declaration
public GestureMode GestureBehavior { get; set; }
Property Value
Type | Description |
---|---|
Gesture |
Remarks
The default value is Zoom.
If you want to control whether a single finger touch movement
causes a pan (i.e. scroll) of the diagram's contents or scrolls the page,
consider either disabling the Panning
HoldDelay
Gets or sets the time between when the mouse stops moving and a hold event, in milliseconds.
Declaration
public double HoldDelay { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 850 milliseconds.
HoverDelay
Gets or sets the time between when the mouse stops moving and a hover event, in milliseconds.
Declaration
public double HoverDelay { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
This value affects the delay before Tool
The default value is 850 milliseconds.
Set Tool
LinkingTool
Gets or sets the mode-less Linking
Declaration
public LinkingTool LinkingTool { get; set; }
Property Value
Type | Description |
---|---|
Linking |
Remarks
You can disable this tool by setting its Is
LinkReshapingTool
Gets or sets the mode-less Link
Declaration
public LinkReshapingTool LinkReshapingTool { get; set; }
Property Value
Type | Description |
---|---|
Link |
Remarks
You can disable this tool by setting its Is
MouseDownTools
This read-only property returns the list of Tools that might be started upon a mouse or finger press event.
Declaration
public IList<Tool> MouseDownTools { get; }
Property Value
Remarks
When the ToolManager handles a mouse-down or touch-down event in Do
This list may be modified, but it must not be modified while any tool is handling events.
Initialize
MouseMoveTools
This read-only property returns the list of Tools that might be started upon a mouse or finger move event.
Declaration
public IList<Tool> MouseMoveTools { get; }
Property Value
Remarks
When the ToolManager handles a mouse-move or touch-move event in Do
This list may be modified, but it must not be modified while any tool is handling events.
Initialize
MouseUpTools
This read-only property returns the list of Tools that might be started upon a mouse or finger up event.
Declaration
public IList<Tool> MouseUpTools { get; }
Property Value
Remarks
When the ToolManager handles a mouse-up or touch-up event in Do
This list may be modified, but it must not be modified while any tool is handling events.
Initialize
MouseWheelBehavior
Gets or sets the ToolManager's mouse wheel behavior. Allowed values are Scroll and
Zoom and Wheel
Declaration
public WheelMode MouseWheelBehavior { get; set; }
Property Value
Type | Description |
---|---|
Wheel |
Remarks
The default value is Scroll.
PanningTool
Gets or sets the mode-less Panning
Declaration
public PanningTool PanningTool { get; set; }
Property Value
Type | Description |
---|---|
Panning |
Remarks
You can disable this tool by setting its Is
RelinkingTool
Gets or sets the mode-less Relinking
Declaration
public RelinkingTool RelinkingTool { get; set; }
Property Value
Type | Description |
---|---|
Relinking |
Remarks
You can disable this tool by setting its Is
ResizingTool
Gets or sets the mode-less Resizing
Declaration
public ResizingTool ResizingTool { get; set; }
Property Value
Type | Description |
---|---|
Resizing |
Remarks
You can disable this tool by setting its Is
RotatingTool
Gets or sets the mode-less Rotating
Declaration
public RotatingTool RotatingTool { get; set; }
Property Value
Type | Description |
---|---|
Rotating |
Remarks
You can disable this tool by setting its Is
TextEditingTool
Gets or sets the mode-less Text
Declaration
public TextEditingTool TextEditingTool { get; set; }
Property Value
Type | Description |
---|---|
Text |
Remarks
You can disable this tool by setting its Is
ToolTipDuration
Gets or sets how long a tool tip is visible.
Declaration
public double ToolTipDuration { get; set; }
Property Value
Type | Description |
---|---|
double |
Remarks
The default value is 5000 milliseconds.
This is used by Show
Set Hover
Methods
DoKeyDown()
This just calls Do
Declaration
public override void DoKeyDown()
Overrides
Remarks
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoKeyUp()
This just calls Do
Declaration
public override void DoKeyUp()
Overrides
Remarks
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoMouseDown()
Iterate over the Mouse
Declaration
public override void DoMouseDown()
Overrides
Remarks
Starting a tool replaces the Current
Not finding any startable tools causes this tool manager to activate,
thereby enabling the mouse-move and mouse-up behaviors and starts
detection of a mouse-hold event after Hold
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoMouseHover()
Implement the standard behavior for mouse hover and mouse hold events,
called by Do
Declaration
public virtual void DoMouseHover()
Remarks
If there has been no mouse down, the timer is set for Hover
If there had been a mouse down, the timer is set for Hold
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoMouseMove()
Iterate over the Mouse
Declaration
public override void DoMouseMove()
Overrides
Remarks
Starting a tool replaces the Current
If no tool is found and activated, this:
- Calls Standard
Mouse to invoke any mouse-enter, mouse-over, or mouse-leave functions.Over() - If the mouse has moved sufficiently, such that Is
Beyond is true, this also calls StandardDrag Size(Point?, Point?) Wait for a possible call to DoAfter(double, Input Event) Wait after HoverAfter(Input Event) Delay milliseconds. - Sets the Last
Input to bubble.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoMouseUp()
Iterate over the Mouse
Declaration
public override void DoMouseUp()
Overrides
Remarks
Starting a tool replaces the Current
If no startable tool is found it deactivates this tool manager, to get ready for a mouse-down and ignore mouse-move and mouse-up events.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoMouseWheel()
The diagram will call this method as the mouse wheel is rotated.
Declaration
public override void DoMouseWheel()
Overrides
Remarks
By default this just calls Standard
DoToolTip()
Implement the standard behavior for tooltips,
called by Do
Declaration
public virtual void DoToolTip()
Remarks
This looks for a Graph
If it didn't find any object, this looks for a Tool
If it eventually finds a tooltip, this calls Show
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
DoWaitAfter(InputEvent)
Implement the standard behavior for when the mouse has not moved for a period of time.
This is due to an expired timer started by calling Standard
Declaration
public override void DoWaitAfter(InputEvent ievent)
Parameters
Type | Name | Description |
---|---|---|
Input |
ievent | The input event that caused Standard |
Overrides
Remarks
This calls Do
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
FindTool(string)
Find a mouse tool of a given name.
Declaration
public virtual Tool FindTool(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | the type of tool, such as "Dragging" or "ClickSelecting". |
Returns
Type | Description |
---|---|
Tool | a Tool whose Name exactly matches the given name, or null if no such tool is found in any of the three lists. |
Remarks
This searches the Mouse
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
HideToolTip()
Hide any tooltip.
Declaration
public virtual void HideToolTip()
Remarks
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
InitializeStandardTools()
Initialize the three mouse tool lists with instances of the standard tools.
Declaration
public virtual void InitializeStandardTools()
Remarks
This adds new instances of tools to the following three mouse tool lists:
Mouse
PositionToolTip(Adornment, GraphObject)
This is called by Show
Declaration
public virtual void PositionToolTip(Adornment tooltip, GraphObject obj)
Parameters
Type | Name | Description |
---|---|---|
Adornment | tooltip | |
Graph |
obj | The Graph |
Remarks
It normally goes just below the cursor. But if the mouse is too close to the right edge or the bottom edge of the viewport, it is positioned left and/or above the cursor.
This method only operates if the tooltip, an Adornment, does not have a Placeholder. When there is a Placeholder in the tooltip, that Adornment is automatically positioned so that the Placeholder is positioned at the adorned object, the second argument to this method.
This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
If you override this method to position the tooltip,
the tooltip has already been measured but not arranged,
so you can use its Measured
ReplaceTool(string, Tool)
Replace a mouse tool of a given name with a new tool, or remove an existing tool (if the newtool is null).
Declaration
public virtual Tool ReplaceTool(string name, Tool newtool)
Parameters
Type | Name | Description |
---|---|---|
string | name | the type of tool, such as "Dragging" or "ClickSelecting". |
Tool | newtool | If null, any tool that the search finds will just be removed from the list in which it was found. |
Returns
Type | Description |
---|---|
Tool | the old tool that was replaced by the new one; this is null if none was found and the new tool was not added to any mouse tool list |
Remarks
This searches the Mouse
Please read the Introduction page on Extensions for how to override methods and how to call this base method.
ShowToolTip(IShowHidable, GraphObject)
Show a tooltip.
This is called by Do
Declaration
public virtual void ShowToolTip(IShowHidable tooltip, GraphObject obj)
Parameters
Type | Name | Description |
---|---|---|
IShow |
tooltip | |
Graph |
obj | The GraphObject getting the tooltip; this is null if the tooltip is being shown for the diagram background. |
Remarks
This calls Position
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.