CPGen
C++ project generator
Loading...
Searching...
No Matches
Public Member Functions | List of all members
View Class Reference

Root TUI manager: renders sections, routes input, and runs the event loop. More...

#include <View.hpp>

Public Member Functions

void addSection (std::unique_ptr< Component > section)
 Append a top-level section to the view.
 
void run ()
 Start the blocking TUI event loop.
 

Detailed Description

Root TUI manager: renders sections, routes input, and runs the event loop.

The run method constructs a Terminal (entering raw mode), then loops reading keys from stdin via Utils::readKey. Each key is first offered to the currently focused section; if not consumed, View handles Defs::Special::Tab to move focus between sections and Defs::Special::Escape to exit the loop.

After every input event the entire screen is redrawn via redraw.

Member Function Documentation

◆ addSection()

void View::addSection ( std::unique_ptr< Component section)

Append a top-level section to the view.

Ownership is transferred. The first section added automatically receives focus when run starts.

Parameters
sectionA component to display as a top-level section.

◆ run()

void View::run ( )

Start the blocking TUI event loop.

  1. Enters terminal raw mode via Terminal.
  2. Grants focus to the first section and redraws.
  3. Reads keys in a loop, routing them to the focused section or handling Tab / Escape at the view level.
  4. Exits (and restores the terminal) when Defs::Special::Escape is pressed.
Note
This method blocks until the user exits the TUI.
Here is the call graph for this function:

The documentation for this class was generated from the following files: