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

#include <ttauri/GUI/gui_window.hpp>

Inheritance diagram for tt::gui_window:
tt::gui_window_vulkan tt::gui_window_vulkan_macos tt::gui_window_vulkan_win32

Public Member Functions

 gui_window (gui_system &system, std::weak_ptr< gui_window_delegate > const &delegate, label const &title)
 
 gui_window (gui_window const &)=delete
 
gui_windowoperator= (gui_window const &)=delete
 
 gui_window (gui_window &&)=delete
 
gui_windowoperator= (gui_window &&)=delete
 
virtual void init ()
 2 phase constructor.
 
void request_redraw (aarect rectangle=aarect::infinity()) noexcept
 Request a rectangle on the window to be redrawn.
 
float fontScale () const noexcept
 By how much the font needs to be scaled compared to current windowScale.
 
void set_device (gui_device *device)
 
void unset_device ()
 
gui_devicedevice () const noexcept
 
virtual void render (hires_utc_clock::time_point displayTimePoint)=0
 Update window.
 
bool is_closed ()
 Check if the window was closed by the operating system.
 
template<typename T , cell_address CellAddress, typename... Args>
std::shared_ptr< T > make_widget (Args &&...args)
 Add a widget to main widget of the window.
 
template<typename T , horizontal_alignment Alignment = horizontal_alignment::left, typename... Args>
std::shared_ptr< T > make_toolbar_widget (Args &&...args)
 Add a widget to main widget of the window.
 
virtual void set_cursor (mouse_cursor cursor)=0
 Set the mouse cursor icon.
 
void set_resize_border_priority (bool left, bool right, bool bottom, bool top) noexcept
 
virtual void close_window ()=0
 Ask the operating system to close this window.
 
virtual void minimize_window ()=0
 Ask the operating system to minimize this window.
 
virtual void maximize_window ()=0
 Ask the operating system to maximize this window.
 
virtual void normalize_window ()=0
 Ask the operating system to normalize this window.
 
virtual void set_window_size (f32x4 extent)=0
 Ask the operating system to set the size of this window.
 
virtual std::string get_text_from_clipboard () const noexcept=0
 Retrieve a text string from the operating system's clip-board.
 
virtual void set_text_on_clipboard (std::string str) noexcept=0
 Place a text string on the operating system's clip-board.
 
void update_mouse_target (std::shared_ptr< tt::widget > new_target_widget, f32x4 position=f32x4{0.0f, 0.0f}) noexcept
 
void update_keyboard_target (std::shared_ptr< tt::widget > widget, keyboard_focus_group group=keyboard_focus_group::normal) noexcept
 Change the keyboard focus to the given widget.
 
void update_keyboard_target (std::shared_ptr< tt::widget > const &widget, keyboard_focus_group group, keyboard_focus_direction direction) noexcept
 Change the keyboard focus to the given, previous or next widget.
 
virtual f32x4 virtual_screen_size () const noexcept=0
 Get the size of the virtual-screen.
 

Data Fields

gui_systemsystem
 
gui_window_state state = gui_window_state::no_device
 
mouse_cursor currentmouse_cursor = mouse_cursor::None
 The current cursor.
 
std::atomic< bool > requestLayout = true
 When set to true the widgets will be layed out.
 
std::atomic< bool > requestResize = true
 When set to true the window will resize to the size of the contained widget.
 
std::atomic< bool > resizing = false
 
std::atomic< bool > active = false
 
gui_window_size size_state = gui_window_size::normal
 
f32x4 extent
 The current window extent as set by the GPU library.
 
std::weak_ptr< gui_window_delegatedelegate
 
label title
 
subpixel_orientation subpixel_orientation = subpixel_orientation::BlueRight
 
float dpi = 72.0
 
std::shared_ptr< window_widgetwidget
 The widget covering the complete window.
 

Detailed Description

A Window. This Window is backed by a native operating system window with a Vulkan surface. The Window should not have any decorations, which are to be drawn by the GUI, because modern design requires drawing of user interface elements in the border.

Member Function Documentation

◆ close_window()

virtual void tt::gui_window::close_window ( )
pure virtual

Ask the operating system to close this window.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ fontScale()

float tt::gui_window::fontScale ( ) const
inlinenoexcept

By how much the font needs to be scaled compared to current windowScale.

Widgets should pass this value to the text-shaper.

◆ get_text_from_clipboard()

virtual std::string tt::gui_window::get_text_from_clipboard ( ) const
pure virtualnoexcept

Retrieve a text string from the operating system's clip-board.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ init()

virtual void tt::gui_window::init ( )
virtual

2 phase constructor.

Must be called directly after the constructor on the same thread, before another thread can send messages to the window.

init() should not take locks on window::mutex.

Reimplemented in tt::gui_window_vulkan.

◆ is_closed()

bool tt::gui_window::is_closed ( )

Check if the window was closed by the operating system.

◆ make_toolbar_widget()

template<typename T , horizontal_alignment Alignment, typename... Args>
std::shared_ptr< T > tt::gui_window::make_toolbar_widget ( Args &&... args)

Add a widget to main widget of the window.

Add a widget to the toolbar of the window.

The implementation is in widgets.hpp

The implementation is located here so that widget is a concrete type.

◆ make_widget()

template<typename T , cell_address CellAddress, typename... Args>
std::shared_ptr< T > tt::gui_window::make_widget ( Args &&... args)

Add a widget to main widget of the window.

Add a widget to the main widget of the window.

The implementation is in widgets.hpp

The implementation is located here so that widget is a concrete type.

◆ maximize_window()

virtual void tt::gui_window::maximize_window ( )
pure virtual

Ask the operating system to maximize this window.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ minimize_window()

virtual void tt::gui_window::minimize_window ( )
pure virtual

Ask the operating system to minimize this window.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ normalize_window()

virtual void tt::gui_window::normalize_window ( )
pure virtual

Ask the operating system to normalize this window.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ render()

virtual void tt::gui_window::render ( hires_utc_clock::time_point displayTimePoint)
pure virtual

Update window.

This will update animations and redraw all widgets managed by this window.

Implemented in tt::gui_window_vulkan.

◆ request_redraw()

void tt::gui_window::request_redraw ( aarect rectangle = aarect::infinity())
inlinenoexcept

Request a rectangle on the window to be redrawn.

◆ set_cursor()

virtual void tt::gui_window::set_cursor ( mouse_cursor cursor)
pure virtual

Set the mouse cursor icon.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ set_device()

void tt::gui_window::set_device ( gui_device * device)

Set GPU device to manage this window. Change of the device may be done at runtime.

◆ set_text_on_clipboard()

virtual void tt::gui_window::set_text_on_clipboard ( std::string str)
pure virtualnoexcept

Place a text string on the operating system's clip-board.

Implemented in tt::gui_window_vulkan_macos, and tt::gui_window_vulkan_win32.

◆ set_window_size()

virtual void tt::gui_window::set_window_size ( f32x4 extent)
pure virtual

Ask the operating system to set the size of this window.

Implemented in tt::gui_window_vulkan_win32.

◆ unset_device()

void tt::gui_window::unset_device ( )
inline

Remove the GPU device from the window, making it an orphan.

◆ update_keyboard_target() [1/2]

void tt::gui_window::update_keyboard_target ( std::shared_ptr< tt::widget > const & widget,
keyboard_focus_group group,
keyboard_focus_direction direction )
noexcept

Change the keyboard focus to the given, previous or next widget.

This function will find the closest widget from the given widget wich belong to the given group; if none is found, or if the original selected widget is found, then no widget will be in focus.

Parameters
widgetThe widget to use as the start point for a new widget to select.
groupThe group the widget must belong to.
directionThe direction to search in, or current to select the current widget.

◆ update_keyboard_target() [2/2]

void tt::gui_window::update_keyboard_target ( std::shared_ptr< tt::widget > widget,
keyboard_focus_group group = keyboard_focus_group::normal )
noexcept

Change the keyboard focus to the given widget.

If the group of the widget is incorrect then no widget will be in focus.

Parameters
widgetThe new widget to focus, or empty to remove all keyboard focus.
groupThe group the widget must belong to.

◆ virtual_screen_size()

virtual f32x4 tt::gui_window::virtual_screen_size ( ) const
pure virtualnoexcept

Get the size of the virtual-screen.

Each window may be on a different virtual screen with different sizes, so retrieve it on a per window basis.

Implemented in tt::gui_window_vulkan_win32.

Field Documentation

◆ active

std::atomic<bool> tt::gui_window::active = false

The window is currently active. Widgets may want to reduce redraws, or change colors.

◆ currentmouse_cursor

mouse_cursor tt::gui_window::currentmouse_cursor = mouse_cursor::None

The current cursor.

Used for optimizing when the operating system cursor is updated. Set to mouse_cursor::None at the start (for the wait icon) and when the operating system is going to display another icon to make sure when it comes back in the application the cursor will be updated correctly.

◆ dpi

float tt::gui_window::dpi = 72.0

Dots-per-inch of the screen where the window is located. If the window is located on multiple screens then one of the screens is used as the source for the DPI value.

◆ extent

f32x4 tt::gui_window::extent

The current window extent as set by the GPU library.

◆ requestLayout

std::atomic<bool> tt::gui_window::requestLayout = true

When set to true the widgets will be layed out.

◆ requestResize

std::atomic<bool> tt::gui_window::requestResize = true

When set to true the window will resize to the size of the contained widget.

◆ resizing

std::atomic<bool> tt::gui_window::resizing = false

The window is currently being resized by the user. We can disable expensive redraws during rendering until this is false again.

◆ size_state

gui_window_size tt::gui_window::size_state = gui_window_size::normal

Current size state of the window.

◆ subpixel_orientation

subpixel_orientation tt::gui_window::subpixel_orientation = subpixel_orientation::BlueRight

Orientation of the RGB subpixels.

◆ widget

std::shared_ptr<window_widget> tt::gui_window::widget

The widget covering the complete window.


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