WithPositionalFocus

A ready implementation of positional focus for FocusIO, enabling switching between nodes using (usually) arrow keys. Used by subclassing in the focus I/O system.

This interface expects to be provided positionalFocusAction, which will be used to locate the target. lastFocusBox should be updated with the current focus box every frame; this can be achieved using the FindFocusBox branch action.

This interface exposes a few input actions, which if enabled using mixin enableInputActions, will enable navigation using standard Fluid input actions.

Implementing positional focus using this class requires three overrides in total:

override protected Optional!Rectangle lastFocusBox() const;
override protected inout(PositionalFocusAction) positionalFocusAction() inout;
override protected void focusInDirection(FluidInputAction actionType) { }

The last overload is necessary to avoid conflicts with the old backend system. It will stop being available in Fluid 0.8.0.

Members

Functions

focusAbove
FocusSearchAction focusAbove()
focusBelow
FocusSearchAction focusBelow()
focusDirection
FocusSearchAction focusDirection(Style.Side side)

Positional focus: Switch focus from the currently focused node to another based on screen position.

focusDown
bool focusDown()
Undocumented in source. Be warned that the author may not have intended to support it.
focusLeft
bool focusLeft()
Undocumented in source. Be warned that the author may not have intended to support it.
focusRight
bool focusRight()
Undocumented in source. Be warned that the author may not have intended to support it.
focusToLeft
FocusSearchAction focusToLeft()
focusToRight
FocusSearchAction focusToRight()

Positional focus: Switch focus from the currently focused node to another based on screen position.

focusUp
bool focusUp()
Undocumented in source. Be warned that the author may not have intended to support it.
lastFocusBox
Optional!Rectangle lastFocusBox()

To provide a reference for positional focus, the bounding box of the focused node.

positionalFocusAction
inout(PositionalFocusAction) positionalFocusAction()

Inherited Members

From WithFocus

currentFocus
inout(Focusable) currentFocus()

Note: Currently focused node may have blocksInput set to true; take care to check it before calling input handling methods.

currentFocus
Focusable currentFocus(Focusable newValue)

Change the currently focused node to another.

isFocusActionable
bool isFocusActionable()
isFocused
bool isFocused(Focusable focusable)
clearFocus
void clearFocus()

Clear current focus (set it to null).

Meta