Application class for TUI programs. More...
#include <application.h>


Public Member Functions | |
| TuiApplication (int argc, char **argv) | |
| Constructs a TuiApplication. | |
| ~TuiApplication () | |
| Destructor. Restores terminal state. | |
| TuiApplication (const TuiApplication &)=delete | |
| TuiApplication & | operator= (const TuiApplication &)=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. | |
| int | exec () |
| Runs the TUI application event loop. | |
| void | quit (int exitCode=0) |
| Requests the application to quit. | |
| 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. | |
Public Member Functions inherited from Application | |
| Application (int argc, char **argv) | |
| Constructs and registers an Application instance. | |
| ~Application () | |
| Destroys the Application and clears the current instance. | |
| Application (const Application &)=delete | |
| Application (Application &&)=delete | |
| Application & | operator= (const Application &)=delete |
| Application & | operator= (Application &&)=delete |
Static Public Member Functions | |
| static TuiApplication * | instance () |
| Returns the TuiApplication instance. | |
Static Public Member Functions inherited from Application | |
| static const StringList & | arguments () |
| Returns the command-line arguments. | |
| static const UUID & | appUUID () |
| Returns the application UUID used as a namespace for UUID v3/v5 generation. | |
| static void | setAppUUID (const UUID &uuid) |
| Sets the application UUID used as a namespace for UUID v3/v5 generation. | |
| static const String & | appName () |
| Returns the application name used for UUID v3/v5 generation. | |
| static void | setAppName (const String &name) |
| Sets the application name used for UUID v3/v5 generation. | |
| static Thread * | mainThread () |
| Returns the Thread object for the main (application) thread. | |
| static EventLoop * | mainEventLoop () |
| Returns the EventLoop for the main thread. | |
| static IODevice * | stdinDevice () |
| Returns an IODevice wrapping C stdin. | |
| static IODevice * | stdoutDevice () |
| Returns an IODevice wrapping C stdout. | |
| static IODevice * | stderrDevice () |
| Returns an IODevice wrapping C stderr. | |
Application class for TUI programs.
Derives from Application and manages the Terminal, TuiScreen, and input parsing. Provides the main event loop integration for TUI applications: reads raw input, parses escape sequences, dispatches events to widgets, and flushes the screen.
| TuiApplication::TuiApplication | ( | int | argc, |
| char ** | argv | ||
| ) |
Constructs a TuiApplication.
| argc | Argument count from main(). |
| argv | Argument vector from main(). |
|
inline |
Returns the current color mode.
| int TuiApplication::exec | ( | ) |
Runs the TUI application event loop.
Cycles focus to the next focusable widget.
| reverse | If true, cycles in reverse order. |
Grabs mouse events for a widget.
While grabbed, all mouse events are sent to the grabbing widget regardless of cursor position.
| void TuiApplication::markNeedsRepaint | ( | ) |
Marks the screen as needing a repaint.
Called internally when widget state changes. The screen is only repainted when this flag is set, avoiding unnecessary work and CPU usage.
| void TuiApplication::quit | ( | int | exitCode = 0 | ) |
Requests the application to quit.
| exitCode | The exit code. |
|
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. |
Sets the focused widget.
| widget | The widget to focus. |
Sets the top-level (root) widget.
| widget | The root widget to display. |