-
-
Notifications
You must be signed in to change notification settings - Fork 128
/
extrawidgets.go
45 lines (40 loc) · 971 Bytes
/
extrawidgets.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
package main
import (
"fmt"
g "github.com/AllenDang/giu"
)
var (
showPD bool = true
radius float32 = 20
stack int32
)
func loop() {
g.SingleWindow().Layout(
g.Checkbox("Show ProgressIndicator", &showPD),
g.Condition(showPD, g.Layout{
g.SliderFloat(&radius, 10, 100).Label("Radius"),
g.Row(
g.ProgressIndicator("", 2*radius+20, 2*radius+20, radius),
g.ProgressIndicator("", 2*radius+20, 2*radius+20, radius),
),
g.ProgressIndicator("Loading...", 0, 0, radius),
}, nil),
g.Separator(),
g.Label("stack widget"),
g.SliderInt(&stack, 0, 2),
g.Stack(stack,
g.Layout{
g.Label("I'm label 1"),
g.Button("I'm a button").OnClick(func() { fmt.Println("button 1") }),
},
g.Layout{
g.Label("I'm a label 2"),
g.Button("I'm a button").OnClick(func() { fmt.Println("button 2") }),
},
),
)
}
func main() {
wnd := g.NewMasterWindow("Extra Widgets", 800, 600, g.MasterWindowFlagsNotResizable)
wnd.Run(loop)
}