AppScreens
ConsoleMonster.Interactive
The screens of an app as a stack. The first screen added is the root; AppScreens.Push opens another and AppScreens.Back returns, which Escape and Backspace do when the focused input leaves them unused. Every screen is registered up front, so inputs inside screens keep their state values and take part in focus; only the current screen is mounted. Each screen remembers its focused input and brings its own key bindings to the footer, and a HeaderBar without crumbs of its own shows the path. The current key is also the state value AppScreens.StateKey: assigning it from a callback opens that screen.
Inheritance
- object
- AppScreens
Usage
Explore 17 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 9
- Extension method AppScreens.AddBackKey
- Extension method AppScreens.AddBackKeys
- Extension method AppScreens.Current
- Extension method AppScreens.StateKey
- Method AppScreens.Add
- Method InteractiveFluent.AddBackKey
- Method InteractiveFluent.AddBackKeys
- Method InteractiveFluent.Current
- Method InteractiveFluent.StateKey
Accepted by parameters 8
- Extension method AppScreens.AddBackKey
- Extension method AppScreens.AddBackKeys
- Extension method AppScreens.Current
- Extension method AppScreens.StateKey
- Method InteractiveFluent.AddBackKey
- Method InteractiveFluent.AddBackKeys
- Method InteractiveFluent.Current
- Method InteractiveFluent.StateKey
Constructors
public AppScreens(params AppScreen[] screens) #Creates a stack; the first screen is the root.
Parameters
- screens ConsoleMonster.Interactive.AppScreen[]
- The screens.
Methods
public AppScreens Add(AppScreen screen) #Registers a screen. Add every screen before the app runs.
Parameters
- screen ConsoleMonster.Interactive.AppScreen
- The screen; its key must be unique.
public Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public void Push(string key) #Opens a screen on top of the current one. A screen already on the path is returned to instead of stacked twice.
Parameters
- key string
- The screen key.
public void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Inherited Methods
Properties
public string StateKey { get; set; } #The state key holding the current screen's key (default Screen).
public IList<KeyChord> BackKeys { get; } #Keys that return to the previous screen when the focused input does not use them (default Escape and Backspace).
public IReadOnlyList<AppScreen> Screens { get; } #The registered screens, root first.
public IReadOnlyList<AppScreen> Path { get; } #The open screens from the root to the current one.
Extension Methods
public static AppScreens AddBackKey(AppScreens appScreens, KeyChord item) #Adds an item to AppScreens.BackKeys: Keys that return to the previous screen when the focused input does not use them (default Escape and Backspace).
Parameters
- appScreens ConsoleMonster.Interactive.AppScreens
- The instance.
- item ConsoleMonster.Input.KeyChord
- The item.
public static AppScreens AddBackKeys(AppScreens appScreens, params KeyChord[] items) #Adds items to AppScreens.BackKeys: Keys that return to the previous screen when the focused input does not use them (default Escape and Backspace).
Parameters
- appScreens ConsoleMonster.Interactive.AppScreens
- The instance.
- items ConsoleMonster.Input.KeyChord[]
- The items, in order.
public static AppScreens AddBackKeys(AppScreens appScreens, IEnumerable<KeyChord> items) #Adds items to AppScreens.BackKeys: Keys that return to the previous screen when the focused input does not use them (default Escape and Backspace).
Parameters
- appScreens ConsoleMonster.Interactive.AppScreens
- The instance.
- items System.Collections.Generic.IEnumerable<ConsoleMonster.Input.KeyChord>
- The items, in order.
public static AppScreens Current(AppScreens appScreens, Action<AppScreen> configure) #Configures AppScreens.Current in place: The current screen.
Parameters
- appScreens ConsoleMonster.Interactive.AppScreens
- The instance.
- configure System.Action<ConsoleMonster.Interactive.AppScreen>
- Configures the value.
public static AppScreens StateKey(AppScreens appScreens, string value) #Sets AppScreens.StateKey: The state key holding the current screen's key (default Screen).
Parameters
- appScreens ConsoleMonster.Interactive.AppScreens
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
appScreens.StateKey = value; appScreens.StateKey(value);