Responses

References
public abstract class Responses
Class for handling UI responses.

Constructors

Responses

#
protected Responses(CoordinateSystem system = CoordinateSystem.Content)
system (CoordinateSystem = CoordinateSystem.Content)

Properties

CoordinatesContext

#
public CoordinateSystem CoordinatesContext { get; }
Gets the mouse coordinate system this responsive expects to operate in.

HadEffect

#
public virtual bool HadEffect { get; }
Indicates whether this responsive has actually performed an effect during its current interaction. Returning false tells the dispatcher that a Response.Release from this responsive should be downgraded to Response.Ignored, so other dispatch paths (e.g. context menu population) still get a chance to handle the same event. Default is true: regular responsives consume the event whenever they release focus. Transient interactions like Pan / Zoom override this to false while idle so a no-drag RMB click can still pop a context menu.

HasFocus

#
public bool HasFocus { get; set; }
Gets or sets whether this responsive currently has focus. This is set by the hosting control; there is no need to set it yourself.

RegionBoundary

#
public RectangleF RegionBoundary { get; set; }
Gets or sets the boundary of this region. When the mouse is outside of this boundary, it is assumed to not be relevant to this responsive. Within the boundary additional filtering may be in effect.

RegionFilter

#
public Func<PointF, bool> RegionFilter { get; set; }
Gets or sets the additional coincidence filter for within the region. If unset, the RegionBoundary is assumed to represent this responsive object exactly. The delegate should return false, if the given point is not considered to be coincident with this responsive.

Methods

InvokeKeyRelay

#
protected static Response InvokeKeyRelay(Func<KeyEventArgs, Response> hook, KeyEventArgs e)
Walk a key-event hook's invocation list and return the first non-Response.Ignored result. See InvokeMouseRelay(Func<ResponseMouseArgs, Response>, ResponseMouseArgs) for rationale.
hook (Func<KeyEventArgs, Response>)
e (KeyEventArgs)

InvokeMouseRelay

#
protected static Response InvokeMouseRelay(Func<ResponseMouseArgs, Response> hook, ResponseMouseArgs e)
Walk a hook event's invocation list and return the first non-Response.Ignored result. Returns Response.Ignored if no handler is subscribed or none consumed the event. Used to give attribute-subclass subscribers a chance to handle an event after the Responder's own logic has declined it.

InvokeRotationRelay

#
protected static Response InvokeRotationRelay(Func<ResponseRotationArgs, Response> hook, ResponseRotationArgs e)
Walk a rotation-gesture hook's invocation list and return the first non-Response.Ignored result. See InvokeMouseRelay(Func<ResponseMouseArgs, Response>, ResponseMouseArgs) for rationale.

InvokeTextInputRelay

#
protected static Response InvokeTextInputRelay(Func<TextInputEventArgs, Response> hook, TextInputEventArgs e)
Walk a text-input hook's invocation list and return the first non-Response.Ignored result. See InvokeMouseRelay(Func<ResponseMouseArgs, Response>, ResponseMouseArgs) for rationale.
hook (Func<TextInputEventArgs, Response>)
e (TextInputEventArgs)

IsCoincident

#
public bool IsCoincident(PointF controlPoint, PointF contentPoint)
Test for point-region coincidence. Both coordinate-system locations are supplied; this method internally picks the one matching this responder's CoordinatesContext, so callers don't have to know which system each responder operates in.
controlPoint (PointF)Cursor location in raw control-space pixels.
contentPoint (PointF)Cursor location in content-space (projected).

KeyDown

#
public virtual Response KeyDown(KeyEventArgs e)
Called when this responsive has focus and there's a key down event. May also be called if the cursor is over this responsive. Depends on the host.
e (KeyEventArgs)

KeyUp

#
public virtual Response KeyUp(KeyEventArgs e)
Called when this responsive has focus and there's a key up event. May also be called if the cursor is over this responsive. Depends on the host.
e (KeyEventArgs)

MouseDoubleClick

#
public virtual Response MouseDoubleClick(ResponseMouseArgs e)
Called when the mouse goes down and up twice over this responsive without moving too much in between.
e (ResponseMouseArgs)

MouseDown

#
public virtual Response MouseDown(ResponseMouseArgs e)
Called when one of the mouse buttons goes down over this responsive region.
e (ResponseMouseArgs)

MouseDrag

#
public virtual Response MouseDrag(ResponseMouseArgs e)
Called when the mouse moves while one or more buttons are pressed. For this method to be invoked the preceding MouseDown(ResponseMouseArgs) call has to return Response.Capture. Only the focused responsive receives this call.
e (ResponseMouseArgs)

MouseLeave

#
public virtual void MouseLeave()
Called when the hosting control detects the mouse leaves this responsive region.

MouseOver

#
public virtual void MouseOver(ResponseMouseArgs e)
Called when the mouse moves over this responsive without any pressed buttons. Fires on every cursor motion while the cursor is over the responsive (not a delayed "dwell" event — use FlexControl.MouseDwell for that). Only the responsive currently under the cursor receives this call. Returns void: hover dispatch cannot transition a responsive into focus (Capture only comes from MouseDown), so a Response would be vestigial. If your hover handling changes visible state, call OnRedrawRequired() or update through an InvalidateDisplay path.
e (ResponseMouseArgs)

MouseSingleClick

#
public virtual Response MouseSingleClick(ResponseMouseArgs e)
Called when the mouse goes down and up over this responsive without moving too much in between.
e (ResponseMouseArgs)

MouseUp

#
public virtual Response MouseUp(ResponseMouseArgs e)
Called when one of the mouse buttons goes up, after a MouseDown(ResponseMouseArgs) call to this same responsive.
e (ResponseMouseArgs)

MouseWheel

#
public virtual Response MouseWheel(ResponseMouseArgs e)
Called when the mouse wheel spins while the cursor is over this responsive.
e (ResponseMouseArgs)

OnRedrawRequired

#
public void OnRedrawRequired()
Raise the RedrawRequired event.

Rotation

#
public virtual Response Rotation(ResponseRotationArgs e)
Called when a rotation gesture is recognized over this responsive. The rotation delta is in clockwise degrees.
e (ResponseRotationArgs)

TextInput

#
public virtual Response TextInput(TextInputEventArgs e)
Called when this responsive has focus and there's a text input event.
e (TextInputEventArgs)

Events

GotFocus

#
public event EventHandler GotFocus
Raised whenever focus is set to this responsive.

KeyDownHook

#
public event Func<KeyEventArgs, Response> KeyDownHook
Fires when KeyDown(KeyEventArgs)'s own logic would return Response.Ignored.

KeyUpHook

#
public event Func<KeyEventArgs, Response> KeyUpHook
Fires when KeyUp(KeyEventArgs)'s own logic would return Response.Ignored.

LostFocus

#
public event EventHandler LostFocus
Raised whenver focus is removed from this responsive.

MouseDoubleClickHook

#
public event Func<ResponseMouseArgs, Response> MouseDoubleClickHook
Fires when MouseDoubleClick(ResponseMouseArgs)'s own logic would return Response.Ignored.

MouseDownHook

#
public event Func<ResponseMouseArgs, Response> MouseDownHook
Fires when MouseDown(ResponseMouseArgs)'s own logic would return Response.Ignored. Subscribers handle the event in subscription order; the first to return a non-Ignored result wins.

MouseDragHook

#
public event Func<ResponseMouseArgs, Response> MouseDragHook
Fires when MouseDrag(ResponseMouseArgs)'s own logic would return Response.Ignored.

MouseLeaveHook

#
public event Action MouseLeaveHook
Fires after MouseLeave()'s own logic completes. Allows attribute subclasses to plug additional leave behaviour into a base class's Responder.

MouseOverHook

#
public event Action<ResponseMouseArgs> MouseOverHook
Fires after MouseOver(ResponseMouseArgs)'s own logic completes. Allows subclasses to plug additional hover behaviour into a base class's Responder.

MouseSingleClickHook

#
public event Func<ResponseMouseArgs, Response> MouseSingleClickHook
Fires when MouseSingleClick(ResponseMouseArgs)'s own logic would return Response.Ignored.

MouseUpHook

#
public event Func<ResponseMouseArgs, Response> MouseUpHook
Fires when MouseUp(ResponseMouseArgs)'s own logic would return Response.Ignored.

MouseWheelHook

#
public event Func<ResponseMouseArgs, Response> MouseWheelHook
Fires when MouseWheel(ResponseMouseArgs)'s own logic would return Response.Ignored.

RedrawRequired

#
public event EventHandler RedrawRequired
Raised whenever this responsive wants its host to redraw. Hosting controls are expected to subscribe and call ScheduleRedraw/Invalidate.

RotationHook

#
public event Func<ResponseRotationArgs, Response> RotationHook
Fires when Rotation(ResponseRotationArgs)'s own logic would return Response.Ignored.

TextInputHook

#
public event Func<TextInputEventArgs, Response> TextInputHook
Fires when TextInput(TextInputEventArgs)'s own logic would return Response.Ignored.