13#include "../GFX/draw_context.hpp"
14#include "../GUI/theme.hpp"
15#include "../GUI/hitbox.hpp"
16#include "../GUI/keyboard_focus_direction.hpp"
17#include "../GUI/keyboard_focus_group.hpp"
19#include "../layout/box_constraints.hpp"
22#include "../geometry/transform.hpp"
23#include "../observer.hpp"
24#include "../chrono.hpp"
25#include "../generator.hpp"
26#include "../cache.hpp"
27#include "../os_settings.hpp"
33namespace hi {
inline namespace v1 {
103 observer<extent2i>
maximum = extent2i::large();
122 [[nodiscard]]
virtual hitbox
hitbox_test(point2i position)
const noexcept
213 virtual void draw(draw_context
const& context)
noexcept {}
215 virtual bool process_event(
gui_event const& event)
const noexcept
218 return parent->process_event(event);
262 widget const *current_keyboard_widget,
263 keyboard_focus_group group,
264 keyboard_focus_direction direction)
const noexcept;
266 [[nodiscard]]
widget const *find_first_widget(keyboard_focus_group group)
const noexcept;
268 [[nodiscard]]
widget const *find_last_widget(keyboard_focus_group group)
const noexcept;
272 [[nodiscard]]
bool is_first(keyboard_focus_group group)
const noexcept;
276 [[nodiscard]]
bool is_last(keyboard_focus_group group)
const noexcept;
298 [[nodiscard]] virtual gui_window *window() const noexcept
307 [[nodiscard]]
virtual hi::theme
const& theme() const noexcept
313 [[nodiscard]]
virtual gfx_surface
const *surface() const noexcept
322 [[nodiscard]]
virtual color background_color() const noexcept;
324 [[nodiscard]] virtual color foreground_color() const noexcept;
326 [[nodiscard]] virtual color focus_color() const noexcept;
328 [[nodiscard]] virtual color accent_color() const noexcept;
330 [[nodiscard]] virtual color label_color() const noexcept;
333 widget_layout _layout;
335 decltype(
mode)::callback_token _mode_cbt;
337 [[nodiscard]] virtual generator<
widget *> children() const noexcept
351 [[nodiscard]] aarectanglei make_overlay_rectangle(aarectanglei requested_rectangle)
const noexcept;
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:133
#define hi_assert_not_null(x,...)
Assert if an expression is not nullptr.
Definition assert.hpp:118
Defined the geo::extent, extent2 and extent3 types.
Definition of GUI event types.
@ window_redraw
Request that part of the window gets redrawn on the next frame.
@ rectangle
The gui_event has rectangle data.
@ enabled
The widget is fully enabled.
DOXYGEN BUG.
Definition algorithm.hpp:15
geometry/margins.hpp
Definition assert.hpp:18
A user interface event.
Definition gui_event.hpp:77
2D constraints.
Definition box_constraints.hpp:25
An interactive graphical object as part of the user-interface.
Definition widget.hpp:46
virtual void draw(draw_context const &context) noexcept
Draw the widget.
Definition widget.hpp:213
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:194
bool is_first(keyboard_focus_group group) const noexcept
Is this widget the first widget in the parent container.
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.
int logical_layer
The logical layer of the widget.
Definition widget.hpp:95
virtual void set_layout(widget_layout const &context) noexcept
Update the internal layout of the widget.
Definition widget.hpp:187
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:86
observer< extent2i > minimum
The minimum size this widget is allowed to be.
Definition widget.hpp:99
observer< bool > hover
Mouse cursor is hovering over the widget.
Definition widget.hpp:66
virtual void scroll_to_show(hi::aarectanglei rectangle) noexcept
Scroll to show the given rectangle on the window.
virtual bool handle_event_recursive(gui_event const &event, std::vector< widget const * > const &reject_list=std::vector< widget const * >{}) noexcept
Handle command recursive.
widget(widget *parent) noexcept
virtual hitbox hitbox_test_from_parent(point2i position, hitbox sibling_hitbox) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:145
virtual box_constraints update_constraints() noexcept
Update the constraints of the widget.
Definition widget.hpp:170
void request_redraw() const noexcept
Request the widget to be redrawn on the next frame.
Definition widget.hpp:226
std::vector< widget const * > parent_chain() const noexcept
Get a list of parents of a given widget.
virtual bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept
Check if the widget will accept keyboard focus.
Definition widget.hpp:153
virtual bool handle_event(gui_event const &event) noexcept
Handle command.
observer< extent2i > maximum
The maximum size this widget is allowed to be.
Definition widget.hpp:103
widget * parent
Pointer to the parent widget.
Definition widget.hpp:51
bool is_last(keyboard_focus_group group) const noexcept
Is this widget the last widget in the parent container.
void scroll_to_show() noexcept
Scroll to show the important part of the widget.
Definition widget.hpp:288
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:62
observer< bool > focus
The widget has keyboard focus.
Definition widget.hpp:70
virtual hitbox hitbox_test(point2i position) const noexcept
Find the widget that is under the mouse cursor.
Definition widget.hpp:122
virtual hitbox hitbox_test_from_parent(point2i position) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:133
The layout of a widget.
Definition widget_layout.hpp:41
translate2i from_parent
This matrix transforms parent widget's coordinates to local coordinates.
Definition widget_layout.hpp:60
constexpr aarectanglei clipping_rectangle_on_window() const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:149