11#include "../GFX/draw_context.hpp"
12#include "../GUI/theme.hpp"
13#include "../GUI/hitbox.hpp"
14#include "../GUI/keyboard_focus_direction.hpp"
15#include "../GUI/keyboard_focus_group.hpp"
17#include "../geometry/extent.hpp"
18#include "../geometry/axis_aligned_rectangle.hpp"
19#include "../geometry/transform.hpp"
20#include "../observer.hpp"
21#include "../chrono.hpp"
22#include "../generator.hpp"
23#include "set_constraints_context.hpp"
32namespace hi {
inline namespace v1 {
111 [[nodiscard]]
virtual hitbox
hitbox_test(point3 position)
const noexcept
200 virtual void draw(draw_context
const& context)
noexcept = 0;
202 virtual bool process_event(
gui_event const& event)
const noexcept
205 return parent->process_event(event);
248 widget const *current_keyboard_widget,
249 keyboard_focus_group group,
250 keyboard_focus_direction direction)
const noexcept;
252 [[nodiscard]]
widget const *find_first_widget(keyboard_focus_group group)
const noexcept;
254 [[nodiscard]]
widget const *find_last_widget(keyboard_focus_group group)
const noexcept;
258 [[nodiscard]]
bool is_first(keyboard_focus_group group)
const noexcept;
262 [[nodiscard]]
bool is_last(keyboard_focus_group group)
const noexcept;
284 virtual [[nodiscard]] color background_color() const noexcept;
286 virtual [[nodiscard]] color foreground_color() const noexcept;
288 virtual [[nodiscard]] color focus_color() const noexcept;
290 virtual [[nodiscard]] color accent_color() const noexcept;
292 virtual [[nodiscard]] color label_color() const noexcept;
298 decltype(
mode)::callback_token _mode_cbt;
300 [[nodiscard]] virtual generator<
widget *> children() const noexcept
314 [[nodiscard]] aarectangle make_overlay_rectangle(aarectangle requested_rectangle)
const noexcept;
#define hi_axiom(expression)
Specify an axiom; an expression that is true.
Definition assert.hpp:133
Defines widget_constraints.
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
The HikoGUI namespace.
Definition ascii.hpp:19
A user interface event.
Definition gui_event.hpp:76
Definition set_constraints_context.hpp:15
An interactive graphical object as part of the user-interface.
Definition widget.hpp:45
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:181
bool is_first(keyboard_focus_group group) const noexcept
Is this widget the first widget in the parent container.
virtual void scroll_to_show(hi::aarectangle rectangle) noexcept
Scroll to show the given rectangle on the window.
virtual hitbox hitbox_test_from_parent(point3 position) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:122
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:92
std::string id
A name of widget, should be unique between siblings.
Definition widget.hpp:54
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:83
virtual widget_constraints const & set_constraints(set_constraints_context const &context) noexcept=0
Update the constraints of the widget.
observer< bool > hover
Mouse cursor is hovering over the widget.
Definition widget.hpp:63
virtual void draw(draw_context const &context) noexcept=0
Draw the widget.
virtual bool handle_event_recursive(gui_event const &event, std::vector< widget const * > const &reject_list=std::vector< widget const * >{}) noexcept
Handle command recursive.
virtual hitbox hitbox_test_from_parent(point3 position, hitbox sibling_hitbox) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:134
virtual hitbox hitbox_test(point3 position) const noexcept
Find the widget that is under the mouse cursor.
Definition widget.hpp:111
widget(widget *parent) noexcept
void request_redraw() const noexcept
Request the widget to be redrawn on the next frame.
Definition widget.hpp:213
std::vector< widget const * > parent_chain() const noexcept
Get a list of parents of a given widget.
virtual void set_layout(widget_layout const &context) noexcept=0
Update the internal layout of the widget.
virtual bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept
Check if the widget will accept keyboard focus.
Definition widget.hpp:142
virtual bool handle_event(gui_event const &event) noexcept
Handle command.
widget * parent
Pointer to the parent widget.
Definition widget.hpp:50
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:274
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:59
observer< bool > focus
The widget has keyboard focus.
Definition widget.hpp:67
The constraints of a widget.
Definition widget_constraints.hpp:26
The layout of a widget.
Definition widget_layout.hpp:40
constexpr aarectangle clipping_rectangle_on_window() const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:152
matrix3 from_parent
This matrix transforms parent widget's coordinates to local coordinates.
Definition widget_layout.hpp:54