-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathDim.h
130 lines (109 loc) · 3.29 KB
/
Dim.h
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
126
127
128
129
130
// Copyright (c) 2023 Hugo Amiard [email protected]
// This software is provided 'as-is' under the zlib License, see the LICENSE.txt file.
// This notice and the license may not be removed or altered from any source distribution.
#pragma once
#include <ui/Forward.h>
namespace two
{
//export_ enum class refl_ Dim : unsigned int
//{
// X = 0,
// Y = 1,
// None = 2,
// Count
//};
inline Axis flip(Axis dim) { return dim == Axis::X ? Axis::Y : Axis::X; }
export_ enum class refl_ FlowAxis : unsigned int
{
Reading = 0,
Paragraph = 1,
Same = 2,
Flip = 3,
None = 4,
};
export_ enum class refl_ Pivot : unsigned int
{
Forward = 0,
Reverse = 1
};
export_ enum class refl_ Align : unsigned int
{
Left = 0,
Center = 1,
Right = 2,
OutLeft = 3,
OutRight = 4,
Count
};
extern table<Align, float> c_align_extent;
extern table<Align, float> c_align_space;
export_ enum class refl_ Solver : unsigned int
{
Frame = 0,
Row = 1,
Grid = 2,
Table = 3,
};
export_ enum class refl_ AutoLayout : unsigned int
{
None = 0,
Size = 1,
Layout = 2
};
export_ enum class refl_ LayoutFlow : unsigned int
{
Flow = 0, // AutoLayout::Layout
Overlay = 1, // AutoLayout::Size
Align = 2, // AutoLayout::Position
Free = 3 // AutoLayout::None
};
export_ enum class refl_ Sizing : unsigned int
{
Fixed,
Shrink,
Wrap,
Expand
};
export_ enum class refl_ Preset : unsigned int
{
Sheet, // Paragraph direction, Sizing::Wrap length, Sizing::Wrap depth
Flex, // Same direction, Sizing::Wrap length, Sizing::Wrap depth
Item, // Reading direction, Sizing::Shrink length, Sizing::Shrink depth
Unit, // Paragraph direction, Sizing::Shrink length, Sizing::Shrink depth
Block, // Paragraph direction, Sizing::Fixed length, Sizing::Fixed depth
Line, // Reading direction, Sizing::Wrap length, Sizing::Shrink depth
Stack, // Paragraph direction, Sizing::Shrink length, Sizing::Wrap depth
Div, // Flip direction, Sizing::Wrap length, Sizing::Shrink depth
Spacer, // Same direction, Sizing::Wrap length, Sizing::Shrink depth
Board, // Reading direction, Sizing::Expand length, Sizing::Expand depth
Layout // Paragraph direction, Sizing::Expand length, Sizing::Expand depth
};
export_ struct refl_ TWO_UI_EXPORT Space
{
attr_ FlowAxis direction;
attr_ Sizing sizingLength;
attr_ Sizing sizingDepth;
Space(FlowAxis dir, Sizing length, Sizing depth) : direction(dir), sizingLength(length), sizingDepth(depth) {}
Space(Preset preset = Preset::Flex) { *this = Space::preset(preset); }
bool operator==(const Space& other) const { return direction == other.direction && sizingLength == other.sizingLength && sizingDepth == other.sizingDepth; }
static Space preset(Preset preset);
};
extern Space SpacePresets[11];
export_ enum class refl_ Clip : unsigned int
{
None = 0,
Clip = 1,
Unclip = 2
};
export_ enum class refl_ Opacity : unsigned int
{
Opaque = 0,
Clear = 1,
Hollow = 2
};
extern template struct refl_ array_ struct_ v2<bool>;
extern template struct refl_ array_ struct_ v2<AutoLayout>;
extern template struct refl_ array_ struct_ v2<Sizing>;
extern template struct refl_ array_ struct_ v2<Align>;
extern template struct refl_ array_ struct_ v2<Pivot>;
}