-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPendisplay.hpp
107 lines (89 loc) · 3.47 KB
/
Pendisplay.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
//
// AmigaOS MUI C++ wrapper
//
// (c) 2022-2024 TDolphin
//
#pragma once
#include "Area.hpp"
#include "Core/RGBColor.hpp"
namespace MUI
{
class Pendisplay : public Area
{
public:
explicit Pendisplay(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_Pendisplay_Pen ]
unsigned long getPen() const;
/// @brief [ @b MUIA_Pendisplay_Reference ]
Object *getReference() const;
/// @brief [ @b MUIA_Pendisplay_RGBcolor ]
RGBColor getRGBcolor() const;
/// @brief [ @b MUIA_Pendisplay_Spec ]
struct MUI_PenSpec *getSpec() const;
/// @brief [ @b MUIA_Pendisplay_Reference ]
Pendisplay &setReference(const Object *reference);
/// @brief [ @b MUIA_Pendisplay_RGBcolor ]
Pendisplay &setRGBcolor(const RGBColor &rgbColor);
/// @brief [ @b MUIA_Pendisplay_Spec ]
Pendisplay &setSpec(const struct MUI_PenSpec *spec);
// methods, some returns object reference
/// @brief [ @b MUIM_Pendisplay_SetColormap ]
Pendisplay &SetColormap(const long colormap);
/// @brief [ @b MUIM_Pendisplay_SetMUIPen ]
Pendisplay &SetMUIPen(const long muipen);
/// @brief [ @b MUIM_Pendisplay_SetRGB ]
Pendisplay &SetRGB(const unsigned char red, const unsigned char green, const unsigned char blue);
};
template <typename T, typename U> class PendisplayBuilderTemplate : public AreaBuilderTemplate<T, U>
{
public:
PendisplayBuilderTemplate(const std::string &uniqueId = MUI::EmptyUniqueId, const std::string &muiClassName = MUIC_Pendisplay)
: AreaBuilderTemplate<T, U>(uniqueId, muiClassName)
{
}
/// @brief [ @b MUIA_Pendisplay_Reference ]
/// display exactly this pen, don't allocate one on your own
T &tagReference(const Object *reference);
/// @brief [ @b MUIA_Pendisplay_RGBcolor ]
/// set a pen spec via RGB values
T &tagRGBcolor(const RGBColor &rgbColor);
/// @brief [ @b MUIA_Pendisplay_Spec ]
/// specifies a drawing pen which should be displayed
T &tagSpec(const struct MUI_PenSpec *spec);
};
class PendisplayBuilder : public PendisplayBuilderTemplate<PendisplayBuilder, Pendisplay>
{
public:
PendisplayBuilder();
};
template <typename T, typename U> inline T &PendisplayBuilderTemplate<T, U>::tagReference(const Object *reference)
{
this->PushTag(MUIA_Pendisplay_Reference, reference);
return (T &)*this;
}
template <typename T, typename U> inline T &PendisplayBuilderTemplate<T, U>::tagRGBcolor(const RGBColor &rgbColor)
{
#if MUIMASTER_VMIN >= 20 // MUI5
MUI_RGBColor rgb { rgbColor.red32bit(), rgbColor.green32bit(), rgbColor.blue32bit() };
#else
MUI_RGBcolor rgb { rgbColor.red32bit(), rgbColor.green32bit(), rgbColor.blue32bit() };
#endif
this->PushTag(MUIA_Pendisplay_RGBcolor, &rgb);
return (T &)*this;
}
template <typename T, typename U> inline T &PendisplayBuilderTemplate<T, U>::tagSpec(const MUI_PenSpec *spec)
{
this->PushTag(MUIA_Pendisplay_Spec, spec);
return (T &)*this;
}
}