HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
window_traffic_lights_widget.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2020-2021.
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 "../text/glyph_ids.hpp"
13#include <memory>
14#include <string>
15#include <array>
16
17namespace hi { inline namespace v1 {
18
27public:
28 using super = widget;
29
30 window_traffic_lights_widget(gui_window& window, widget *parent) noexcept;
31
33 widget_constraints const& set_constraints() noexcept override;
34 void set_layout(widget_layout const& layout) noexcept override;
35 void draw(draw_context const& context) noexcept override;
36 bool handle_event(gui_event const& event) noexcept override;
37 [[nodiscard]] hitbox hitbox_test(point3 position) const noexcept override;
39private:
40 static constexpr float GLYPH_SIZE = 5.0f;
41 static constexpr float RADIUS = 5.5f;
42 static constexpr float DIAMETER = RADIUS * 2.0f;
43 static constexpr float MARGIN = 10.0f;
44 static constexpr float SPACING = 8.0f;
45
46 aarectangle closeRectangle;
47 aarectangle minimizeRectangle;
48 aarectangle maximizeRectangle;
49
50 glyph_ids closeWindowGlyph;
51 glyph_ids minimizeWindowGlyph;
52 glyph_ids maximizeWindowGlyph;
53 glyph_ids restoreWindowGlyph;
54
55 aarectangle closeWindowGlyphRectangle;
56 aarectangle minimizeWindowGlyphRectangle;
57 aarectangle maximizeWindowGlyphRectangle;
58 aarectangle restoreWindowGlyphRectangle;
59
60 bool hoverClose = false;
61 bool hoverMinimize = false;
62 bool hoverMaximize = false;
63
64 bool pressedClose = false;
65 bool pressedMinimize = false;
66 bool pressedMaximize = false;
67
68 void drawMacOS(draw_context const& context) noexcept;
69 void drawWindows(draw_context const& context) noexcept;
70};
71
72}} // namespace hi::v1
Defines widget.
DOXYGEN BUG.
Definition algorithm.hpp:15
The HikoGUI namespace.
Definition ascii.hpp:19
A user interface event.
Definition gui_event.hpp:66
An interactive graphical object as part of the user-interface.
Definition widget.hpp:44
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:198
widget *const parent
Pointer to the parent widget.
Definition widget.hpp:53
widget(gui_window &window, widget *parent) noexcept
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:48
The constraints of a widget.
Definition widget_constraints.hpp:26
The layout of a widget.
Definition widget_layout.hpp:37
Window control button widget.
Definition window_traffic_lights_widget.hpp:26