7#include "../GFX/draw_context.hpp"
8#include "../GUI/theme.hpp"
9#include "../GUI/hitbox.hpp"
10#include "../GUI/keyboard_focus_direction.hpp"
11#include "../GUI/keyboard_focus_group.hpp"
12#include "../geometry/extent.hpp"
13#include "../geometry/axis_aligned_rectangle.hpp"
14#include "../geometry/transform.hpp"
15#include "../observable.hpp"
16#include "../command.hpp"
17#include "../chrono.hpp"
18#include "../generator.hpp"
19#include "widget_constraints.hpp"
20#include "widget_layout.hpp"
26namespace hi::inline v1{
108 [[nodiscard]]
bool is_gui_thread() const noexcept;
129 [[nodiscard]] virtual
hitbox hitbox_test(
point3 position) const noexcept
142 return hitbox_test(_layout.from_parent * position);
154 return std::max(sibling_hitbox, hitbox_test(_layout.from_parent * position));
162 hi_axiom(is_gui_thread());
227 void request_relayout() const noexcept;
231 void request_reconstrain() const noexcept;
235 void request_resize() const noexcept;
241 [[nodiscard]] virtual
bool handle_event(command command) noexcept;
243 [[nodiscard]] virtual
bool handle_event(
std::vector<command> const &commands) noexcept;
252 virtual
bool handle_command_recursive(command command,
std::vector<
widget const *> const &reject_list =
std::vector<
widget const *>{})
noexcept;
291 widget const *current_keyboard_widget,
292 keyboard_focus_group group,
293 keyboard_focus_direction direction)
const noexcept;
295 [[nodiscard]]
widget const *find_first_widget(keyboard_focus_group group)
const noexcept;
297 [[nodiscard]]
widget const *find_last_widget(keyboard_focus_group group)
const noexcept;
301 [[nodiscard]]
bool is_first(keyboard_focus_group group)
const noexcept;
305 [[nodiscard]]
bool is_last(keyboard_focus_group group)
const noexcept;
327 virtual [[nodiscard]]
color background_color() const noexcept;
329 virtual [[nodiscard]]
color foreground_color() const noexcept;
331 virtual [[nodiscard]]
color focus_color() const noexcept;
333 virtual [[nodiscard]]
color accent_color() const noexcept;
335 virtual [[nodiscard]]
color label_color() const noexcept;
341 decltype(enabled)::token_type _enabled_cbt;
342 decltype(visible)::token_type _visible_cbt;
This is a RGBA floating point color.
Definition color.hpp:37
A return value for a generator-function.
Definition generator.hpp:27
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
A rectangle / parallelogram in 3D space.
Definition rectangle.hpp:20
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:51
Definition gui_window.hpp:40
Definition keyboard_event.hpp:47
Definition mouse_event.hpp:15
An observable value.
Definition observable.hpp:356
font_book keeps track of multiple fonts.
Definition font_book.hpp:30
An interactive graphical object as part of the user-interface.
Definition widget.hpp:40
virtual hitbox hitbox_test_from_parent(point3 position) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:140
std::vector< widget const * > parent_chain() const noexcept
Get a list of parents of a given widget.
virtual void scroll_to_show(hi::aarectangle rectangle) noexcept
Scroll to show the given rectangle on the window.
virtual bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept
Check if the widget will accept keyboard focus.
Definition widget.hpp:160
virtual void set_layout(widget_layout const &layout) noexcept=0
Update the internal layout of the widget.
int logical_layer
The logical layer of the widget.
Definition widget.hpp:96
bool is_last(keyboard_focus_group group) const noexcept
Is this widget the last widget in the parent container.
widget *const parent
Pointer to the parent widget.
Definition widget.hpp:49
virtual widget_constraints const & set_constraints() noexcept=0
Update the constraints of the widget.
virtual void draw(draw_context const &context) noexcept=0
Draw the widget.
void scroll_to_show() noexcept
Scroll to show the important part of the widget.
Definition widget.hpp:317
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:44
bool is_first(keyboard_focus_group group) const noexcept
Is this widget the first widget in the parent container.
widget(gui_window &window, widget *parent) noexcept
virtual void request_redraw() const noexcept
Request the widget to be redrawn on the next frame.
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:87
virtual bool handle_event(mouse_event const &event) noexcept
virtual hitbox hitbox_test_from_parent(point3 position, hitbox sibling_hitbox) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:152
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:200
virtual bool handle_event(keyboard_event const &event) noexcept
Handle keyboard event.
virtual widget const * find_next_widget(widget const *current_keyboard_widget, keyboard_focus_group group, keyboard_focus_direction direction) const noexcept
Find the next widget that handles keyboard focus.
std::string id
A name of widget, should be unique between siblings.
Definition widget.hpp:53
Definition widget_constraints.hpp:12
Definition widget_layout.hpp:17