summaryrefslogtreecommitdiff
path: root/debug.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-18 00:05:54 -0600
committerJeff Carr <[email protected]>2024-01-18 00:05:54 -0600
commit3ea3dd10db0e728240fc659bdd33c622d33e46b4 (patch)
tree5bf7a6058db46c08e8e074380f05cadf02f9aef5 /debug.go
initial commitv0.0.1
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'debug.go')
-rw-r--r--debug.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/debug.go b/debug.go
new file mode 100644
index 0000000..64883ee
--- /dev/null
+++ b/debug.go
@@ -0,0 +1,44 @@
+package tree
+
+import (
+ "go.wit.com/log"
+ "go.wit.com/lib/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
+}