summaryrefslogtreecommitdiff
path: root/dropdown.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-01 11:35:36 -0600
committerJeff Carr <[email protected]>2023-03-01 11:35:36 -0600
commit8dbf5a09097b7868e9218bf98716c57eac998a10 (patch)
treeab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /dropdown.go
parentf3bb68396afa7452ecf1c8d4744c825a9d81057c (diff)
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing merge forceDump(bool) into Dump() debugging output configuration is pretty clean keep cutting down duplicate things --gui-verbose flag works make label "standard" code add debug.FreeOSMemory() move the GO language internals to display in the GUI update push to do tags and go to github.com/wit-go/ remove the other license file it might be confusing golang.org and github proper WidgetType added a Quit() button Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'dropdown.go')
-rw-r--r--dropdown.go51
1 files changed, 22 insertions, 29 deletions
diff --git a/dropdown.go b/dropdown.go
index e999f7e..214cc5a 100644
--- a/dropdown.go
+++ b/dropdown.go
@@ -1,53 +1,46 @@
package gui
+import (
+ "git.wit.org/wit/gui/toolkit"
+)
+
+// add a new entry to the dropdown name
func (n *Node) AddDropdownName(name string) {
for _, aplug := range allPlugins {
- log(debugGui, "gui.AddDropdownName() aplug =", aplug.name, "name =", name)
+ log(debugPlugin, "AddDropdownName() aplug =", aplug.name, "name =", name)
if (aplug.AddDropdownName == nil) {
- log(debugGui, "\tgui.AddDropdownName() aplug.NewDropdown = nil", aplug.name)
+ log(debugPlugin, "\taplug.AddDropdownName() = nil")
continue
}
- aplug.AddDropdownName(&n.Widget, name)
- }
-
- if (n.Widget.Custom == nil) {
- n.SetDropdownChange( func() {
- log(debugChange, "gui.Dropdown change() REAL Custom() name =", name)
- log(debugChange, "gui.Dropdown change() REAL n.Widget.S =", n.Widget.S)
- })
+ aplug.AddDropdownName(&n.widget, name)
}
- // TODO, this makes functions over and over for each dropdown menu
- /*
- n.Widget.Custom = func() {
- log(debugChange, "gui.Dropdown change() START Custom() name =", name)
- log(debugChange, "gui.Dropdown change() START n.Widget.S =", n.Widget.S)
- }
- */
-}
-
-func (n *Node) SetDropdown(s any) {
- log(debugGui, "gui.SetDropdown() TODO: make this work. s =", s)
}
-func (n *Node) SetDropdownChange(f func()) {
- n.Widget.Custom = f
+// 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)
+ }
}
func (n *Node) NewDropdown(name string) *Node {
- newNode := n.New(name, "Dropdown")
+ newNode := n.New(name, toolkit.Dropdown, nil)
for _, aplug := range allPlugins {
- log(debugGui, "gui.NewDropdown() aplug =", aplug.name, "name =", newNode.Widget.Name)
+ log(debugGui, "gui.NewDropdown() aplug =", aplug.name, "name =", newNode.widget.Name)
if (aplug.NewDropdown == nil) {
log(debugGui, "\tgui.NewDropdown() aplug.NewDropdown = nil", aplug.name)
continue
}
- aplug.NewDropdown(&n.Widget, &newNode.Widget)
+ aplug.NewDropdown(&n.widget, &newNode.widget)
}
// TODO, this doesn't work for some reason (over-written by plugin?)
- newNode.Widget.Custom = func() {
- log(true, "gui.NewDropdown() START Custom()")
- }
return newNode
}