TUI subsystem installed alongside an Application. More...
#include <tuisubsystem.h>
Public Member Functions | |
| TuiSubsystem () | |
| Installs the TUI on the current Application. | |
| ~TuiSubsystem () | |
| Destructor. Restores terminal state and releases I/O sources. | |
| TuiSubsystem (const TuiSubsystem &)=delete | |
| TuiSubsystem & | operator= (const TuiSubsystem &)=delete |
| void | setRootWidget (TuiWidget *widget) |
| Sets the top-level (root) widget. | |
| TuiWidget * | rootWidget () const |
| Returns the root widget. | |
| TuiScreen & | screen () |
| Returns the screen. | |
| Terminal & | terminal () |
| Returns the terminal. | |
| const TuiPalette & | palette () const |
| Returns the palette. | |
| TuiPalette & | palette () |
| Returns the palette for modification. | |
| void | setPalette (const TuiPalette &palette) |
| Sets the palette. | |
| void | setColorMode (Terminal::ColorSupport mode) |
| Sets the color mode for the TUI screen. | |
| Terminal::ColorSupport | colorMode () const |
| Returns the current color mode. | |
| void | updateAll () |
| Forces a full screen repaint. | |
| void | setFocusWidget (TuiWidget *widget) |
| Sets the focused widget. | |
| TuiWidget * | focusWidget () const |
| Returns the currently focused widget. | |
| void | focusNext (bool reverse=false) |
| Cycles focus to the next focusable widget. | |
| void | markNeedsRepaint () |
| Marks the screen as needing a repaint. | |
| void | grabMouse (TuiWidget *widget) |
| Grabs mouse events for a widget. | |
| void | releaseMouse () |
| Releases the mouse grab. | |
Static Public Member Functions | |
| static TuiSubsystem * | instance () |
| Returns the active TuiSubsystem instance. | |
TUI subsystem installed alongside an Application.
Owns the Terminal, TuiScreen, palette, input parser, and the event-loop plumbing (STDIN + SIGWINCH self-pipe as EventLoop::addIoSource callbacks) that drive a text UI. Stack- construct one after Application:
The subsystem resolves its EventLoop from the current Application via Application::mainEventLoop() — no constructor argument is needed. The constructor puts the terminal into raw mode, enables the alternate screen, and installs signal handlers and event sources; the destructor reverses all of that.
| promeki::TuiSubsystem::TuiSubsystem | ( | ) |
Installs the TUI on the current Application.
Requires an Application to have been constructed before this object. Puts the terminal in raw mode and registers STDIN / SIGWINCH as EventLoop I/O sources.
|
inline |
Returns the current color mode.
| void promeki::TuiSubsystem::focusNext | ( | bool | reverse = false | ) |
Cycles focus to the next focusable widget.
| reverse | If true, cycles in reverse order. |
|
inline |
Grabs mouse events for a widget.
While grabbed, all mouse events are sent to the grabbing widget regardless of cursor position.
| void promeki::TuiSubsystem::markNeedsRepaint | ( | ) |
Marks the screen as needing a repaint.
Thread-safe. At most one repaint is pending at any time — repeated calls before the pending paint fires are coalesced, so widgets can call this freely in response to state changes without flooding the event loop.
|
inline |
Sets the color mode for the TUI screen.
Changes how RGB colors are converted to ANSI output. The screen will do its best to gracefully degrade colors to the requested mode, but for optimal appearance, provide a TuiPalette whose colors suit the target mode.
| mode | The color support level to use. |
| void promeki::TuiSubsystem::setFocusWidget | ( | TuiWidget * | widget | ) |
Sets the focused widget.
| widget | The widget to focus. |
| void promeki::TuiSubsystem::setRootWidget | ( | TuiWidget * | widget | ) |
Sets the top-level (root) widget.
| widget | The root widget to display. |