HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
tt::gui_system Class Referenceabstract

#include <ttauri/GUI/gui_system.hpp>

Inheritance diagram for tt::gui_system:
tt::gui_system_win32

Public Member Functions

 gui_system (const gui_system &)=delete
 
gui_systemoperator= (const gui_system &)=delete
 
 gui_system (gui_system &&)=delete
 
gui_systemoperator= (gui_system &&)=delete
 
virtual void init () noexcept
 Initialize after construction.
 
virtual void deinit () noexcept
 
void set_delegate (std::weak_ptr< gui_system_delegate > delegate) noexcept
 
virtual int loop ()=0
 Start the GUI event loop.
 
virtual void exit (int exit_code)=0
 
tt::event_queue const & event_queue () const noexcept
 Get the event queue.
 
void run_from_event_queue (std::invocable auto &&function) noexcept
 Run the function from the GUI's event queue.
 
void run (std::invocable auto &&function) noexcept
 Run the function now or on from the GUI's event loop.
 
gui_windowadd_window (std::unique_ptr< gui_window > window)
 
template<typename... Args>
gui_windowmake_window (Args &&...args)
 Create a new window.
 
ssize_t num_windows ()
 
void render (utc_nanoseconds display_time_point)
 
bool is_gui_thread () const noexcept
 Check if this thread is the same as the gui thread.
 
void set_theme (tt::theme const &new_theme) noexcept
 Set the theme for the system.
 
tt::theme const & theme () const noexcept
 Get the theme.
 
void set_theme_mode (tt::theme_mode mode) noexcept
 
void request_constrain () noexcept
 Request all windows to constrain.
 

Static Public Member Functions

static std::unique_ptr< gui_systemmake_unique (std::weak_ptr< gui_system_delegate > delegate={}) noexcept
 Make a gui_system instance.
 

Data Fields

std::unique_ptr< gfx_systemgfx
 
std::unique_ptr< tt::vertical_syncvertical_sync
 
std::unique_ptr< tt::font_bookfont_book
 
std::unique_ptr< tt::theme_booktheme_book
 
std::unique_ptr< tt::keyboard_bindingskeyboard_bindings
 
thread_id const thread_id
 

Static Public Attributes

static os_handle instance
 

Detailed Description

Graphics system.

Member Function Documentation

◆ event_queue()

tt::event_queue const & tt::gui_system::event_queue ( ) const
inlinenoexcept

Get the event queue.

This queue allows for adding jobs to the queue which will be executed on the gui thread.

◆ init()

virtual void tt::gui_system::init ( )
inlinevirtualnoexcept

Initialize after construction.

Call this function directly after the constructor on the same thread.

◆ is_gui_thread()

bool tt::gui_system::is_gui_thread ( ) const
inlinenoexcept

Check if this thread is the same as the gui thread.

◆ loop()

virtual int tt::gui_system::loop ( )
pure virtual

Start the GUI event loop.

This function will start the GUI event loop. The event loop will monitor keyboard & mouse event, changes in window size & position and rendering of all windows.

When all windows are closed this function will return with an exit code of zero, or the return value from the delegate. Calling exit() will also cause this function to return.

Returns
exit code.

Implemented in tt::gui_system_win32.

◆ make_unique()

static std::unique_ptr< gui_system > tt::gui_system::make_unique ( std::weak_ptr< gui_system_delegate > delegate = {})
staticnoexcept

Make a gui_system instance.

This will instantiate a gui_system instance appropriate for the current operating system.

Parameters
delegateAn optional delegate.
Returns
A unique pointer to a gui_system instance.

◆ make_window()

template<typename... Args>
gui_window & tt::gui_system::make_window ( Args &&... args)
inline

Create a new window.

Parameters
argsThe arguments that are forwarded to the constructor of tt::gui_window_win32.
Returns
A reference to the new window.

◆ num_windows()

ssize_t tt::gui_system::num_windows ( )

Count the number of windows managed by the GUI.

◆ request_constrain()

void tt::gui_system::request_constrain ( )
noexcept

Request all windows to constrain.

◆ run()

void tt::gui_system::run ( std::invocable auto && function)
inlinenoexcept

Run the function now or on from the GUI's event loop.

◆ run_from_event_queue()

void tt::gui_system::run_from_event_queue ( std::invocable auto && function)
inlinenoexcept

Run the function from the GUI's event queue.

◆ set_theme()

void tt::gui_system::set_theme ( tt::theme const & new_theme)
noexcept

Set the theme for the system.

Parameters
new_themeThe new theme to use for the gui system.

◆ theme()

tt::theme const & tt::gui_system::theme ( ) const
noexcept

Get the theme.

Returns
The current theme.

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