2022-10-20 06:55:42 -05:00
|
|
|
package gui
|
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
import (
|
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
)
|
|
|
|
|
|
|
|
// add a new entry to the dropdown name
|
2022-11-13 08:53:03 -06:00
|
|
|
func (n *Node) AddDropdownName(name string) {
|
|
|
|
for _, aplug := range allPlugins {
|
2023-03-01 11:35:36 -06:00
|
|
|
log(debugPlugin, "AddDropdownName() aplug =", aplug.name, "name =", name)
|
2022-11-13 08:53:03 -06:00
|
|
|
if (aplug.AddDropdownName == nil) {
|
2023-03-01 11:35:36 -06:00
|
|
|
log(debugPlugin, "\taplug.AddDropdownName() = nil")
|
2022-11-13 08:53:03 -06:00
|
|
|
continue
|
2022-11-05 10:19:04 -05:00
|
|
|
}
|
2023-03-01 11:35:36 -06:00
|
|
|
aplug.AddDropdownName(&n.widget, name)
|
2023-02-25 14:05:25 -06:00
|
|
|
}
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
// Set the dropdown menu to 'name'
|
|
|
|
func (n *Node) SetDropdownName(name string) {
|
|
|
|
log(debugGui, "SetDropdownName() work. name =", name)
|
|
|
|
for _, aplug := range allPlugins {
|
|
|
|
log(debugPlugin, "SetDropdownName() aplug =", aplug.name, "name =", name)
|
|
|
|
if (aplug.SetDropdownName == nil) {
|
|
|
|
log(true, "\taplug.SetDropdownName() aplug = nil")
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
aplug.SetDropdownName(&n.widget, name)
|
|
|
|
}
|
2023-02-25 14:05:25 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n *Node) NewDropdown(name string) *Node {
|
2023-03-01 11:35:36 -06:00
|
|
|
newNode := n.New(name, toolkit.Dropdown, nil)
|
2022-10-20 06:55:42 -05:00
|
|
|
|
2022-11-13 08:53:03 -06:00
|
|
|
for _, aplug := range allPlugins {
|
2023-03-01 11:35:36 -06:00
|
|
|
log(debugGui, "gui.NewDropdown() aplug =", aplug.name, "name =", newNode.widget.Name)
|
2022-11-13 08:53:03 -06:00
|
|
|
if (aplug.NewDropdown == nil) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugGui, "\tgui.NewDropdown() aplug.NewDropdown = nil", aplug.name)
|
2022-11-13 08:53:03 -06:00
|
|
|
continue
|
|
|
|
}
|
2023-03-01 11:35:36 -06:00
|
|
|
aplug.NewDropdown(&n.widget, &newNode.widget)
|
2022-11-13 08:53:03 -06:00
|
|
|
}
|
2023-02-25 14:05:25 -06:00
|
|
|
|
|
|
|
// TODO, this doesn't work for some reason (over-written by plugin?)
|
2022-11-13 08:53:03 -06:00
|
|
|
return newNode
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|