2019-06-02 15:40:44 -05:00
|
|
|
package gui
|
|
|
|
|
2022-10-21 11:40:08 -05:00
|
|
|
func (n *Node) NewButton(name string, custom func()) *Node {
|
2023-02-25 14:05:25 -06:00
|
|
|
newNode := n.New(name, "Button")
|
2022-11-09 08:38:50 -06:00
|
|
|
|
2022-11-13 08:53:03 -06:00
|
|
|
newNode.Widget.Custom = func() {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugGui, "even newer clicker() name", newNode.Widget)
|
2022-11-09 08:38:50 -06:00
|
|
|
if (custom != nil) {
|
|
|
|
custom()
|
|
|
|
} else {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugGui, "wit/gui No callback function is defined for button name =", name)
|
2022-11-05 10:19:04 -05:00
|
|
|
}
|
2022-11-13 08:53:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, aplug := range allPlugins {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugGui, "gui.NewButton() aplug =", aplug.name, "name =", newNode.Widget.Name)
|
2022-11-13 08:53:03 -06:00
|
|
|
if (aplug.NewButton == nil) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugGui, "\tgui.NewButton() aplug.NewButton = nil", aplug.name)
|
2022-11-13 08:53:03 -06:00
|
|
|
continue
|
2022-11-05 10:19:04 -05:00
|
|
|
}
|
2022-11-13 08:53:03 -06:00
|
|
|
aplug.NewButton(&n.Widget, &newNode.Widget)
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
2021-10-31 14:21:36 -05:00
|
|
|
|
|
|
|
return newNode
|
|
|
|
}
|