4 #include "../../color.h"
5 #include "../../font.h"
10 enum OverflowType : uint8_t {
12 OVERFLOW_TYPE_VISIBLE,
16 enum TextAlignment : uint8_t {
18 TEXT_ALIGNMENT_CENTER,
22 enum ResizeMode : uint8_t {
24 RESIZE_MODE_FIXED_WIDTH,
25 RESIZE_MODE_FIXED_HEIGHT,
26 RESIZE_MODE_FIT_CONTENT
29 enum WrapMode : uint8_t {
34 enum ChangeFocusBehaviour : uint8_t {
35 FOCUS_THIS_IF_NONE_FOCUSED = 0x1,
36 FOCUS_NONE_IF_NONE_FOCUSED = 0x2
51 Px(
const unsigned int& rhs):
54 Px(
const uint16_t& rhs):
57 Px(
const long unsigned int& rhs):
61 explicit Px(
const double& rhs):
64 explicit Px(
const float& rhs):
67 explicit operator bool()
const {
71 Px& operator=(
const int rhs) {
76 Px operator-()
const {
80 bool operator>=(
const Px& rhs)
const {
81 return value >= rhs.value;
84 bool operator>(
const Px& rhs)
const {
85 return value > rhs.value;
88 bool operator<(
const Px& rhs)
const {
89 return value < rhs.value;
92 bool operator>(
const int rhs)
const {
96 bool operator==(
const int16_t rhs)
const {
100 bool operator==(
const Px& rhs)
const {
101 return value == rhs.value;
104 bool operator!=(
const Px& rhs)
const {
105 return !((*this) == rhs);
108 bool operator<(
const int rhs)
const {
112 Px operator*(
const int rhs)
const {
113 return Px(value * rhs);
116 Px operator/(
const int rhs)
const {
117 return Px(value / rhs);
120 Px operator+(
const int rhs)
const {
121 return Px(value + rhs);
124 Px operator+(
const uint16_t rhs)
const {
125 return Px(value + rhs);
128 Px operator-(
const uint16_t rhs)
const {
129 return Px(value - rhs);
132 Px& operator+=(
const Px& rhs) {
137 Px& operator-=(
const Px& rhs) {
142 Px operator+(
const Px& rhs)
const {
143 return Px(value + rhs.value);
146 Px operator-(
const Px& rhs)
const {
147 return Px(value - rhs.value);
150 Px& operator=(
const int& rhs) {
155 Px operator*(
const Rem& rhs)
const;
157 Px operator*(
const uint32_t x)
const {
158 return Px(value * x);
161 Px operator/(
const uint32_t x)
const {
162 return Px(value / x);
166 inline bool operator<(
const int& lhs,
const Px& rhs) {
167 return lhs < rhs.value;
170 inline Px operator+(
const int& lhs,
const Px& rhs) {
171 return Px(lhs + rhs.value);
174 inline Px operator-(
const int& lhs,
const Px& rhs) {
175 return Px(lhs - rhs.value);
185 bool operator==(
const UICoord& rhs)
const {
186 return x == rhs.x && y == rhs.y;
198 width(width), height(height) {}
209 inline std::ostream& operator<<(std::ostream& stream,
const Px& value) {
210 return (stream << value.value);
213 inline bool operator==(
const int16_t& lhs,
const Px& rhs) {
214 return lhs == rhs.value;
217 inline bool operator!=(
const int16_t& lhs,
const Px& rhs) {
218 return lhs != rhs.value;
226 explicit Rem(
float r):
243 extern const char* DEFAULT_FONT_FAMILY;
244 extern const Px DEFAULT_FONT_SIZE;
247 static const Color ALICE_BLUE;
248 static const Color LIGHT_GREY;
249 static const Color DODGER_BLUE;
251 std::string font_family_ =
"";
252 Px font_size_ =
Px(0);
254 Rem line_height_ =
Rem(1.5f);
256 Color foreground_color_ = Color::from_bytes(40, 40, 40, 255);
257 Color background_color_ = Color::from_bytes(53, 53, 53, 255);
258 Color text_color_ = Color::from_bytes(219, 219, 219, 255);
259 Color highlight_color_ = Color::from_bytes(0, 51, 102, 255);
261 ResizeMode label_resize_mode_ = RESIZE_MODE_FIT_CONTENT;
262 ResizeMode button_resize_mode_ = RESIZE_MODE_FIT_CONTENT;
264 uint8_t scrollbar_width_ = 16;
265 Color scrollbar_background_color_ = background_color_;
266 Color scrollbar_foreground_color_ = foreground_color_;
280 Px button_border_width_ =
Px(0);
281 Px button_border_radius_ =
Px(4);
284 Px image_border_width_ =
Px(0);
293 Px progress_bar_border_width_ =
Px(2);
298 Px frame_border_width_ =
Px(2);
301 OverflowType default_overflow_ = OVERFLOW_TYPE_HIDDEN;
302 ResizeMode default_resize_mode_ = RESIZE_MODE_FIXED;