|
HikoGUI
A low latency retained GUI
|
#include <ttauri/GUI/gui_window.hpp>
Public Types | |
| using | delegate_type = gui_window_delegate |
Public Member Functions | |
| gui_window (label const &title, std::weak_ptr< delegate_type > delegate={}) noexcept | |
| gui_window (gui_window const &)=delete | |
| gui_window & | operator= (gui_window const &)=delete |
| gui_window (gui_window &&)=delete | |
| gui_window & | operator= (gui_window &&)=delete |
| virtual void | init () |
| 2 phase constructor. | |
| virtual void | deinit () |
| 2 phase constructor. | |
| void | set_device (gfx_device *device) noexcept |
| void | request_redraw (aarectangle rectangle) noexcept |
| Request a rectangle on the window to be redrawn. | |
| void | request_redraw () 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. | |
| virtual void | render (hires_utc_clock::time_point displayTimePoint) |
| Update window. | |
| bool | is_closed () const noexcept |
| Check if the window was closed by the operating system. | |
| grid_widget & | content () noexcept |
| Get a reference to the window's content widget. | |
| toolbar_widget & | toolbar () noexcept |
| Get a reference to window's toolbar widget. | |
| 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 (extent2 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 (tt::widget const *new_target_widget, point2 position={}) noexcept |
| void | update_keyboard_target (tt::widget const *widget, keyboard_focus_group group=keyboard_focus_group::normal) noexcept |
| Change the keyboard focus to the given widget. | |
| void | update_keyboard_target (tt::widget const *widget, keyboard_focus_group group, keyboard_focus_direction direction) noexcept |
| Change the keyboard focus to the previous or next widget from the given widget. | |
| void | update_keyboard_target (keyboard_focus_group group, keyboard_focus_direction direction) noexcept |
| Change the keyboard focus to the given, previous or next widget. | |
| virtual extent2 | virtual_screen_size () const noexcept=0 |
| Get the size of the virtual-screen. | |
| translate2 | window_to_screen () const noexcept |
| translate2 | screen_to_window () const noexcept |
Data Fields | |
| std::unique_ptr< gfx_surface > | surface |
| mouse_cursor | currentmouse_cursor = mouse_cursor::None |
| The current cursor. | |
| std::atomic< bool > | requestLayout = true |
| When set to true the widgets will be laid out. | |
| std::atomic< bool > | requestResize = true |
| When set to true the window will resize to the size of the contained widget. | |
| bool | resizing = false |
| bool | active = false |
| gui_window_size | size_state = gui_window_size::normal |
| extent2 | size |
| The size from the surface, clamped to combined widget's size. | |
| label | title |
| float | dpi = 72.0 |
| std::unique_ptr< window_widget > | widget |
| The widget covering the complete window. | |
Friends | |
| class | widget |
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.
|
pure virtual |
Ask the operating system to close this window.
Implemented in tt::gui_window_win32.
|
inlinenoexcept |
Get a reference to the window's content widget.
|
virtual |
2 phase constructor.
Must be called directly before the destructor on the same thread,
deinit() should not take locks on window::mutex.
|
inlinenoexcept |
By how much the font needs to be scaled compared to current windowScale.
Widgets should pass this value to the text-shaper.
|
pure virtualnoexcept |
Retrieve a text string from the operating system's clip-board.
Implemented in tt::gui_window_win32.
|
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.
|
noexcept |
Check if the window was closed by the operating system.
|
pure virtual |
Ask the operating system to maximize this window.
Implemented in tt::gui_window_win32.
|
pure virtual |
Ask the operating system to minimize this window.
Implemented in tt::gui_window_win32.
|
pure virtual |
Ask the operating system to normalize this window.
Implemented in tt::gui_window_win32.
|
virtual |
Update window.
This will update animations and redraw all widgets managed by this window.
|
inlinenoexcept |
Request a rectangle on the window to be redrawn.
|
inlinenoexcept |
Request a rectangle on the window to be redrawn.
|
pure virtual |
Set the mouse cursor icon.
Implemented in tt::gui_window_win32.
|
pure virtualnoexcept |
Place a text string on the operating system's clip-board.
Implemented in tt::gui_window_win32.
|
pure virtual |
Ask the operating system to set the size of this window.
Implemented in tt::gui_window_win32.
|
inlinenoexcept |
Get a reference to window's toolbar widget.
|
noexcept |
Change the keyboard focus to the given, previous or next widget.
This function will find the closest widget from the current widget which belongs to the given group; if none is found, or if the original selected widget is found, then no widget will be in focus.
| group | The group the widget must belong to. |
| direction | The direction to search in, or current to select the current widget. |
|
noexcept |
Change the keyboard focus to the previous or next widget from the given widget.
This function will find the closest widget from the given widget which belongs to the given group; if none is found, or if the original selected widget is found, then no widget will be in focus.
| widget | The widget to use as the start point for a new widget to select. |
| group | The group the widget must belong to. |
| direction | The direction to search in, or current to select the current widget. |
|
noexcept |
Change the keyboard focus to the given widget.
If the group of the widget is incorrect then no widget will be in focus.
| widget | The new widget to focus, or empty to remove all keyboard focus. |
| group | The group the widget must belong to. |
|
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_win32.
| bool tt::gui_window::active = false |
The window is currently active. Widgets may want to reduce redraws, or change colors.
| 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.
| 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.
| std::atomic<bool> tt::gui_window::requestLayout = true |
When set to true the widgets will be laid out.
| std::atomic<bool> tt::gui_window::requestResize = true |
When set to true the window will resize to the size of the contained widget.
| 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.
| extent2 tt::gui_window::size |
The size from the surface, clamped to combined widget's size.
| gui_window_size tt::gui_window::size_state = gui_window_size::normal |
Current size state of the window.
| std::unique_ptr<window_widget> tt::gui_window::widget |
The widget covering the complete window.