blob: e29bd3d66f0ec6e028321b68a600de5b88578584 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#pragma once
#include <notifier.h>
#include "font.h"
#include "powerbutton.h"
#include "widget.h"
namespace GUI
{
class FrameWidget
: public Widget
{
public:
FrameWidget(Widget* parent, bool has_switch = false);
virtual ~FrameWidget() = default;
virtual bool isFocusable() override { return false; }
virtual bool catchMouse() override { return false; }
bool isSwitchedOn() { return is_switched_on; }
void setTitle(std::string const& title);
void setContent(Widget* content);
void setOnSwitch(bool on);
void setEnabled(bool enabled);
Notifier<bool> onSwitchChangeNotifier;
Notifier<bool> onEnabledChanged;
protected:
virtual void repaintEvent(RepaintEvent* repaintEvent) override;
void sizeChanged(int width, int height);
bool enabled = true;
private:
Font font;
std::string title;
GUI::Colour label_colour{0.1};
GUI::Colour label_colour_disabled{0.5};
std::size_t label_width;
bool is_switched_on;
PowerButton power_button{this};
void powerButtonStateChanged(bool clicked);
int bar_height;
GUI::Colour grey_box_colour{0.7};
GUI::Colour grey_box_colour_disabled{0.7};
GUI::Colour background_colour{0.85, 0.8};
GUI::Colour frame_colour_top{0.95};
GUI::Colour frame_colour_bottom{0.4};
GUI::Colour frame_colour_side{0.6};
Widget* content{nullptr};
int content_margin{12};
int content_start_x;
int content_start_y;
int content_width;
int content_height;
};
}
|