IArlecchinoFocusable interface
Namespace: Arlecchino.Focus · Assembly: Arlecchino
Something inside a view that can hold the cursor: a pane, a list, a form. Put them in a FocusRing and the cycling, the routing and the mouse are handled for you.
public interface IArlecchinoFocusable
Implemented by FocusRing, FocusablePane, Form, IArlecchinoInteractiveWidget, ListBox, ScrollPane, Table, Tabs, Tree, TextView
Properties
| Member | Summary |
|---|---|
IsFocused | Set by the ring. Draw the element differently while it is false. |
Methods
| Member | Summary |
|---|---|
Handle(KeyPress) | Handles a key while this element has the focus. |
HandleMouse(MouseEvent) | Handles a mouse event wherever it landed. Claiming one also moves the focus here, so a click selects the pane it hit. |
Hints() | Keys this element reacts to while it holds the focus. The screen collects them down the chain of focus, so the hints box follows the cursor instead of listing the same keys everywhere. |
MoveFocus(FocusDirection) | Moves the focus one step inside this element, for something that holds focusable parts of its own. Answering false hands the step back to the surrounding ring, as the default does. |
Properties in detail
IsFocused
public bool IsFocused { get; set; }
Set by the ring. Draw the element differently while it is false.
Type bool
Methods in detail
Handle(KeyPress)
public FocusResult Handle(KeyPress key);
Handles a key while this element has the focus.
Parameters
| Name | Type | Description |
|---|---|---|
key | KeyPress | The key that was pressed. |
Returns FocusResult — What was done with it.
HandleMouse(MouseEvent)
public FocusResult HandleMouse(MouseEvent mouse);
Handles a mouse event wherever it landed. Claiming one also moves the focus here, so a click selects the pane it hit.
Parameters
| Name | Type | Description |
|---|---|---|
mouse | MouseEvent | The event, in frame coordinates. |
Returns FocusResult — What was done with it.
Hints()
public virtual ValueTuple<string, string>[] Hints();
Keys this element reacts to while it holds the focus. The screen collects them down the chain of focus, so the hints box follows the cursor instead of listing the same keys everywhere.
Returns ValueTuple<T1, T2><string, string>[] — Pairs of key and description, empty when the element has nothing to say.
MoveFocus(FocusDirection)
public bool MoveFocus(FocusDirection direction);
Moves the focus one step inside this element, for something that holds focusable parts of its own. Answering false hands the step back to the surrounding ring, as the default does.
Parameters
| Name | Type | Description |
|---|---|---|
direction | FocusDirection | Which way the focus is going. |
Returns bool — Whether the focus moved inside this element.