DiagramTool
This abstract tool class is the standard base class for all of the predefined tools.
継承元: FrameworkElement
実装: IDiagramTool
プロパティ
Diagram : Diagram
Gets the Diagram that owns this tool and for which this tool is handling input events.
MouseEnabled : bool
Gets or sets whether this tool can be started by a mouse event.
TransactionResult : string
Gets or sets the name of the transaction to be committed; if null, the transaction will be rolled back.
WheelBehavior : WheelBehavior
Gets or sets the behavior of StandardMouseWheel.
メソッド
CanStart() : bool
This predicate is used by the diagram to decide if this tool can be started.
戻り値: true if MouseEnabled is true and if the ToolManager can make this tool the current one and then call the DoStart method
CaptureMouse()
This calls UIElement.CaptureMouse on the Diagram's Panel.
DoActivate()
This method is called by the diagram after setting CurrentTool, to make the new tool active.
DoCancel()
The diagram will call this method when the user wishes to cancel the current tool's operation.
DoDeactivate()
This method is called by the diagram on the old tool when CurrentTool is set to a new tool.
DoKeyDown(KeyEventArgs)
The diagram will call this method upon a key down event.
DoKeyUp(KeyEventArgs)
The diagram will call this method upon a key up event.
DoMouseDown()
The diagram will call this method upon a mouse down event.
DoMouseMove()
The diagram will call this method upon a mouse move event.
DoMouseUp()
The diagram will call this method upon a mouse up event.
DoMouseWheel()
The diagram will call this method as the mouse wheel is rotated.
DoStart()
This method is called by the diagram when this tool becomes the current tool.
DoStop()
This method is called by the diagram when this tool stops being the current tool.
FindAdornedElement(FrameworkElement) : FrameworkElement
Given a handle element in an adornment, return its adornment's AdornedElement.
- handle
- a FrameworkElement
戻り値: a FrameworkElement inside the adorned part, not inside this adornment
FindAdornedPart(FrameworkElement) : Part
Given a handle element in an adornment, return its adornment's AdornedPart.
- handle
- a FrameworkElement
戻り値: a Part that is not an adornment
FindAdornment(FrameworkElement) : Adornment
Given a handle element, return its containing Adornment.
- handle
- a FrameworkElement
戻り値: the containing Adornment (which might be several visual levels up) or null if the element does not belong to an Adornment
FindElementUpFrom(FrameworkElement, Func<FrameworkElement, bool?>, Predicate<FrameworkElement>) : FrameworkElement
Search up the chain of visual parent elements starting with the given element to find one that has true and true.
- elt
- a FrameworkElement
- pred
- When this predicate and are both true, return that element, When this predicate is false, return null. Otherwise continue up the parent chain. Stop going up the visual parent chain when reaching the Part.
- valid
- a predicate that must be true for an element for it to be returned by this method
FindElementUpFrom(FrameworkElement, Predicate<FrameworkElement>) : FrameworkElement
Search up the chain of parent visual elements starting with the given element to find one for which is true
- elt
- a FrameworkElement
- pred
- When this predicate is true for an element, return that element. When this predicate is false for an element, continue up the visual parent chain. Stop going up the visual parent chain when reaching the Part.
戻り値: null if no such element is found
FindPartAt(Point, bool) : Part
Find a Part at the given point, perhaps requiring it to be Selectable.
- p
- a Point in model coordinates
- selectable
- if true, the Part found must be selectable; otherwise any Part will do
戻り値: the first (frontmost) Part at the location ; the part could be a Node or a Link, including temporary ones such as Adornments.
FindToolHandleAt(Point, string) : FrameworkElement
Find an element at the given point that is a tool handle.
- p
- a Point in model coordinates
- category
- the handle's Adornment's Category
GetWheelDelta() : int
Return how much the wheel has turned.
戻り値: If the last mouse event was the mouse wheel turning forward, this returns a positive integer. If the last mouse event was the mouse wheel turning backward, this returns a negative integer. Otherwise this returns zero.
IsAltKeyDown() : bool
Return true when the alt key modifier is pressed.
IsBeyondDragSize() : bool
Return true when the last mouse point is far enough away from the first mouse down point to constitute a drag operation instead of just a potential click.
戻り値: true if the first and last mouse points are more than two pixels apart in either axis
IsControlKeyDown() : bool
Return true when the control key modifier is pressed.
IsDoubleClick() : bool
Return true when the last mouse down event occurred very close to and very soon after the previous mouse down event.
IsLeftButtonDown() : bool
Return true when the left mouse button is pressed during a mouse button event.
IsRightButtonDown() : bool
Return true when the right mouse button is pressed during a mouse button event.
IsShiftKeyDown() : bool
Return true when the shift key modifier is pressed.
RaiseEvent(RoutedEvent, DiagramEventArgs) : bool
Raise a RoutedEvent on the Diagram.
- evt
- a RoutedEvent
- args
- a DiagramEventArgs
戻り値: true if the event was raised and it was Handled
ReleaseMouse()
This calls UIElement.ReleaseMouseCapture on the Diagram's Panel.
StandardMouseSelect()
Implement the standard behavior for selecting parts with the mouse, depending on the control and shift modifier keys.
StandardMouseWheel()
Implement the standard behavior for mouse wheel events.
StopTool()
If the CurrentTool is this tool, stop this tool and start the DefaultTool by making it be the new current tool.
StopTransaction() : bool
If TransactionResult is null, call RollbackTransaction, otherwise call String).
戻り値: the result of the call to rollback or commit the transaction
UpdateAdornments(Part)
The diagram asks each tool to update any adornments the tool might use for a given part.
- part
フィールド
MouseEnabledProperty : DependencyProperty
Identifies the MouseEnabled dependency property.
WheelBehaviorProperty : DependencyProperty
Identifies the WheelBehavior property.