12#include "../macros.hpp"
14namespace hi {
inline namespace v1 {
62 ++global_counter<
"overlay_widget:set_widget:constrain">;
78 hi_axiom(loop::main().on_thread());
79 hi_assert(_content ==
nullptr);
81 auto tmp = std::make_unique<Widget>(
this, std::forward<Args>(args)...);
96 _content_constraints = _content->update_constraints();
97 return _content_constraints;
99 void set_layout(widget_layout
const&
context)
noexcept override
104 _layout.clipping_rectangle =
context.rectangle() + theme().border_width();
107 _content_shape = box_shape{_content_constraints,
content_rectangle, theme().baseline_adjustment()};
110 _content->set_layout(_layout.transform(_content_shape, 1.0f,
context.rectangle()));
112 void draw(draw_context
const&
context)
noexcept override
134 [[
nodiscard]] hitbox hitbox_test(point2 position)
const noexcept override
136 hi_axiom(loop::main().on_thread());
139 return _content->hitbox_test_from_parent(position);
147 box_constraints _content_constraints;
148 box_shape _content_shape;
150 void draw_background(draw_context
const&
context)
noexcept
@ window_reconstrain
Request that widget get constraint on the next frame.
@ rectangle
The gui_event has rectangle data.
@ partial
A widget is partially enabled.
@ invisible
The widget is invisible.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
@ outside
The border is drawn outside the edge of a quad.
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:29
widget_intf * parent
Pointer to the parent widget.
Definition widget_intf.hpp:28
2D constraints.
Definition box_constraints.hpp:25
A GUI widget which may exist anywhere on a window overlaid above any other widget.
Definition overlay_widget.hpp:39
overlay_widget(widget *parent) noexcept
Constructs an empty overlay widget.
Definition overlay_widget.hpp:49
Widget & make_widget(Args &&...args) noexcept
Add a content widget directly to this overlay widget.
Definition overlay_widget.hpp:76
An interactive graphical object as part of the user-interface.
Definition widget.hpp:37
widget_layout const & layout() const noexcept override
Get the current layout for this widget.
Definition widget.hpp:169
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:66
void scroll_to_show() noexcept
Scroll to show the important part of the widget.
Definition widget_intf.hpp:196
widget(widget *parent) noexcept
Definition widget.hpp:87
bool process_event(gui_event const &event) const noexcept override
Send a event to the window.
Definition widget.hpp:178
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:42