summaryrefslogtreecommitdiff
path: root/button.go
blob: c14988f5fde5acc32f06c583c1a69cf43af0d5a0 (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 {
	newNode := n.New(name)

	newNode.Widget.Custom = func() {
		log.Println("even newer clicker() name", newNode.Widget)
		if (custom != nil) {
			custom()
		} else {
			log.Println("wit/gui No callback function is defined for button name =", name)
		}
	}

	for _, aplug := range allPlugins {
		log.Println("gui.NewButton() aplug =", aplug.name, "name =", newNode.Widget.Name)
		if (aplug.NewButton == nil) {
			log.Println("\tgui.NewButton() aplug.NewButton = nil", aplug.name)
			continue
		}
		aplug.NewButton(&n.Widget, &newNode.Widget)
	}

	return newNode
}