Navigator class
Namespace: Arlecchino.Navigation · Assembly: Arlecchino
Holds the screen being shown and the history behind it. Routes returned from handlers pass through here, and the view that leaves is disposed if it asked to be.
public class Navigator
Properties
| Member | Summary |
|---|---|
CanGoBack | Whether there is somewhere to go back to. |
CanGoForward | Whether a step back can be retraced. |
CurrentCommands | Commands of the screen being shown, for the router and the palette. |
CurrentHints | What the hints box should show: the keys of whatever holds the focus, then the screen's own hints or its commands. A key the focused element claims wins, so nothing is listed twice. |
CurrentIsTyping | Whether the screen being shown has something on it being typed into. |
CurrentRoute | The route being shown. |
CurrentUsesLayout | Whether the screen being shown wants the layout drawn around it. |
Methods
| Member | Summary |
|---|---|
Apply(ViewRoute) | Goes to a route. Ignores ViewRoute.None and the route already shown; anything else pushes the current one onto the back stack and drops the forward stack. |
Back() | Goes back one step in the history. |
Draw() | Draws the current screen. Called once per frame. |
Forward() | Retraces a step that was gone back from. |
Handle(KeyPress) | Passes a key to the current screen and applies the route it returns. |
HandleMouse(MouseEvent) | Passes a mouse event to the current screen and applies the route it returns. |
HandlePaste(string) | Passes pasted text to the current screen and applies the route it returns. |
Reload() | Builds the current screen again from scratch, losing its per-screen state. |
Properties in detail
CanGoBack
public bool CanGoBack { get; }
Whether there is somewhere to go back to.
Type bool
CanGoForward
public bool CanGoForward { get; }
Whether a step back can be retraced.
Type bool
CurrentCommands
public IReadOnlyList<ViewCommand> CurrentCommands { get; }
Commands of the screen being shown, for the router and the palette.
Type IReadOnlyList<T><ViewCommand>
CurrentHints
public ValueTuple<string, string>[] CurrentHints { get; }
What the hints box should show: the keys of whatever holds the focus, then the screen's own hints or its commands. A key the focused element claims wins, so nothing is listed twice.
Type ValueTuple<T1, T2><string, string>[]
CurrentIsTyping
public bool CurrentIsTyping { get; }
Whether the screen being shown has something on it being typed into.
Type bool
CurrentRoute
public ViewRoute CurrentRoute { get; }
The route being shown.
Type ViewRoute
CurrentUsesLayout
public bool CurrentUsesLayout { get; }
Whether the screen being shown wants the layout drawn around it.
Type bool
Methods in detail
Apply(ViewRoute)
public void Apply(ViewRoute route);
Goes to a route. Ignores ViewRoute.None and the route already shown; anything else pushes the current one onto the back stack and drops the forward stack.
Parameters
| Name | Type | Description |
|---|---|---|
route | ViewRoute | Where to go. |
Back()
public bool Back();
Goes back one step in the history.
Returns bool — false when there was nothing to go back to.
Draw()
public void Draw();
Draws the current screen. Called once per frame.
Forward()
public bool Forward();
Retraces a step that was gone back from.
Returns bool — false when there was nothing to retrace.
Handle(KeyPress)
public void Handle(KeyPress key);
Passes a key to the current screen and applies the route it returns.
Parameters
| Name | Type | Description |
|---|---|---|
key | KeyPress | The key that was pressed. |
HandleMouse(MouseEvent)
public void HandleMouse(MouseEvent mouse);
Passes a mouse event to the current screen and applies the route it returns.
Parameters
| Name | Type | Description |
|---|---|---|
mouse | MouseEvent | The event, in frame coordinates. |
HandlePaste(string)
public void HandlePaste(string text);
Passes pasted text to the current screen and applies the route it returns.
Parameters
| Name | Type | Description |
|---|---|---|
text | string | What was pasted. |
Reload()
public void Reload();
Builds the current screen again from scratch, losing its per-screen state.