7#include "gui_window_state.hpp"
8#include "gui_window_size.hpp"
9#include "gui_window_delegate.hpp"
10#include "gui_system_globals.hpp"
11#include "mouse_cursor.hpp"
13#include "mouse_event.hpp"
14#include "keyboard_event.hpp"
15#include "subpixel_orientation.hpp"
16#include "keyboard_focus_direction.hpp"
17#include "keyboard_focus_group.hpp"
18#include "../text/gstring.hpp"
19#include "../logger.hpp"
20#include "../numeric_array.hpp"
21#include "../aarect.hpp"
22#include "../cpu_utc_clock.hpp"
23#include "../cell_address.hpp"
24#include "../label.hpp"
25#include <unordered_set>
43 gui_window_state state = gui_window_state::no_device;
86 subpixel_orientation subpixel_orientation = subpixel_orientation::BlueRight;
118 _request_redraw_rectangle |= rectangle;
126 return dpi / (window_scale() * 72.0f);
159 template<
typename T,
cell_address CellAddress,
typename... Args>
165 template<
typename T, horizontal_alignment Alignment = horizontal_alignment::left,
typename... Args>
172 void set_resize_border_priority(
bool left,
bool right,
bool bottom,
bool top)
noexcept;
202 void update_mouse_target(
std::shared_ptr<tt::
widget> new_target_widget,
f32x4 position =
f32x4{0.0f, 0.0f})
noexcept;
212 keyboard_focus_group group = keyboard_focus_group::normal)
noexcept;
224 keyboard_focus_group group,
225 keyboard_focus_direction direction)
noexcept;
253 bool _request_setting_change = true;
261 virtual void create_window(
const std::u8string &title,
f32x4 extent) = 0;
267 [[nodiscard]]
float window_scale() const noexcept;
271 virtual
void window_changed_size(
f32x4 new_extent);
275 virtual
void teardown() = 0;
279 virtual
void build() = 0;
284 [[nodiscard]] virtual
bool handle_event(tt::command command) noexcept;
286 [[nodiscard]] virtual
bool handle_event(
std::vector<tt::command> const &commands) noexcept
288 for (ttlet command : commands) {
289 if (handle_event(command)) {
299 [[nodiscard]]
virtual bool handle_event(mouse_event
const &event)
noexcept
307 [[nodiscard]]
virtual bool handle_event(keyboard_event
const &event)
noexcept
317 bool send_event(mouse_event
const &event)
noexcept;
323 bool send_event(keyboard_event
const &event)
noexcept;
325 bool send_event(KeyboardState _state, keyboard_modifiers modifiers, keyboard_virtual_key key)
noexcept;
327 bool send_event(grapheme grapheme,
bool full =
true) noexcept;
329 bool send_event(
char32_t c,
bool full = true) noexcept;
336 std::weak_ptr<tt::
widget> _mouse_target_widget = {};
351 template<
typename Event>
Definition cell_address.hpp:149
Definition gui_device.hpp:22
Vulkan gui_device controller.
Definition gui_system.hpp:24
Definition gui_window.hpp:39
std::atomic< bool > active
Definition gui_window.hpp:71
mouse_cursor currentmouse_cursor
The current cursor.
Definition gui_window.hpp:52
gui_window_size size_state
Definition gui_window.hpp:75
virtual void set_text_on_clipboard(std::string str) noexcept=0
Place a text string on the operating system's clip-board.
virtual void set_window_size(f32x4 extent)=0
Ask the operating system to set the size of this window.
virtual void close_window()=0
Ask the operating system to close this window.
std::shared_ptr< T > make_toolbar_widget(Args &&...args)
Add a widget to main widget of the window.
Definition widgets.hpp:47
void set_device(gui_device *device)
f32x4 extent
The current window extent as set by the GPU library.
Definition gui_window.hpp:78
virtual void init()
2 phase constructor.
std::atomic< bool > requestResize
When set to true the window will resize to the size of the contained widget.
Definition gui_window.hpp:60
virtual void maximize_window()=0
Ask the operating system to maximize this window.
std::atomic< bool > requestLayout
When set to true the widgets will be layed out.
Definition gui_window.hpp:56
bool is_closed()
Check if the window was closed by the operating system.
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.
std::atomic< bool > resizing
Definition gui_window.hpp:66
void unset_device()
Definition gui_window.hpp:136
std::shared_ptr< window_widget > widget
The widget covering the complete window.
Definition gui_window.hpp:95
virtual void set_cursor(mouse_cursor cursor)=0
Set the mouse cursor icon.
virtual void minimize_window()=0
Ask the operating system to minimize this window.
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.
virtual std::string get_text_from_clipboard() const noexcept=0
Retrieve a text string from the operating system's clip-board.
virtual f32x4 virtual_screen_size() const noexcept=0
Get the size of the virtual-screen.
virtual void render(hires_utc_clock::time_point displayTimePoint)=0
Update window.
void request_redraw(aarect rectangle=aarect::infinity()) noexcept
Request a rectangle on the window to be redrawn.
Definition gui_window.hpp:115
virtual void normalize_window()=0
Ask the operating system to normalize this window.
float fontScale() const noexcept
By how much the font needs to be scaled compared to current windowScale.
Definition gui_window.hpp:124
float dpi
Definition gui_window.hpp:92
std::shared_ptr< T > make_widget(Args &&...args)
Add a widget to main widget of the window.
Definition widgets.hpp:36
A localized text + icon label.
Definition label.hpp:76
int recurse_lock_count() const noexcept
This function should be used in tt_axiom() to check if the lock is held by current thread.
Definition unfair_recursive_mutex.hpp:60