7#include "gui_window_size.hpp"
8#include "gui_window_delegate.hpp"
9#include "mouse_cursor.hpp"
11#include "gui_event.hpp"
12#include "keyboard_focus_direction.hpp"
13#include "keyboard_focus_group.hpp"
16#include "../geometry/axis_aligned_rectangle.hpp"
17#include "../widgets/window_widget.hpp"
18#include "../widgets/grid_widget.hpp"
19#include "../widgets/toolbar_widget.hpp"
20#include "../chrono.hpp"
21#include "../label.hpp"
22#include "../animator.hpp"
23#include <unordered_set>
27namespace hi::inline v1 {
32class keyboard_bindings;
65 mouse_cursor current_mouse_cursor = mouse_cursor::None;
71 bool resizing =
false;
135 _redraw_rectangle |= redraw_rectangle;
142 hi_axiom(is_gui_thread());
146 void request_relayout(
void const *w)
noexcept
148 _relayout.store(w, std::memory_order::relaxed);
151 void request_reconstrain(
void const *w)
noexcept
153 _reconstrain.store(w, std::memory_order::relaxed);
156 void request_resize(
void const *w)
noexcept
158 _resize.store(w, std::memory_order::relaxed);
164 virtual void render(utc_nanoseconds displayTimePoint);
172 hi_axiom(is_gui_thread());
183 hi_axiom(is_gui_thread());
192 void set_resize_border_priority(
bool left,
bool right,
bool bottom,
bool top)
noexcept;
217 gui_window_size size_state() const noexcept
238 virtual
void set_text_on_clipboard(
std::
string str) noexcept = 0;
240 void update_mouse_target(hi::
widget const *new_target_widget,
point2 position = {})
noexcept;
270 [[nodiscard]]
translate2 window_to_screen() const noexcept
275 [[nodiscard]]
translate2 screen_to_window() const noexcept
277 return ~window_to_screen();
302 gui_window_size _size_state = gui_window_size::normal;
315 utc_nanoseconds last_forced_redraw = {};
319 animator<float> _animated_active = _animation_duration;
324 virtual void create_window(extent2 new_size) = 0;
327 notifier<>::token_type _setting_change_token;
328 observable<std::string>::token_type _selected_theme_token;
334 hi::widget
const *_mouse_target_widget =
nullptr;
339 hi::widget
const *_keyboard_target_widget =
nullptr;
345 void widget_is_destructing(hi::widget
const *sender)
noexcept
347 if (_mouse_target_widget == sender) {
348 _mouse_target_widget =
nullptr;
350 if (_keyboard_target_widget == sender) {
351 _keyboard_target_widget =
nullptr;
363 bool send_events_to_widget(hi::widget
const *target_widget,
std::vector<gui_event> const& events)
noexcept;
subpixel_orientation
The orientation of the RGB sub-pixels of and LCD/LED panel.
Definition subpixel_orientation.hpp:18
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
A rectangle / parallelogram in 3D space.
Definition rectangle.hpp:20
constexpr extent2 size() const noexcept
The size, or length of the right and up vectors.
Definition rectangle.hpp:154
Definition translate.hpp:15
Definition gfx_device.hpp:22
A user interface event.
Definition gui_event.hpp:58
Graphics system.
Definition gui_system.hpp:30
Definition gui_window.hpp:39
void update_keyboard_target(hi::widget const *widget, keyboard_focus_group group=keyboard_focus_group::normal) noexcept
Change the keyboard focus to the given widget.
virtual void set_cursor(mouse_cursor cursor)=0
Set the mouse cursor icon.
virtual void open_system_menu()=0
Open the system menu of the window.
void update_keyboard_target(keyboard_focus_group group, keyboard_focus_direction direction) noexcept
Change the keyboard focus to the given, previous or next widget.
void update_keyboard_target(hi::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.
toolbar_widget & toolbar() noexcept
Get a reference to window's toolbar widget.
Definition gui_window.hpp:181
grid_widget & content() noexcept
Get a reference to the window's content widget.
Definition gui_window.hpp:170
virtual void set_size_state(gui_window_size state) noexcept=0
Set the size-state of the window.
aarectangle rectangle
The current rectangle of the window relative to the screen.
Definition gui_window.hpp:56
extent2 widget_size
The size of the widget.
Definition gui_window.hpp:93
bool is_gui_thread() const noexcept
Check if the current thread is the same as the gui_system loop.
virtual void render(utc_nanoseconds displayTimePoint)
Update window.
std::unique_ptr< window_widget > widget
The widget covering the complete window.
Definition gui_window.hpp:97
virtual void init()
2 phase constructor.
notifier< void()> closing
Notifier used when the window is closing.
Definition gui_window.hpp:102
virtual void close_window()=0
Ask the operating system to close this window.
void request_redraw() noexcept
Request a rectangle on the window to be redrawn.
Definition gui_window.hpp:140
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 aarectangle workspace_rectangle() const noexcept=0
The rectangle of the workspace of the screen where the window is currently located.
bool process_event(gui_event const &event) noexcept
Process the event.
Definition gui_window_delegate.hpp:12
Definition keyboard_bindings.hpp:17
A label consisting of localizable text and an icon.
Definition label.hpp:27
A notifier which can be used to call a set of registered callbacks.
Definition notifier.hpp:24
A GUI widget that lays out child-widgets in a grid with variable sized cells.
Definition grid_widget.hpp:37
A toolbar widget is located at the top of a window and lays out its children horizontally.
Definition toolbar_widget.hpp:28
An interactive graphical object as part of the user-interface.
Definition widget.hpp:39