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-23 12:35:12 -05:00
|
|
|
n.AddText(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-05-09 20:25:37 -05:00
|
|
|
newNode := n.newNode(name, toolkit.Dropdown)
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2023-05-09 08:38:33 -05:00
|
|
|
a := newAction(newNode, toolkit.Add)
|
2023-05-09 18:53:31 -05:00
|
|
|
sendAction(a)
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2023-03-03 14:41:38 -06:00
|
|
|
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 {
|
2023-05-09 20:25:37 -05:00
|
|
|
newNode := n.newNode(name, toolkit.Combobox)
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2023-05-09 08:38:33 -05:00
|
|
|
a := newAction(newNode, toolkit.Add)
|
2023-05-09 18:53:31 -05:00
|
|
|
sendAction(a)
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2022-11-13 08:53:03 -06:00
|
|
|
return newNode
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|