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 "../GUI/gui_event.hpp"
13#include "../geometry/extent.hpp"
14#include "../geometry/axis_aligned_rectangle.hpp"
15#include "../geometry/transform.hpp"
16#include "../observable.hpp"
17#include "../chrono.hpp"
18#include "../generator.hpp"
19#include "widget_constraints.hpp"
20#include "widget_layout.hpp"
21#include "widget_mode.hpp"
27namespace hi::inline v1 {
102 [[nodiscard]]
bool is_gui_thread() const noexcept;
123 [[nodiscard]] virtual
hitbox hitbox_test(
point3 position) const noexcept
136 return hitbox_test(_layout.from_parent * position);
148 return std::max(sibling_hitbox, hitbox_test(_layout.from_parent * position));
156 hi_axiom(is_gui_thread());
221 void request_relayout() const noexcept;
225 void request_reconstrain() const noexcept;
229 void request_resize() const noexcept;
235 virtual
bool handle_event(
gui_event const& event) noexcept;
244 virtual
bool handle_event_recursive(
246 std::vector<
widget const *> const& reject_list =
std::vector<
widget const *>{})
noexcept;
261 widget const *current_keyboard_widget,
262 keyboard_focus_group group,
263 keyboard_focus_direction direction)
const noexcept;
265 [[nodiscard]]
widget const *find_first_widget(keyboard_focus_group group)
const noexcept;
267 [[nodiscard]]
widget const *find_last_widget(keyboard_focus_group group)
const noexcept;
271 [[nodiscard]]
bool is_first(keyboard_focus_group group)
const noexcept;
275 [[nodiscard]]
bool is_last(keyboard_focus_group group)
const noexcept;
297 virtual [[nodiscard]]
color background_color() const noexcept;
299 virtual [[nodiscard]]
color foreground_color() const noexcept;
301 virtual [[nodiscard]]
color focus_color() const noexcept;
303 virtual [[nodiscard]]
color accent_color() const noexcept;
305 virtual [[nodiscard]]
color label_color() const noexcept;
311 decltype(mode)::token_type _mode_cbt;
This is a RGBA floating point color.
Definition color.hpp:39
A return value for a generator-function.
Definition generator.hpp:28
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:52
A user interface event.
Definition gui_event.hpp:58
Definition gui_window.hpp:39
An observable value.
Definition observable.hpp:359
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:39
virtual hitbox hitbox_test_from_parent(point3 position) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:134
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:154
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:90
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:48
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:287
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:43
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:81
virtual hitbox hitbox_test_from_parent(point3 position, hitbox sibling_hitbox) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:146
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:194
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:52
Definition widget_constraints.hpp:13
Definition widget_layout.hpp:18