2 #include <xtd/argument_out_of_range_exception.h> 4 #include "dot_matrix_display.h" 6 #include "nine_segment_display.h" 7 #include "seven_segment_display.h" 8 #include "fourteen_segment_display.h" 9 #include "sixteen_segment_display.h" 18 virtual wchar_t get_character()
const = 0;
19 virtual std::string get_valid_characters()
const = 0;
20 virtual int32_t get_thickness()
const = 0;
22 virtual void set_background_digit_transparency(
double value) = 0;
23 virtual void set_character(
wchar_t value) = 0;
24 virtual void set_segment_style(forms::segment_style value) = 0;
25 virtual void set_dot_matrix_style(forms::dot_matrix_style value) = 0;
26 virtual void set_show_background_digit(
bool value) = 0;
27 virtual void set_thickness(int32_t value) = 0;
32 dot_matrix_display_digit() =
default;
34 wchar_t get_character()
const override {
return character_;}
35 std::string get_valid_characters()
const override {
return "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=+-*/%\\_°\"'[](){}<>| .,:;!?&$€";}
36 int32_t get_thickness()
const override {
return dot_matrix_display::thickness();}
38 void set_background_digit_transparency(
double value)
override {dot_matrix_display::background_dot_transparency(value);}
39 void set_character(
wchar_t value)
override {
40 static std::map<wchar_t, dot_matrix_display::dot_collection> characters {
41 {
'0', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {4, 2}, {5, 2}, {1, 3}, {3, 3}, {5, 3}, {1, 4}, {2, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
42 {
'1', {{3, 0}, {2, 1}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}}},
43 {
'2', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {5, 2}, {4, 3}, {3, 4}, {2, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
44 {
'3', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {5, 2}, {2, 3}, {3, 3}, {4, 3}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
45 {
'4', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {5, 4}, {5, 5}, {5, 6}}},
46 {
'5', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {1, 1}, {1, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 4}, {5, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}},
47 {
'6', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {1, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
48 {
'7', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 1}, {5, 2}, {4, 3}, {4, 4}, {3, 5}, {3, 6}}},
49 {
'8', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
50 {
'9', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {2, 3}, {3, 3}, {4, 3}, {5, 4}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
51 {
'A', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
52 {
'B', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}},
53 {
'C', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 6}, {3, 6}, {5, 5}, {4, 6}}},
54 {
'D', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}},
55 {
'E', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {1, 1}, {1, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {1, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
56 {
'F', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {1, 1}, {1, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {1, 5}, {1, 6}}},
57 {
'G', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {1, 2}, {1, 3}, {4, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
58 {
'H', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
59 {
'I', {{3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}}},
60 {
'J', {{5, 0}, {5, 1}, {5, 2}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
61 {
'K', {{1, 0}, {5, 0}, {1, 1}, {4, 1}, {1, 2}, {3, 2}, {1, 3}, {2, 3}, {1, 4}, {3, 4}, {1, 5}, {4, 5}, {1, 6}, {5, 6}}},
62 {
'L', {{1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
63 {
'M', {{1, 0}, {5, 0}, {1, 1}, {2, 1}, {4, 1}, {5, 1}, {1, 2}, {3, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
64 {
'N', {{1, 0}, {5, 0}, {1, 1}, {2, 1}, {5, 1}, {1, 2}, {3, 2}, {5, 2}, {1, 3}, {4, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
65 {
'O', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
66 {
'P', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {1, 5}, {1, 6}}},
67 {
'Q', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {4, 5}, {2, 6}, {3, 6}, {5, 6}}},
68 {
'R', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {1, 4}, {3, 4}, {1, 5}, {4, 5}, {1, 6}, {5, 6}}},
69 {
'S', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {2, 3}, {3, 3}, {4, 3}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
70 {
'T', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}}},
71 {
'U', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
72 {
'V', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {2, 3}, {4, 3}, {2, 4}, {4, 4}, {3, 5}, {3, 6}}},
73 {
'W', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {1, 2}, {3, 2}, {5, 2}, {1, 3}, {3, 3}, {5, 3}, {1, 4}, {3, 4}, {5, 4}, {1, 5}, {2, 5}, {4, 5}, {5, 5}, {1, 6}, {5, 6}}},
74 {
'X', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {2, 2}, {4, 2}, {3, 3}, {2, 4}, {4, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
75 {
'Y', {{1, 0}, {5, 0}, {1, 1}, {5, 1}, {2, 2}, {4, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}}},
76 {
'Z', {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 1}, {4, 2}, {3, 3}, {2, 4}, {1, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
77 {
'a', {{2, 2}, {3, 2}, {4, 2}, {5, 3}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
78 {
'b', {{1, 0}, {1, 1}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}},
79 {
'c', {{2, 2}, {3, 2}, {4, 2}, {5, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
80 {
'd', {{5, 0}, {5, 1}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
81 {
'e', {{2, 2}, {3, 2}, {4, 2}, {1, 3}, {5, 3}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {1, 5}, {2, 6}, {3, 6}, {4, 6}}},
82 {
'f', {{3, 0}, {4, 0}, {2, 1}, {2, 2}, {3, 2}, {2, 3}, {2, 4}, {2, 5}, {2, 6}}},
83 {
'g', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
84 {
'h', {{1, 0}, {1, 1}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
85 {
'i', {{3, 0}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}}},
86 {
'j', {{4, 0}, {4, 2}, {4, 3}, {4, 4}, {4, 5}, {2, 6}, {3, 6}}},
87 {
'k', {{1, 0}, {1, 1}, {1, 2}, {5, 2}, {1, 3}, {4, 3}, {1, 4}, {2, 4}, {3, 4}, {1, 5}, {4, 5}, {1, 6}, {5, 6}}},
88 {
'l', {{3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {4, 6}}},
89 {
'm', {{2, 2}, {4, 2}, {1, 3}, {3, 3}, {5, 3}, {1, 4}, {3, 4}, {5, 4}, {1, 5}, {3, 5}, {5, 5}, {1, 6}, {3, 6}, {5, 6}}},
90 {
'n', {{2, 2}, {3, 2}, {4, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {1, 6}, {5, 6}}},
91 {
'o', {{2, 2}, {3, 2}, {4, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
92 {
'p', {{1, 1}, {2, 1}, {3, 1}, {4, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {1, 5}, {1, 6}}},
93 {
'q', {{2, 1}, {3, 1}, {4, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {5, 5}, {5, 6}}},
94 {
'r', {{2, 2}, {3, 2}, {4, 2}, {5, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}}},
95 {
's', {{2, 2}, {3, 2}, {4, 2}, {5, 2}, {1, 3}, {2, 4}, {3, 4}, {4, 4}, {5, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}},
96 {
't', {{3, 0}, {3, 1}, {2, 2}, {3, 2}, {4, 2}, {3, 3}, {3, 4}, {3, 5}, {4, 6}, {5, 6}}},
97 {
'u', {{1, 2}, {5, 2}, {1, 3}, {5, 3}, {1, 4}, {5, 4}, {1, 5}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
98 {
'v', {{1, 2}, {5, 2}, {1, 3}, {5, 3}, {2, 4}, {4, 4}, {2, 5}, {4, 5}, {3, 6}}},
99 {
'w', {{1, 2}, {3, 2}, {5, 2}, {1, 3}, {3, 3}, {5, 3}, {1, 4}, {3, 4}, {5, 4}, {1, 5}, {3, 5}, {5, 5}, {2, 6}, {4, 6}}},
100 {
'x', {{1, 2}, {5, 2}, {2, 3}, {4, 3}, {3, 4}, {2, 5}, {4, 5}, {1, 6}, {5, 6}}},
101 {
'y', {{1, 1}, {5, 1}, {1, 2}, {5, 2}, {1, 3}, {5, 3}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {5, 5}, {2, 6}, {3, 6}, {4, 6}}},
102 {
'z', {{1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {4, 3}, {3, 4}, {2, 5}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
103 {
'=', {{1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}},
104 {
'+', {{3, 1}, {3, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {3, 4}, {3, 5}}},
105 {
'-', {{1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}},
106 {
'*', {{3, 0}, {1, 1}, {3, 1}, {5, 1}, {2, 2}, {3, 2}, {4, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {2, 4}, {3, 4}, {4, 4}, {1, 5}, {3, 5}, {5, 5}, {3, 6}}},
107 {
'/', {{5, 1}, {4, 2}, {3, 3}, {2, 4}, {1, 5}}},
108 {
'%', {{1, 0}, {2, 0}, {1, 1}, {2, 1}, {5, 1}, {4, 2}, {3, 3}, {2, 4}, {1, 5}, {4, 5}, {5, 5}, {4, 6}, {5, 6}}},
109 {
'\\', {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}},
110 {
'_', {{1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}},
111 {L
'\u00B0', {{2, 0}, {3, 0}, {1, 1}, {4, 1}, {1, 2}, {4, 2}, {2, 3}, {3, 3}}},
112 {
'"', {{2, 0}, {5, 0}, {2, 1}, {5, 1}, {1, 2}, {4, 2}}},
113 {
'\'', {{3, 0}, {3, 1}, {2, 2}}},
114 {
'[', {{3, 0}, {4, 0}, {5, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}, {4, 6}, {5, 6}}},
115 {
']', {{1, 0}, {2, 0}, {3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {1, 6}, {2, 6}, {3, 6}}},
116 {
'(', {{4, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {4, 6}}},
117 {
')', {{2, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {2, 6}}},
118 {
'{', {{4, 0}, {5, 0}, {3, 1}, {3, 2}, {2, 3}, {3, 4}, {3, 5}, {4, 6}, {5, 6}}},
119 {
'}', {{1, 0}, {2, 0}, {3, 1}, {3, 2}, {4, 3}, {3, 4}, {3, 5}, {1, 6}, {2, 6}}},
120 {
'<', {{4, 1}, {3, 2}, {2, 3}, {3, 4}, {4, 5}}},
121 {
'>', {{2, 1}, {3, 2}, {4, 3}, {3, 4}, {2, 5}}},
122 {
'|', {{3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}}},
125 {
',', {{3, 5}, {2, 6}}},
126 {
':', {{3, 1}, {3, 5}}},
127 {
';', {{3, 2}, {3, 5}, {2, 6}}},
128 {
'!', {{3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 6}}},
129 {
'?', {{2, 0}, {3, 0}, {4, 0}, {1, 1}, {5, 1}, {5, 2}, {4, 3}, {3, 4}, {3, 6}}},
130 {
'&', {{2, 0}, {3, 0}, {1, 1}, {4, 1}, {1, 2}, {4, 2}, {2, 3}, {3, 3}, {5, 3}, {1, 4}, {4, 4}, {1, 5}, {4, 5}, {2, 6}, {3, 6}, {5, 6}}},
131 {
'$', {{3, 0}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {1, 2}, {3, 2}, {2, 3}, {3, 3}, {4, 3}, {3, 4}, {5, 4}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {3, 6}}},
132 {L
'\u20AC', {{3, 0}, {4, 0}, {5, 0}, {2, 1}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {2, 3}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {2, 5}, {3, 6}, {4, 6}, {5, 6}}},
134 if (character_ != value) {
137 dot_matrix_display::dots(characters[value]);
140 void set_segment_style(forms::segment_style value)
override {}
141 void set_dot_matrix_style(forms::dot_matrix_style value)
override {dot_matrix_display::dot_matrix_style(value);}
142 void set_show_background_digit(
bool value)
override {dot_matrix_display::show_background_dot(value);}
143 void set_thickness(int32_t value)
override {dot_matrix_display::thickness(value);}
146 wchar_t character_ =
' ';
151 fourteen_segment_display_digit() =
default;
153 wchar_t get_character()
const override {
return character_;}
154 std::string get_valid_characters()
const override {
return "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=+-*/\\_°\"'[]()| .,:";}
155 int32_t get_thickness()
const override {
return fourteen_segment_display::thickness();}
157 void set_background_digit_transparency(
double value)
override {fourteen_segment_display::background_segment_transparency(value);}
158 void set_character(
wchar_t value)
override {
159 static std::map<wchar_t, forms::segments> characters {
242 if (character_ != value) {
245 fourteen_segment_display::value(characters[value]);
248 void set_segment_style(forms::segment_style value)
override {fourteen_segment_display::segment_style(value);}
249 void set_dot_matrix_style(forms::dot_matrix_style value)
override {}
250 void set_show_background_digit(
bool value)
override {fourteen_segment_display::show_background_segment(value);}
251 void set_thickness(int32_t value)
override {seven_segment_display::thickness(value);}
254 wchar_t character_ =
' ';
259 nine_segment_display_digit() =
default;
261 wchar_t get_character()
const override {
return character_;}
262 std::string get_valid_characters()
const override {
return "0123456789ABCDEFGHIJLNOPQRSTUYabcdefghijlnopqrstuy=-_°\"'[]| .,:";}
263 int32_t get_thickness()
const override {
return nine_segment_display::thickness();}
265 void set_background_digit_transparency(
double value)
override {nine_segment_display::background_segment_transparency(value);}
266 void set_character(
wchar_t value)
override {
267 static std::map<wchar_t, forms::segments> characters {
330 if (character_ != value) {
333 nine_segment_display::value(characters[value]);
336 void set_segment_style(forms::segment_style value)
override {nine_segment_display::segment_style(value);}
337 void set_dot_matrix_style(forms::dot_matrix_style value)
override {}
338 void set_show_background_digit(
bool value)
override {nine_segment_display::show_background_segment(value);}
339 void set_thickness(int32_t value)
override {seven_segment_display::thickness(value);}
342 wchar_t character_ =
' ';
347 seven_segment_display_digit() =
default;
349 wchar_t get_character()
const override {
return character_;}
350 std::string get_valid_characters()
const override {
return "0123456789ABCDEFGHIJLNOPQRSTUYabcdefghijlnopqrstuy=-_°\"'[]| .,:";}
351 int32_t get_thickness()
const override {
return seven_segment_display::thickness();}
353 void set_background_digit_transparency(
double value)
override {seven_segment_display::background_segment_transparency(value);}
354 void set_character(
wchar_t value)
override {
355 static std::map<wchar_t, forms::segments> characters {
418 if (character_ != value) {
421 seven_segment_display::value(characters[value]);
424 void set_segment_style(forms::segment_style value)
override {seven_segment_display::segment_style(value);}
425 void set_dot_matrix_style(forms::dot_matrix_style value)
override {}
426 void set_show_background_digit(
bool value)
override {seven_segment_display::show_background_segment(value);}
427 void set_thickness(int32_t value)
override {seven_segment_display::thickness(value);}
430 wchar_t character_ =
' ';
435 sixteen_segment_display_digit() =
default;
437 wchar_t get_character()
const override {
return character_;}
438 std::string get_valid_characters()
const override {
return "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=+-*/\\_°\"'[]()| .,:";}
439 int32_t get_thickness()
const override {
return sixteen_segment_display::thickness();}
441 void set_background_digit_transparency(
double value)
override {sixteen_segment_display::background_segment_transparency(value);}
442 void set_character(
wchar_t value)
override {
443 static std::map<wchar_t, forms::segments> characters {
526 if (character_ != value) {
529 sixteen_segment_display::value(characters[value]);
532 void set_segment_style(forms::segment_style value)
override {sixteen_segment_display::segment_style(value);}
533 void set_dot_matrix_style(forms::dot_matrix_style value)
override {}
534 void set_show_background_digit(
bool value)
override {sixteen_segment_display::show_background_segment(value);}
535 void set_thickness(int32_t value)
override {sixteen_segment_display::thickness(value);}
538 wchar_t character_ =
' ';
547 double background_digit_transparency()
const {
return background_digit_transparency_;}
548 lcd_label& background_digit_transparency(
double value) {
550 if (background_digit_transparency_ != value) {
551 background_digit_transparency_ = value;
557 bool show_background_digit()
const {
return show_background_digit_;}
558 lcd_label& show_background_digit(
bool value) {
559 if (show_background_digit_ != value) {
560 show_background_digit_ = value;
566 int32_t digit_spacing()
const {
return digit_spacing_.value_or(lcd_style_ == lcd_style::dot_matrix_display ? 0 : thickness());}
567 lcd_label& digit_spacing(int32_t value) {
569 if (digit_spacing_ != value) {
570 digit_spacing_ = value;
576 forms::lcd_style lcd_style()
const {
return lcd_style_;}
577 lcd_label& lcd_style(forms::lcd_style value) {
578 if (lcd_style_ != value) {
580 std::string current_text =
text();
587 forms::segment_style segment_style()
const {
return segment_style_;}
588 lcd_label& segment_style(forms::segment_style value) {
589 if (segment_style_ != value) {
590 segment_style_ = value;
591 for (
auto& digit : digits_)
592 digit->set_segment_style(value);
597 forms::dot_matrix_style dot_matrix_style()
const {
return dot_matrix_style_;}
598 lcd_label& dot_matrix_style(forms::dot_matrix_style value) {
599 if (dot_matrix_style_ != value) {
600 dot_matrix_style_ = value;
601 for (
auto& digit : digits_)
602 digit->set_dot_matrix_style(value);
607 int32_t thickness()
const {
return thickness_.value_or(digits_.size() ? digits_[0]->get_thickness() : 1);}
609 if (thickness_ != value) {
618 if (text_ != value) {
620 std::wstring str = std::wstring_convert<std::codecvt_utf8<wchar_t>,
wchar_t>().from_bytes(value.c_str());
621 if (str.size() < digits_.size())
622 digits_.erase(digits_.begin() + value.size(), digits_.end());
623 if (str.size() > digits_.size())
624 for (
size_t index = digits_.size(); index < str.size(); index++) {
625 switch (lcd_style_) {
626 case lcd_style::seven_segment_display: digits_.push_back(std::make_shared<seven_segment_display_digit>());
break;
627 case lcd_style::nine_segment_display: digits_.push_back(std::make_shared<nine_segment_display_digit>());
break;
628 case lcd_style::fourteen_segment_display: digits_.push_back(std::make_shared<fourteen_segment_display_digit>());
break;
629 case lcd_style::sixteen_segment_display: digits_.push_back(std::make_shared<sixteen_segment_display_digit>());
break;
630 case lcd_style::dot_matrix_display: digits_.push_back(std::make_shared<dot_matrix_display_digit>());
break;
633 dynamic_cast<control*
>(digits_[digits_.size() - 1].get())->
parent(*
this);
639 for (
size_t index = 0; index < str.size(); index++)
640 digits_[index]->set_character(str[index]);
648 std::string valid_characters() {
649 switch (lcd_style_) {
650 case lcd_style::seven_segment_display:
return std::make_shared<seven_segment_display_digit>()->get_valid_characters();
651 case lcd_style::nine_segment_display:
return std::make_shared<nine_segment_display_digit>()->get_valid_characters();
652 case lcd_style::fourteen_segment_display:
return std::make_shared<fourteen_segment_display_digit>()->get_valid_characters();
653 case lcd_style::sixteen_segment_display:
return std::make_shared<sixteen_segment_display_digit>()->get_valid_characters();
654 case lcd_style::dot_matrix_display:
return std::make_shared<dot_matrix_display_digit>()->get_valid_characters();
662 void set_digits_params() {
663 int32_t offset_left = 0;
664 for (
auto& digit : digits_) {
666 dynamic_cast<control*
>(digit.get())->
left(offset_left);
667 digit->set_background_digit_transparency(background_digit_transparency_);
668 digit->set_show_background_digit(show_background_digit_);
669 digit->set_segment_style(segment_style_);
670 digit->set_dot_matrix_style(dot_matrix_style_);
671 if (thickness_.has_value()) digit->set_thickness(thickness());
672 offset_left +=
dynamic_cast<control*
>(digit.get())->
width() - 2 + digit_spacing();
676 void on_handle_created(
const event_args&
e)
override {
677 control::on_handle_created(e);
681 void on_size_changed(
const event_args& e)
override {
683 control::on_size_changed(e);
686 void on_resize(
const event_args& e)
override {
688 control::on_resize(e);
692 if (digits_.size() == 0)
return {0, size_.
height()};
693 return drawing::size((dynamic_cast<control*>(digits_[0].
get())->
width() - 2 + digit_spacing()) * static_cast<int32_t>(digits_.size()) - digit_spacing() + 2, size_.height());
697 bool show_background_digit_ =
true;
698 double background_digit_transparency_ = 0.05;
699 std::optional<int32_t> digit_spacing_;
700 forms::lcd_style lcd_style_ = forms::lcd_style::seven_segment_display;
701 forms::segment_style segment_style_ = forms::segment_style::standard;
702 forms::dot_matrix_style dot_matrix_style_ = forms::dot_matrix_style::standard;
703 std::vector<std::shared_ptr<idigit>> digits_;
704 std::optional<int32_t> thickness_;
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:9
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:15
#define caller_info_
Get xtd::tunit::caller_info informations.
Definition: caller_info.h:82
int32_t height() const
Gets he vertical component of this Size Class.
Definition: size.h:48
static std::basic_string< char_t > format(const std::basic_string< char_t > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: strings.h:612
The exception that is thrown when one of the arguments provided to a method is not valid...
Definition: argument_exception.h:12
static const event_args empty
Provides a value to use with events that do not have event data.
Definition: event_args.h:23
The exception that is thrown when one of the arguments provided to a method is out of range...
Definition: argument_out_of_range_exception.h:12