Class CanvasState
Namespace: RichCanvas.States
Assembly: RichCanvas.dll
The base class for RichCanvas.RichCanvas states.
public abstract class CanvasState
Inheritance
Derived
DefaultState, DrawingState, MultipleSelectionState, PanningState, SingleSelectionState
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
CanvasState(RichCanvas)
Constructs a new RichCanvas.States.CanvasState.
public CanvasState(RichCanvas parent)
Parameters
parent
RichCanvas
The owner of the state.
Properties
Parent
The owner of the state.
protected RichCanvas Parent { get; }
Property Value
Methods
Enter()
Called whenever RichCanvas.RichCanvas.PushState(RichCanvas.States.CanvasState) is called (becomes the RichCanvas.RichCanvas.CurrentState).
Note: Used to initialize the State before any input is processed by it.
public virtual void Enter()
Exit()
Called whenever RichCanvas.RichCanvas.PopState is called.
public virtual void Exit()
HandleAutoPanning(MouseEventArgs)
Handles auto panning when mouse is outside the canvas.
public virtual void HandleAutoPanning(MouseEventArgs e)
Parameters
HandleKeyDown(KeyEventArgs)
Invoked when the System.Windows.UIElement.KeyDown event is received.
public virtual void HandleKeyDown(KeyEventArgs e)
Parameters
Information about the event.
HandleKeyUp(KeyEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.KeyUp attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
public virtual void HandleKeyUp(KeyEventArgs e)
Parameters
The System.Windows.Input.KeyEventArgs that contains the event data.
HandleMouseDown(MouseButtonEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
public virtual void HandleMouseDown(MouseButtonEventArgs e)
Parameters
The System.Windows.Input.MouseButtonEventArgs that contains the event data. This event data reports details about the mouse button that was pressed and the handled state.
HandleMouseMove(MouseEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseMove attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
public virtual void HandleMouseMove(MouseEventArgs e)
Parameters
The System.Windows.Input.MouseEventArgs that contains the event data.
HandleMouseUp(MouseButtonEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
public virtual void HandleMouseUp(MouseButtonEventArgs e)
Parameters
The System.Windows.Input.MouseButtonEventArgs that contains the event data. The event data reports that the mouse button was released.
MatchesPreviewMouseDownState(MouseButtonEventArgs, out CanvasState?)
Called by RichCanvas.RichCanvas.OnPreviewMouseDown(System.Windows.Input.MouseButtonEventArgs) to check if any state has priority over other controls handling MouseDown event.
public virtual bool MatchesPreviewMouseDownState(MouseButtonEventArgs e, out CanvasState? matchingState)
Parameters
matchingState
CanvasState?
Returns
PopState()
Pops the current state from the stack.
public virtual void PopState()
PushState(CanvasState)
Pushes a new state into the stack.
public virtual void PushState(CanvasState state)
Parameters
state
CanvasState
The new state.
ReEnter()
Called whenever RichCanvas.RichCanvas.PopState is called.
Note: Used whenever a state switch happens in order to update the state which was suspended.
public virtual void ReEnter()