summaryrefslogtreecommitdiff
path: root/dropdown.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-02-25 14:05:25 -0600
committerJeff Carr <[email protected]>2023-02-25 14:05:25 -0600
commitf3bb68396afa7452ecf1c8d4744c825a9d81057c (patch)
tree00b55a17cee7a8e2f795c479a84a844779993c1c /dropdown.go
parent355e5ec968427c2b07b78fec12224f31a65df740 (diff)
The debugging window is finally useful
the gui enabled debugging works --gui-debug works from the command line The debug window can now select things debugging now includes widget types all the debug flags work finally working debugging flags via gui checkboxes add debian packaging rules use log() in the toolkit use a standard log() to simplify debugging flags add reference to 'GO Style Guide' use the same LICENSE from the GO developers. TODO: make this threadsafe TODO: fix plugin stuff Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'dropdown.go')
-rw-r--r--dropdown.go40
1 files changed, 31 insertions, 9 deletions
diff --git a/dropdown.go b/dropdown.go
index f500c55..e999f7e 100644
--- a/dropdown.go
+++ b/dropdown.go
@@ -1,31 +1,53 @@
package gui
-import "log"
-
func (n *Node) AddDropdownName(name string) {
for _, aplug := range allPlugins {
- log.Println("gui.AddDropdownName() aplug =", aplug.name, "name =", name)
+ log(debugGui, "gui.AddDropdownName() aplug =", aplug.name, "name =", name)
if (aplug.AddDropdownName == nil) {
- log.Println("\tgui.AddDropdownName() aplug.NewDropdown = nil", aplug.name)
+ log(debugGui, "\tgui.AddDropdownName() aplug.NewDropdown = nil", aplug.name)
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)
+ })
+ }
+ // 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(i int) {
+func (n *Node) SetDropdown(s any) {
+ log(debugGui, "gui.SetDropdown() TODO: make this work. s =", s)
}
-func (n *Node) NewDropdown(text string) *Node {
- newNode := n.New(text)
+func (n *Node) SetDropdownChange(f func()) {
+ n.Widget.Custom = f
+}
+
+func (n *Node) NewDropdown(name string) *Node {
+ newNode := n.New(name, "Dropdown")
for _, aplug := range allPlugins {
- log.Println("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.Println("\tgui.NewDropdown() aplug.NewDropdown = nil", aplug.name)
+ log(debugGui, "\tgui.NewDropdown() aplug.NewDropdown = nil", aplug.name)
continue
}
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
}