12
12
13
13
namespace gui ::elements
14
14
{
15
+ /* *
16
+ * @todo Move source code to .cpp.
17
+ */
15
18
class Button final : public ElementBase
16
19
{
17
20
public:
@@ -24,14 +27,50 @@ namespace gui::elements
24
27
void setText (std::string text);
25
28
void setIcon (storage::Path path);
26
29
27
- void setBorderColor (color_t color){m_label->setBorderColor (color);}
28
- void setFontSize (uint16_t r){m_label->setFontSize (r);}
30
+ void setBorderColor (color_t color) {
31
+ if (m_label == nullptr ) {
32
+ return ;
33
+ }
34
+
35
+ m_label->setBorderColor (color);
36
+ }
37
+ void setFontSize (uint16_t r) {
38
+ if (m_label == nullptr ) {
39
+ return ;
40
+ }
41
+
42
+ m_label->setFontSize (r);
43
+ }
29
44
30
- void setBackgroundColor (color_t color){ m_label->setBackgroundColor (color);}
45
+ void setBackgroundColor (color_t color) {
46
+ if (m_label == nullptr ) {
47
+ return ;
48
+ }
49
+
50
+ m_label->setBackgroundColor (color);
51
+ }
52
+
53
+ void setVerticalAlignment (Label::Alignement alignment) {
54
+ if (m_label == nullptr ) {
55
+ return ;
56
+ }
57
+
58
+ m_label->setVerticalAlignment (alignment);
59
+ }
60
+ void setHorizontalAlignment (Label::Alignement alignment) {
61
+ if (m_label == nullptr ) {
62
+ return ;
63
+ }
64
+
65
+ m_label->setHorizontalAlignment (alignment);
66
+ }
67
+ void setTextColor (color_t color) {
68
+ if (m_label == nullptr ) {
69
+ return ;
70
+ }
31
71
32
- void setVerticalAlignment (Label::Alignement alignment){ m_label->setVerticalAlignment (alignment); }
33
- void setHorizontalAlignment (Label::Alignement alignment){ m_label->setHorizontalAlignment (alignment); }
34
- void setTextColor (color_t color){ m_label->setTextColor (color); }
72
+ m_label->setTextColor (color);
73
+ }
35
74
36
75
37
76
std::string getText ();
0 commit comments