HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
spacer_widget.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
9#pragma once
10
11#include "../GUI/module.hpp"
12
13namespace hi { inline namespace v1 {
14
19class spacer_widget final : public widget {
20public:
21 using super = widget;
22
23 spacer_widget(widget *parent) noexcept : super(parent) {}
24
25 [[nodiscard]] generator<widget const&> children(bool include_invisible) const noexcept override
26 {
27 co_return;
28 }
29
30 [[nodiscard]] box_constraints update_constraints() noexcept override
31 {
32 auto r = box_constraints{};
33 r.maximum = extent2i::large();
34 return r;
35 }
36
37 void set_layout(widget_layout const& context) noexcept override
38 {
39 layout = context;
40 }
41
42 void draw(widget_draw_context& context) noexcept override {}
43
44 [[nodiscard]] hitbox hitbox_test(point2i position) const noexcept override
45 {
46 return hitbox{};
47 }
48};
49
50}} // namespace hi::v1
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
Definition widget.hpp:26
widget * parent
Pointer to the parent widget.
Definition widget.hpp:40
Draw context for drawing using the HikoGUI shaders.
Definition widget_draw_context.hpp:205
The layout of a widget.
Definition widget_layout.hpp:37
2D constraints.
Definition box_constraints.hpp:22
This GUI widget is used as a spacer between other widget for layout purposes.
Definition spacer_widget.hpp:19
generator< widget const & > children(bool include_invisible) const noexcept override
Get a list of child widgets.
Definition spacer_widget.hpp:25
hitbox hitbox_test(point2i position) const noexcept override
Find the widget that is under the mouse cursor.
Definition spacer_widget.hpp:44
void draw(widget_draw_context &context) noexcept override
Draw the widget.
Definition spacer_widget.hpp:42
void set_layout(widget_layout const &context) noexcept override
Update the internal layout of the widget.
Definition spacer_widget.hpp:37
box_constraints update_constraints() noexcept override
Update the constraints of the widget.
Definition spacer_widget.hpp:30