blob: e0b7d974003e7b0ae471002c7ce2c0004f0e6e92 (
plain)
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
|
package toolkit
import "log"
// import "os"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
// make new Group here
func (t Toolkit) NewButton(name string) *Toolkit {
var newt Toolkit
var b *ui.Button
if t.broken() {
return nil
}
if (DebugToolkit) {
log.Println("gui.Toolbox.NewButton() create", name)
}
b = ui.NewButton(name)
newt.uiButton = b
b.OnClicked(func(*ui.Button) {
log.Println("TODO: IN TOOLKIT GOROUTINE. SHOULD LEAVE HERE VIA channels. button name =", name)
t.Dump()
newt.Dump()
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() Should do something here")
}
if (newt.Custom == nil) {
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() toolkit.Custom == nil")
}
} else {
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() toolkit.Custom() START")
}
newt.Custom()
return
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() toolkit.Custom() END")
}
}
if (t.Custom == nil) {
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() parent toolkit.Custom == nil")
}
} else {
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() running parent toolkit.Custom() START (IS THIS A BAD IDEA?)")
}
t.Custom()
return
if (DebugToolkit) {
log.Println("wit/gui/toolkit NewButton() running parent toolkit.Custom() END (IS THIS A BAD IDEA?)")
}
}
log.Println("TODO: LEFT TOOLKIT GOROUTINE WITH NOTHING TO DO button name =", name)
})
if (DebugToolkit) {
log.Println("gui.Toolbox.NewButton() about to append to Box parent t:", name)
t.Dump()
log.Println("gui.Toolbox.NewButton() about to append to Box new t:", name)
newt.Dump()
}
if (t.uiBox != nil) {
t.uiBox.Append(b, stretchy)
} else if (t.uiWindow != nil) {
t.uiWindow.SetChild(b)
} else {
log.Println("ERROR: wit/gui andlabs couldn't place this button in a box or a window")
log.Println("ERROR: wit/gui andlabs couldn't place this button in a box or a window")
return &t
}
return &newt
}
|