-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate_node.go
188 lines (144 loc) · 5.73 KB
/
template_node.go
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
package pdflexgo
import "github.com/kjk/flex"
func (templateNode *TemplateElement) WidthPercent(width float64) *TemplateElement {
templateNode.getFlexNode().StyleSetWidthPercent(float32(width))
return templateNode
}
func (templateNode *TemplateElement) HeightPercent(height float64) *TemplateElement {
templateNode.getFlexNode().StyleSetHeightPercent(float32(height))
return templateNode
}
// ALIGN SELF
func (templateNode *TemplateElement) AlignSelfType(align Align) *TemplateElement {
templateNode.getFlexNode().StyleSetAlignSelf(flex.Align(align))
return templateNode
}
func (templateNode *TemplateElement) AlignSelfAuto() *TemplateElement {
templateNode.AlignSelfType(AlignAuto)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfStart() *TemplateElement {
templateNode.AlignSelfType(AlignStart)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfCenter() *TemplateElement {
templateNode.AlignSelfType(AlignCenter)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfEnd() *TemplateElement {
templateNode.AlignSelfType(AlignEnd)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfStretch() *TemplateElement {
templateNode.AlignSelfType(AlignStretch)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfBaseline() *TemplateElement {
templateNode.AlignSelfType(AlignBaseline)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfSpaceBetween() *TemplateElement {
templateNode.AlignSelfType(AlignSpaceBetween)
return templateNode
}
func (templateNode *TemplateElement) AlignSelfSpaceAround() *TemplateElement {
templateNode.AlignSelfType(AlignSpaceAround)
return templateNode
}
// FLEX FUNCTIONS
func (templateNode *TemplateElement) FlexGrow(flexGrow float64) *TemplateElement {
templateNode.getFlexNode().StyleSetFlexGrow(float32(flexGrow))
return templateNode
}
func (templateNode *TemplateElement) FlexShrink(flexShrink float64) *TemplateElement {
templateNode.getFlexNode().StyleSetFlexShrink(float32(flexShrink))
return templateNode
}
func (templateNode *TemplateElement) FlexBasis(flexBasis float64) *TemplateElement {
templateNode.getFlexNode().StyleSetFlexBasis(float32(flexBasis))
return templateNode
}
func (templateNode *TemplateElement) FlexBasisPercent(flexBasisPercent float64) *TemplateElement {
templateNode.getFlexNode().StyleSetFlexBasisPercent(float32(flexBasisPercent))
return templateNode
}
func (templateNode *TemplateElement) MinWidth(minWidth float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMinWidth(float32(minWidth))
return templateNode
}
func (templateNode *TemplateElement) MinWidthPercent(minWidthPercent float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMinWidthPercent(float32(minWidthPercent))
return templateNode
}
func (templateNode *TemplateElement) MinHeight(minHeight float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMinHeight(float32(minHeight))
return templateNode
}
func (templateNode *TemplateElement) MinHeightPercent(minHeightPercent float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMinHeightPercent(float32(minHeightPercent))
return templateNode
}
func (templateNode *TemplateElement) MaxWidth(maxWidth float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMaxWidth(float32(maxWidth))
return templateNode
}
func (templateNode *TemplateElement) MaxWidthPercent(maxWidthPercent float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMaxWidthPercent(float32(maxWidthPercent))
return templateNode
}
func (templateNode *TemplateElement) MaxHeight(maxHeight float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMaxHeight(float32(maxHeight))
return templateNode
}
func (templateNode *TemplateElement) MaxHeightPercent(maxHeightPercent float64) *TemplateElement {
templateNode.getFlexNode().StyleSetMaxHeightPercent(float32(maxHeightPercent))
return templateNode
}
// ASPECT RATIO
func (templateNode *TemplateElement) AspectRatio(ratio float64) *TemplateElement {
templateNode.getFlexNode().StyleSetAspectRatio(float32(ratio))
return templateNode
}
// POSITION TYPE
func (templateNode *TemplateElement) PositionType(_type PositionType) *TemplateElement {
templateNode.getFlexNode().StyleSetPositionType(flex.PositionType(_type))
return templateNode
}
func (templateNode *TemplateElement) PositionTypeRelative() *TemplateElement {
templateNode.PositionType(PositionTypeRelative)
return templateNode
}
func (templateNode *TemplateElement) PositionTypeAbsolute() *TemplateElement {
templateNode.PositionType(PositionTypeAbsolute)
return templateNode
}
// POSITION TYPE
func (templateNode *TemplateElement) Position(_type PositionType) *TemplateElement {
templateNode.getFlexNode().StyleSetPositionType(flex.PositionType(_type))
return templateNode
}
// POSITION
func (templateNode *TemplateElement) PositionTop(position float64) *TemplateElement {
templateNode.getFlexNode().StyleSetPosition(flex.EdgeTop, float32(position))
return templateNode
}
func (templateNode *TemplateElement) PositionRight(position float64) *TemplateElement {
templateNode.getFlexNode().StyleSetPosition(flex.EdgeRight, float32(position))
return templateNode
}
func (templateNode *TemplateElement) PositionBottom(position float64) *TemplateElement {
templateNode.getFlexNode().StyleSetPosition(flex.EdgeBottom, float32(position))
return templateNode
}
func (templateNode *TemplateElement) PositionLeft(position float64) *TemplateElement {
templateNode.getFlexNode().StyleSetPosition(flex.EdgeLeft, float32(position))
return templateNode
}
func (templateNode *TemplateElement) PositionAll(position float64) *TemplateElement {
templateNode.
PositionTop(position).
PositionRight(position).
PositionBottom(position).
PositionLeft(position)
return templateNode
}