-
Notifications
You must be signed in to change notification settings - Fork 0
/
body.go
61 lines (47 loc) · 1.11 KB
/
body.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
package glui
import (
)
//go:generate ./gen_element Body "On A CalcDepth Padding Spacing"
type Body struct {
ElementData
}
// windows can't be made transparent like this sadly, so alpha stays 255
func newBody(frame *Frame, isFirst bool) *Body {
if isFirst && false{
return &Body{
newElementData(frame, 0, 0),
}
} else {
e := &Body{
newElementData(frame, 9*2, 0),
}
e.setStyle()
return e
}
}
func (e *Body) borderT() int {
if len(e.p1Tris) == 0 {
return 0
} else {
return e.Root.P1.Skin.ButtonBorderThickness()
}
}
func (e *Body) setStyle() {
if e.borderT() != 0 {
e.SetButtonStyle()
}
}
func (e *Body) Show() {
e.setStyle()
e.ElementData.Show()
}
func (e *Body) CalcPos(maxWidth, maxHeight, maxZIndex int) (int, int) {
e.ElementData.CalcPosChildren(maxWidth - 2*e.borderT(), maxHeight - 2*e.borderT(), maxZIndex)
if e.borderT() != 0 {
e.SetBorderedElementPos(maxWidth, maxHeight, e.borderT(), maxZIndex)
for _, child := range e.children {
child.Translate(e.borderT(), e.borderT())
}
}
return e.InitRect(maxWidth, maxHeight)
}