That Terminal
A terminal emulator designed for video making purposes.
UI Class Reference

#include <ui.hh>

Public Types

enum  resizetype { cellx , celly , winx , winy }
 
using EventType = std::pair< std::string, std::variant< std::pair< int, int >, std::pair< int, resizetype >, bool > >
 

Public Member Functions

 UI ()
 
 ~UI ()
 
std::pair< unsigned, unsigned > GetCellSize () const
 
std::pair< unsigned, unsigned > GetWindowSize () const
 
bool IsHeadless () const
 
void ResizeTo (unsigned cellx, unsigned celly, unsigned width, unsigned height)
 
void SetWindowTitle (std::string_view str)
 
void SetIconName (std::string_view str)
 
void BeepOn ()
 
void PresentGraphics (const std::uint32_t *pixels)
 
EventType HandleEvents (bool permit_text_input)
 
void SetHeadless (bool state)
 

Detailed Description

User interface class.

Member Typedef Documentation

◆ EventType

using UI::EventType = std::pair< std::string, std::variant< std::pair<int,int>, std::pair<int, resizetype>, bool > >

The return value of HandleEvents. The first element is text input (string). The second element is one of the following: std::pair<int,int>, expressing new window size in pixels if the window has been resized from GUI.
std::pair<int,resizetype>, expressing the user's wish to perform a change in rendering proportions.
bool, true if the terminal should be terminated; false if none of above happened.

Member Enumeration Documentation

◆ resizetype

Possible kinds of resize,

See also
EventType

Constructor & Destructor Documentation

◆ UI()

UI::UI ( )

Constructor

◆ ~UI()

UI::~UI ( )

Destructor

Member Function Documentation

◆ BeepOn()

void UI::BeepOn ( )

Issues a short beep, if supported.

◆ GetCellSize()

std::pair<unsigned,unsigned> UI::GetCellSize ( ) const
inline
Returns
currently configured font cell size

◆ GetWindowSize()

std::pair<unsigned,unsigned> UI::GetWindowSize ( ) const
inline
Returns
currently configured window size in cells

◆ HandleEvents()

UI::EventType UI::HandleEvents ( bool  permit_text_input)

Polls (non-blocking) for UI events.

See also
EventType for possible events.
Parameters
permit_text_inputIf this parameter is false, text input from keyboard is not accepted.

◆ IsHeadless()

bool UI::IsHeadless ( ) const
inline
Returns
true if the terminal is started in headless mode

◆ PresentGraphics()

void UI::PresentGraphics ( const std::uint32_t *  pixels)

Updates the graphics within the window to the contents of the supplied buffer.

Parameters
pixelsRGB pixels. The buffer size must be at least cellx*celly*winx*winy units.

◆ ResizeTo()

void UI::ResizeTo ( unsigned  cellx,
unsigned  celly,
unsigned  width,
unsigned  height 
)

Attempts to resize the terminal window.

Parameters
cellxNew font cell width
cellyNew font cell height
widthNew window width in cells
heightNew window height in cells

◆ SetHeadless()

void UI::SetHeadless ( bool  state)
inline

Change headless state. Note: Once a window has been opened, changing this setting does not close it.

◆ SetIconName()

void UI::SetIconName ( std::string_view  str)

Changes the icon name. Unimplemented.

Parameters
strnew icon name.

◆ SetWindowTitle()

void UI::SetWindowTitle ( std::string_view  str)

Changes the window title to

Parameters
strnew window title.

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