-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGauge.hpp
125 lines (107 loc) · 3.69 KB
/
Gauge.hpp
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
113
114
115
116
117
118
119
120
121
122
123
124
125
//
// AmigaOS MUI C++ wrapper
//
// (c) 2022-2024 TDolphin
//
#pragma once
#include "Area.hpp"
namespace MUI
{
class Gauge : public Area
{
public:
explicit Gauge(Object *pMuiObject)
: Area(pMuiObject)
{
}
// instanceOf
const static std::string className;
static inline bool instanceOf(Object *pMuiObject)
{
return MUI::instanceOf(pMuiObject, className.c_str());
}
// is/get/set (attributes), all setters return object reference
/// @brief [ @b MUIA_Gauge_Current ]
long getCurrent() const;
/// @brief [ @b MUIA_Gauge_Divide ]
unsigned long getDivide() const;
#ifdef MUIA_Gauge_InfoRate
/// @brief [ @b MUIA_Gauge_InfoRate ]
long getInfoRate() const;
#endif
/// @brief [ @b MUIA_Gauge_InfoText ]
std::string getInfoText() const;
/// @brief [ @b MUIA_Gauge_Max ]
long getMax() const;
/// @brief [ @b MUIA_Gauge_Current ]
Gauge &setCurrent(const long current);
/// @brief [ @b MUIA_Gauge_Divide ]
Gauge &setDivide(const unsigned long divide);
#ifdef MUIA_Gauge_InfoRate
/// @brief [ @b MUIA_Gauge_InfoRate ]
Gauge &setInfoRate(const long InfoRate);
#endif
/// @brief [ @b MUIA_Gauge_InfoText ]
Gauge &setInfoText(const std::string &infoText);
/// @brief [ @b MUIA_Gauge_Max ]
Gauge &setMax(const long max);
};
template <typename T, typename U> class GaugeBuilderTemplate : public AreaBuilderTemplate<T, U>
{
public:
GaugeBuilderTemplate(const std::string &uniqueId = MUI::EmptyUniqueId, const std::string &muiClassName = MUIC_Gauge)
: AreaBuilderTemplate<T, U>(uniqueId, muiClassName)
{
}
/// @brief [ @b MUIA_Gauge_Current ]
T &tagCurrent(const long current);
/// @brief [ @b MUIA_Gauge_Divide ]
T &tagDivide(const unsigned long divide);
/// @brief [ @b MUIA_Gauge_Horiz ]
T &tagHoriz(const bool horiz);
/// @brief [ @b MUIA_Gauge_InfoRate ]
T &tagInfoRate(const long infoRate);
/// @brief [ @b MUIA_Gauge_InfoText ]
T &tagInfoText(const std::string &infoText);
/// @brief [ @b MUIA_Gauge_Max ]
T &tagMax(const long max);
};
class GaugeBuilder : public GaugeBuilderTemplate<GaugeBuilder, Gauge>
{
public:
GaugeBuilder();
};
template <typename T, typename U> inline T &GaugeBuilderTemplate<T, U>::tagCurrent(const long current)
{
this->PushTag(MUIA_Gauge_Current, current);
return (T &)*this;
}
template <typename T, typename U> inline T &GaugeBuilderTemplate<T, U>::tagDivide(const unsigned long divide)
{
this->PushTag(MUIA_Gauge_Divide, divide);
return (T &)*this;
}
template <typename T, typename U> inline T &GaugeBuilderTemplate<T, U>::tagHoriz(const bool horiz)
{
this->PushTag(MUIA_Gauge_Horiz, horiz);
return (T &)*this;
}
#ifdef MUIA_Gauge_InfoRate
template <typename T, typename U> inline T &GaugeBuilderTemplate<T, U>::tagInfoRate(const long infoRate)
{
this->PushTag(MUIA_Gauge_InfoRate, infoRate);
return (T &)*this;
}
#endif
template <typename T, typename U> inline T &GaugeBuilderTemplate<T, U>::tagInfoText(const std::string &infoText)
{
auto copy = this->StoreString(MUIA_Gauge_InfoText, infoText);
this->PushTag(MUIA_Gauge_InfoText, copy);
return (T &)*this;
}
template <typename T, typename U> inline T &GaugeBuilderTemplate<T, U>::tagMax(const long max)
{
this->PushTag(MUIA_Gauge_Max, max);
return (T &)*this;
}
}