blob: 1ce732795f13b165236966d0fdfdffca7e323057 (
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
|
package gui
import "log"
func (n *Node) NewButton(name string, custom func()) *Node {
if (n.toolkit == nil) {
log.Println("gui.Node.AppendButton() filed node.toolkit == nil")
panic("gui.Node.AppendButton() filed node.toolkit == nil")
return n
}
newNode := n.New(name)
newNode.toolkit = n.toolkit.NewButton(name)
// TODO: this is still confusing and probably wrong. This needs to communicate through a channel
newNode.toolkit.Custom = func() {
if (Config.Options.Debug) {
log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit START")
}
custom()
if (Config.Options.Debug) {
log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit END")
}
}
newNode.custom = custom
return newNode
}
|