FocusablePane class
Namespace: Arlecchino.Focus · Assembly: Arlecchino
Wraps delegates as a focusable element, for a view that keeps its logic in methods rather than in objects. That is how the file picker holds its list and the sidebar of places.
public sealed class FocusablePane : IArlecchinoFocusable
Implements IArlecchinoFocusable
Constructors
| Member | Summary |
|---|---|
FocusablePane(Func<KeyPress, FocusResult>, Func<MouseEvent, FocusResult>) | Creates the element. |
Properties
| Member | Summary |
|---|---|
IsFocused | Whether this element holds the focus. |
Methods
| Member | Summary |
|---|---|
Handle(KeyPress) | Passes the key to the delegate. |
HandleMouse(MouseEvent) | Passes the mouse event to the delegate, if one was given. |
Constructors in detail
FocusablePane(Func<KeyPress, FocusResult>, Func<MouseEvent, FocusResult>)
public FocusablePane(
Func<KeyPress, FocusResult> handle,
Func<MouseEvent, FocusResult>? handleMouse = null);
Creates the element.
Parameters
| Name | Type | Description |
|---|---|---|
handle | Func<T, TResult><KeyPress, FocusResult> | What to do with a key while focused. |
handleMouse | Func<T, TResult><MouseEvent, FocusResult> | What to do with a mouse event; omit to ignore the mouse. |
Properties in detail
IsFocused
public bool IsFocused { get; set; }
Whether this element holds the focus.
Type bool
Methods in detail
Handle(KeyPress)
public FocusResult Handle(KeyPress key);
Passes the key to the delegate.
Parameters
| Name | Type | Description |
|---|---|---|
key | KeyPress | The key that was pressed. |
Returns FocusResult — What the delegate decided.
HandleMouse(MouseEvent)
public FocusResult HandleMouse(MouseEvent mouse);
Passes the mouse event to the delegate, if one was given.
Parameters
| Name | Type | Description |
|---|---|---|
mouse | MouseEvent | The event, in frame coordinates. |
Returns FocusResult — What the delegate decided, or ignored.