12#include "../layout/module.hpp"
13#include "../geometry/module.hpp"
14#include "../observer/module.hpp"
15#include "../time/module.hpp"
16#include "../settings/module.hpp"
17#include "../numeric/module.hpp"
18#include "../GUI/module.hpp"
19#include "../generator.hpp"
25namespace hi {
inline namespace v1 {
82 observer<extent2>
maximum = extent2::large();
95 [[nodiscard]] generator<widget_intf &>
children(
bool include_invisible)
noexcept override
107 [[nodiscard]] hitbox
hitbox_test(point2 position)
const noexcept override
191 widget_id current_keyboard_widget,
192 keyboard_focus_group group,
193 keyboard_focus_direction direction)
const noexcept override;
195 [[nodiscard]] widget_id find_first_widget(keyboard_focus_group group)
const noexcept override;
197 [[nodiscard]] widget_id find_last_widget(keyboard_focus_group group)
const noexcept override;
201 [[nodiscard]]
bool is_first(keyboard_focus_group group)
const noexcept;
205 [[nodiscard]]
bool is_last(keyboard_focus_group group)
const noexcept;
219 [[nodiscard]] gui_window *
window() const noexcept
override
228 [[nodiscard]] hi::theme
const &theme() const noexcept
235 [[nodiscard]] gfx_surface
const *surface() const noexcept
238 return w->surface.get();
244 [[nodiscard]]
virtual color background_color() const noexcept;
246 [[nodiscard]] virtual color foreground_color() const noexcept;
248 [[nodiscard]] virtual color focus_color() const noexcept;
250 [[nodiscard]] virtual color accent_color() const noexcept;
252 [[nodiscard]] virtual color label_color() const noexcept;
255 widget_layout _layout;
257 decltype(
mode)::callback_token _mode_cbt;
268 [[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:253
#define hi_assert_not_null(x,...)
Assert if an expression is not nullptr.
Definition assert.hpp:238
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
@ window_redraw
Request that part of the window gets redrawn on the next frame.
@ enabled
The widget is fully enabled.
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:26
A high-level geometric extent.
Definition extent2.hpp:26
A rectangle / parallelogram in 3D space.
Definition rectangle.hpp:20
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:209
A user interface event.
Definition gui_event.hpp:74
Definition widget_intf.hpp:16
virtual gui_window * window() const noexcept=0
Get the window that the widget is owned by.
void scroll_to_show() noexcept
Scroll to show the important part of the widget.
Definition widget_intf.hpp:195
widget_intf * parent
Pointer to the parent widget.
Definition widget_intf.hpp:27
virtual bool process_event(gui_event const &event) const noexcept=0
Send a event to the window.
virtual generator< widget_intf & > children(bool include_invisible) noexcept=0
Get a list of child widgets.
virtual void set_window(gui_window *window) noexcept=0
Set the window for this tree of widgets.
The layout of a widget.
Definition widget_layout.hpp:35
constexpr aarectangle clipping_rectangle_on_window() const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:165
translate2 from_parent
This matrix transforms parent widget's coordinates to local coordinates.
Definition widget_layout.hpp:54
2D constraints.
Definition box_constraints.hpp:22
An interactive graphical object as part of the user-interface.
Definition widget.hpp:36
widget_layout const & layout() const noexcept override
Get the current layout for this widget.
Definition widget.hpp:155
bool is_first(keyboard_focus_group group) const noexcept
Is this widget the first widget in the parent container.
int logical_layer
The logical layer of the widget.
Definition widget.hpp:74
bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept override
Check if the widget will accept keyboard focus.
Definition widget.hpp:138
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:65
observer< extent2 > minimum
The minimum size this widget is allowed to be.
Definition widget.hpp:78
observer< bool > hover
Mouse cursor is hovering over the widget.
Definition widget.hpp:45
virtual hitbox hitbox_test_from_parent(point2 position, hitbox sibling_hitbox) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:130
bool handle_event_recursive(gui_event const &event, std::vector< widget_id > const &reject_list=std::vector< widget_id >{}) noexcept override
Handle command recursive.
gui_window * window() const noexcept override
Get the window that the widget is owned by.
Definition widget.hpp:219
virtual widget_id find_next_widget(widget_id current_keyboard_widget, keyboard_focus_group group, keyboard_focus_direction direction) const noexcept override
Find the next widget that handles keyboard focus.
void scroll_to_show(hi::aarectangle rectangle) noexcept override
Scroll to show the given rectangle on the window.
void set_layout(widget_layout const &context) noexcept override
Update the internal layout of the widget.
Definition widget.hpp:150
widget(widget *parent) noexcept
generator< widget_intf & > children(bool include_invisible) noexcept override
Get a list of child widgets.
Definition widget.hpp:95
void draw(draw_context const &context) noexcept override
Draw the widget.
Definition widget.hpp:160
void request_redraw() const noexcept override
Request the widget to be redrawn on the next frame.
Definition widget.hpp:175
virtual hitbox hitbox_test_from_parent(point2 position) const noexcept
Call hitbox_test from a parent widget.
Definition widget.hpp:118
hitbox hitbox_test(point2 position) const noexcept override
Find the widget that is under the mouse cursor.
Definition widget.hpp:107
box_constraints update_constraints() noexcept override
Update the constraints of the widget.
Definition widget.hpp:144
void set_window(gui_window *window) noexcept override
Set the window for this tree of widgets.
Definition widget.hpp:210
bool is_last(keyboard_focus_group group) const noexcept
Is this widget the last widget in the parent container.
bool process_event(gui_event const &event) const noexcept override
Send a event to the window.
Definition widget.hpp:164
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:41
observer< bool > focus
The widget has keyboard focus.
Definition widget.hpp:49
bool handle_event(gui_event const &event) noexcept override
Handle command.
observer< extent2 > maximum
The maximum size this widget is allowed to be.
Definition widget.hpp:82