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 "widget.hpp"
12#include "../macros.hpp"
13
14hi_export_module(hikogui.widgets.spacer_widget);
15
16hi_export namespace hi { inline namespace v1 {
17
22class spacer_widget : public widget {
23public:
24 using super = widget;
25
26 spacer_widget(widget_intf const* parent) noexcept : super(parent) {}
27
28 [[nodiscard]] generator<widget_intf &> children(bool include_invisible) noexcept override
29 {
30 co_return;
31 }
32
33 [[nodiscard]] box_constraints update_constraints() noexcept override
34 {
35 _layout = {};
36
37 auto r = box_constraints{};
38 r.maximum = extent2::large();
39 return r;
40 }
41
42 void set_layout(widget_layout const& context) noexcept override
43 {
44 _layout = context;
45 }
46
47 void draw(draw_context const& context) noexcept override {}
48
49 [[nodiscard]] hitbox hitbox_test(point2 position) const noexcept override
50 {
51 return hitbox{};
52 }
53};
54
55}} // namespace hi::v1
Defines widget.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Draw context for drawing using the HikoGUI shaders.
Definition draw_context_intf.hpp:209
Definition widget_intf.hpp:24
widget_intf * parent
Pointer to the parent widget.
Definition widget_intf.hpp:35
The layout of a widget.
Definition widget_layout.hpp:56
2D constraints.
Definition box_constraints.hpp:25
This GUI widget is used as a spacer between other widget for layout purposes.
Definition spacer_widget.hpp:22
hitbox hitbox_test(point2 position) const noexcept override
Find the widget that is under the mouse cursor.
Definition spacer_widget.hpp:49
void draw(draw_context const &context) noexcept override
Draw the widget.
Definition spacer_widget.hpp:47
generator< widget_intf & > children(bool include_invisible) noexcept override
Get a list of child widgets.
Definition spacer_widget.hpp:28
void set_layout(widget_layout const &context) noexcept override
Update the internal layout of the widget.
Definition spacer_widget.hpp:42
box_constraints update_constraints() noexcept override
Update the constraints of the widget.
Definition spacer_widget.hpp:33
An interactive graphical object as part of the user-interface.
Definition widget.hpp:37
widget() noexcept
Constructor for creating sub views.
Definition widget.hpp:55