HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
window_traffic_lights_widget.hpp
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
5#pragma once
6
7#include "widget.hpp"
8#include "../text/glyph_ids.hpp"
9#include <memory>
10#include <string>
11#include <array>
12
13namespace hi::inline v1 {
14
16public:
17 using super = widget;
18
19 window_traffic_lights_widget(gui_window &window, widget *parent) noexcept;
20
22 widget_constraints const &set_constraints() noexcept override;
23 void set_layout(widget_layout const &layout) noexcept override;
24 void draw(draw_context const &context) noexcept override;
25 bool handle_event(mouse_event const &event) noexcept override;
26 [[nodiscard]] hitbox hitbox_test(point3 position) const noexcept override;
28private:
29 static constexpr float GLYPH_SIZE = 5.0f;
30 static constexpr float RADIUS = 5.5f;
31 static constexpr float DIAMETER = RADIUS * 2.0f;
32 static constexpr float MARGIN = 10.0f;
33 static constexpr float SPACING = 8.0f;
34
35 aarectangle closeRectangle;
36 aarectangle minimizeRectangle;
37 aarectangle maximizeRectangle;
38
39 glyph_ids closeWindowGlyph;
40 glyph_ids minimizeWindowGlyph;
41 glyph_ids maximizeWindowGlyph;
42 glyph_ids restoreWindowGlyph;
43
44 aarectangle closeWindowGlyphRectangle;
45 aarectangle minimizeWindowGlyphRectangle;
46 aarectangle maximizeWindowGlyphRectangle;
47 aarectangle restoreWindowGlyphRectangle;
48
49 bool hoverClose = false;
50 bool hoverMinimize = false;
51 bool hoverMaximize = false;
52
53 bool pressedClose = false;
54 bool pressedMinimize = false;
55 bool pressedMaximize = false;
56
57 void drawMacOS(draw_context const &context) noexcept;
58 void drawWindows(draw_context const &context) noexcept;
59};
60
61} // namespace hi::inline v1
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:51
Definition gui_window.hpp:40
Definition hitbox.hpp:16
Definition mouse_event.hpp:15
A set of glyph-ids of a font which composites into a single glyph.
Definition glyph_ids.hpp:127
An interactive graphical object as part of the user-interface.
Definition widget.hpp:40
Definition widget_constraints.hpp:12
Definition widget_layout.hpp:17
Definition window_traffic_lights_widget.hpp:15