HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
system_menu_widget.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2020-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 "icon_widget.hpp"
13#include "../label.hpp"
14#include <memory>
15#include <string>
16#include <array>
17
18namespace hi { inline namespace v1 {
19
26class system_menu_widget final : public widget {
27public:
28 using super = widget;
29
30 observer<icon> icon;
31
33
35
36 system_menu_widget(widget *parent, forward_of<observer<hi::icon>> auto&& icon) noexcept :
38 {
39 this->icon = hi_forward(icon);
40 }
41
43 [[nodiscard]] generator<widget const &> children(bool include_invisible) const noexcept override
44 {
45 co_yield *_icon_widget;
46 }
47
48 [[nodiscard]] box_constraints update_constraints() noexcept override;
49 void set_layout(widget_layout const& context) noexcept override;
50 void draw(draw_context const& context) noexcept override;
51 [[nodiscard]] hitbox hitbox_test(point2i position) const noexcept override;
53private:
55 box_constraints _icon_constraints;
56 box_shape _icon_shape;
57
58 aarectanglei _system_menu_rectangle;
59};
60
61}} // namespace hi::v1
Functionality for labels, text and icons.
Defines widget.
Defines icon_widget.
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:211
2D constraints.
Definition box_constraints.hpp:22
Definition box_shape.hpp:15
The system menu widget.
Definition system_menu_widget.hpp:26
An interactive graphical object as part of the user-interface.
Definition widget.hpp:46
widget(widget *parent) noexcept
widget * parent
Pointer to the parent widget.
Definition widget.hpp:51
The layout of a widget.
Definition widget_layout.hpp:38