TermOx
Static Public Member Functions | Static Public Attributes | List of all members
ox::Terminal Class Reference

Static Public Member Functions

static void initialize (Mouse_mode mouse_mode=Mouse_mode::Basic, Key_mode key_mode=Key_mode::Normal, Signals signals=Signals::On)
 Initializes the terminal screen into curses mode. More...
 
static void uninitialize ()
 Reset the terminal to its state before initialize() was called. More...
 
static auto area () -> Area
 Return the Area of the terminal screen.
 
static void refresh ()
 Update the screen to reflect change made by Painter since last call. More...
 
static void update_color_stores (Color c, True_color tc)
 Update a Color Palette value. More...
 
static void repaint_color (Color c)
 Repaints all Glyphs with c in their Brush to the screen. More...
 
static void set_palette (Palette colors)
 Change Color definitions.
 
static auto palette_append (Color_definition::Value_t value) -> Color
 Append a Color_definition::Value_t to the current color palette. More...
 
static auto current_palette () -> Palette const &
 Return a copy of the currently set color palette.
 
static void show_cursor (bool show=true)
 Set whether or not the cursor is visible on screen.
 
static void move_cursor (Point point)
 Moves the cursor to Point point on screen. More...
 
static auto color_count () -> std::uint16_t
 Return the number of colors in the terminal's built in palette. More...
 
static auto has_true_color () -> bool
 Return true if this terminal supports true color.
 
static auto read_input () -> Event
 Wait for user input, and return with a corresponding Event. More...
 
static void flag_full_repaint ()
 Sets a flag so that the next call to refresh() will repaint every cell. More...
 
static void flush_screen ()
 Flushes all of the staged changes to the screen and sets the cursor.
 
static void stop_dynamic_color_engine ()
 Send exit flag and wait for Dynamic_color_engine thread to shutdown.
 
static void handle_signint (bool x)
 If set true, will properly uninitialize the screen on SIGINT. More...
 

Static Public Attributes

static sl::Signal< void(Palette const &)> palette_changed
 
static detail::Screen_buffers screen_buffers {Area{0, 0}}
 

Member Function Documentation

◆ color_count()

auto ox::Terminal::color_count ( ) -> std::uint16_t
static

Return the number of colors in the terminal's built in palette.

This cooresponds to the number of Color_index values.

◆ flag_full_repaint()

void ox::Terminal::flag_full_repaint ( )
static

Sets a flag so that the next call to refresh() will repaint every cell.

The repaint forces the diff to contain every cell on the terminal.

◆ handle_signint()

void ox::Terminal::handle_signint ( bool  x)
static

If set true, will properly uninitialize the screen on SIGINT.

This must be called before Terminal::initialize to be useful. This is set true by default.

◆ initialize()

void ox::Terminal::initialize ( Mouse_mode  mouse_mode = Mouse_mode::Basic,
Key_mode  key_mode = Key_mode::Normal,
Signals  signals = Signals::On 
)
static

Initializes the terminal screen into curses mode.

Must be called before any input/output can occur. No-op if initialized. Mouse_mode - - Off: Generates no Mouse Events. Basic: Generate Mouse Press and Release Events for all buttons and the scroll wheel. Drag: Basic, plus Mouse Move Events while a button is pressed. Move: Basic, plus Mouse Move Events are generated with or without a button pressed.

Key_mode - Normal: Key_press Events generated and auto-repeated if key is held down. Raw: Key_press and Key_release Events are generated, the shift key is not applied with other keys, each key press and release is its own event. Useful for games and where you need to keep track of multiple keys held down at once. All keys returned in Raw mode are lower-case. Has only been tested on a single laptop keyboard.

Signals - - - On: Signals can be generated from ctrl-[key] presses, for instance ctrl-c will send SIGINT instead of byte 3. Off: Signals will not be generated on ctrl-[key] presses, sending the byte value of the ctrl character instead.

◆ move_cursor()

void ox::Terminal::move_cursor ( Point  point)
static

Moves the cursor to Point point on screen.

{0, 0} is top left of the terminal screen.

◆ palette_append()

auto ox::Terminal::palette_append ( Color_definition::Value_t  value) -> Color
static

Append a Color_definition::Value_t to the current color palette.

Returns the Color that def was paired with. Picks the Color by incrementing the last color in the current palette.

◆ read_input()

auto ox::Terminal::read_input ( ) -> Event
static

Wait for user input, and return with a corresponding Event.

Blocking call, input can be received from the keyboard, mouse, or the terminal being resized. Will return nullopt if there is an error.

◆ refresh()

void ox::Terminal::refresh ( )
static

Update the screen to reflect change made by Painter since last call.

This leaves the cursor in an unknown location, the cursor must be set separately for the currently in-focus Widget.

◆ repaint_color()

void ox::Terminal::repaint_color ( Color  c)
static

Repaints all Glyphs with c in their Brush to the screen.

Used by Dynamic_color_engine.

◆ uninitialize()

void ox::Terminal::uninitialize ( )
static

Reset the terminal to its state before initialize() was called.

No-op if already uninitialized.

◆ update_color_stores()

void ox::Terminal::update_color_stores ( Color  c,
True_color  tc 
)
static

Update a Color Palette value.

Used by Dynamic_color_engine.


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