summaryrefslogtreecommitdiff
path: root/tree/debug.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-17 21:31:49 -0600
committerJeff Carr <[email protected]>2024-01-17 21:31:49 -0600
commit841e6252c95244f0ee7faf2c01d33f69a8ab483a (patch)
treeef400228622b87611168db2227269ba7fd56625d /tree/debug.go
parentba95c13799740b5f55541fc5e8ab9f1d34f7e421 (diff)
common tree package for toolkitsv0.12.4
This update provides *lots* of toolkit updates. This will allow the next step of debugging the gocui toolkit to make it work again. There are new common routines for handling the plugin channel communication Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'tree/debug.go')
-rw-r--r--tree/debug.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/tree/debug.go b/tree/debug.go
new file mode 100644
index 0000000..c79f35b
--- /dev/null
+++ b/tree/debug.go
@@ -0,0 +1,44 @@
+package tree
+
+import (
+ "go.wit.com/log"
+ "go.wit.com/gui/widget"
+)
+
+func (n *Node) ShowButtons() {
+ if n.WidgetType == widget.Button {
+ n.DumpWidget("Button:")
+ }
+
+ for _, child := range n.children {
+ child.ShowButtons()
+ }
+}
+
+func (n *Node) DumpWidget(pad string) {
+ log.Warn("node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.GetProgName())
+}
+
+var depth int = 0
+
+func (n *Node) ListWidgets() {
+ if (n == nil) {
+ log.Warn("ERRRORRRR: n == nil in ListWidgets()")
+ log.Warn("ERRRORRRR: n == nil in ListWidgets()")
+ log.Warn("ERRRORRRR: n == nil in ListWidgets()")
+ return
+ }
+
+ var pad string
+ for i := 0; i < depth; i++ {
+ pad = pad + " "
+ }
+ n.DumpWidget(pad)
+
+ for _, child := range n.children {
+ depth += 1
+ child.ListWidgets()
+ depth -= 1
+ }
+ return
+}