2022-10-20 06:55:42 -05:00
|
|
|
package gui
|
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
// functions to create 'Dropdown' and 'Combobox'
|
|
|
|
// Combobox is a Dropdown you can edit
|
|
|
|
// Thererfore, AddDropdownName() is used on both combobox and dropdown nodes
|
|
|
|
// since it is the same. confusing names? maybe...
|
|
|
|
|
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) {
|
2023-03-03 14:41:38 -06:00
|
|
|
n.Add(name)
|
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) {
|
2023-03-03 14:41:38 -06:00
|
|
|
n.SetText(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)
|
2023-03-03 14:41:38 -06:00
|
|
|
send(n, newNode)
|
|
|
|
return newNode
|
|
|
|
}
|
2022-10-20 06:55:42 -05:00
|
|
|
|
2023-03-03 14:41:38 -06:00
|
|
|
func (n *Node) NewCombobox(name string) *Node {
|
|
|
|
newNode := n.New(name, toolkit.Combobox, nil)
|
|
|
|
send(n, newNode)
|
2022-11-13 08:53:03 -06:00
|
|
|
return newNode
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|