HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
attributes.hpp
1// Copyright 2019 Pokitec
2// All rights reserved.
3
4#pragma once
5
6#include "TTauri/Foundation/required.hpp"
7
8namespace tt {
9
10enum class VerticalAlignment {
11 Top,
12 Middle,
13 Bottom
14};
15
16enum class HorizontalAlignment {
17 Left,
18 Center,
19 Right
20};
21
22enum class Alignment {
23 TopLeft,
24 TopCenter,
25 TopRight,
26 MiddleLeft,
27 MiddleCenter,
28 MiddleRight,
29 BottomLeft,
30 BottomCenter,
31 BottomRight
32};
33
34enum class LineJoinStyle {
35 Bevel,
36 Miter,
37 Rounded
38};
39
40inline Alignment operator|(VerticalAlignment lhs, HorizontalAlignment rhs) noexcept
41{
42 switch (lhs) {
43 case VerticalAlignment::Top:
44 switch (rhs) {
45 case HorizontalAlignment::Left: return Alignment::TopLeft;
46 case HorizontalAlignment::Center: return Alignment::TopCenter;
47 case HorizontalAlignment::Right: return Alignment::TopRight;
48 default: tt_no_default;
49 }
50 case VerticalAlignment::Middle:
51 switch (rhs) {
52 case HorizontalAlignment::Left: return Alignment::MiddleLeft;
53 case HorizontalAlignment::Center: return Alignment::MiddleCenter;
54 case HorizontalAlignment::Right: return Alignment::MiddleRight;
55 default: tt_no_default;
56 }
57 case VerticalAlignment::Bottom:
58 switch (rhs) {
59 case HorizontalAlignment::Left: return Alignment::BottomLeft;
60 case HorizontalAlignment::Center: return Alignment::BottomCenter;
61 case HorizontalAlignment::Right: return Alignment::BottomRight;
62 default: tt_no_default;
63 }
64 default: tt_no_default;
65 }
66}
67
68inline Alignment operator|(HorizontalAlignment lhs, VerticalAlignment rhs) noexcept
69{
70 return rhs | lhs;
71}
72
73inline bool operator==(Alignment lhs, HorizontalAlignment rhs) noexcept
74{
75 switch (rhs) {
76 case HorizontalAlignment::Left:
77 return
78 lhs == Alignment::TopLeft ||
79 lhs == Alignment::MiddleLeft ||
80 lhs == Alignment::BottomLeft;
81
82 case HorizontalAlignment::Center:
83 return
84 lhs == Alignment::TopCenter ||
85 lhs == Alignment::MiddleCenter ||
86 lhs == Alignment::BottomCenter;
87
88 case HorizontalAlignment::Right:
89 return
90 lhs == Alignment::TopRight ||
91 lhs == Alignment::MiddleRight ||
92 lhs == Alignment::BottomRight;
93
94 default: tt_no_default;
95 }
96}
97
98inline bool operator==(Alignment lhs, VerticalAlignment rhs) noexcept
99{
100 switch (rhs) {
101 case VerticalAlignment::Top:
102 return
103 lhs == Alignment::TopLeft ||
104 lhs == Alignment::TopCenter ||
105 lhs == Alignment::TopRight;
106
107 case VerticalAlignment::Middle:
108 return
109 lhs == Alignment::MiddleLeft ||
110 lhs == Alignment::MiddleCenter ||
111 lhs == Alignment::MiddleRight;
112
113 case VerticalAlignment::Bottom:
114 return
115 lhs == Alignment::BottomLeft ||
116 lhs == Alignment::BottomCenter ||
117 lhs == Alignment::BottomRight;
118
119 default: tt_no_default;
120 }
121}
122
123inline bool operator!=(Alignment lhs, HorizontalAlignment rhs) noexcept
124{
125 return !(lhs == rhs);
126}
127
128inline bool operator!=(Alignment lhs, VerticalAlignment rhs) noexcept
129{
130 return !(lhs == rhs);
131}
132
133}
T operator!=(T... args)