-
-
Notifications
You must be signed in to change notification settings - Fork 126
/
align.go
64 lines (55 loc) · 1.15 KB
/
align.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
package main
import (
"time"
"github.com/AllenDang/giu"
)
var (
text string
date time.Time
)
func loop() {
giu.Window("window").Layout(
giu.Align(giu.AlignCenter).To(
giu.Label("I'm a centered label"),
giu.Button("I'm a centered button"),
),
giu.Align(giu.AlignRight).To(
giu.Label("I'm an alined to right label"),
giu.InputText(&text),
),
giu.Align(giu.AlignRight).To(
giu.Label("I'm the label"),
giu.Layout{
giu.Label("I'm the other label embedded in another layout"),
giu.Label("I'm the next label"),
},
giu.Label("I'm the last label"),
),
giu.Label("Buttons in row:"),
giu.Align(giu.AlignCenter).To(
giu.Row(
giu.Button("button 1"),
giu.Button("button 2"),
),
),
giu.Label("manual alignment"),
giu.AlignManually(
giu.AlignCenter,
giu.Button("I'm button with 200 width").
Size(200, 30),
200, false,
),
giu.AlignManually(
giu.AlignCenter,
giu.InputText(&text),
100, true,
),
giu.Align(giu.AlignCenter).To(
giu.DatePicker("<- date picker centered", &date),
),
)
}
func main() {
wnd := giu.NewMasterWindow("Alignment demo", 640, 480, 0)
wnd.Run(loop)
}