2024-01-18 00:05:54 -06:00
|
|
|
package tree
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/log"
|
2024-01-18 04:08:11 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-18 00:05:54 -06:00
|
|
|
)
|
|
|
|
|
2024-02-09 10:26:42 -06:00
|
|
|
func ShowButtons() {
|
|
|
|
treeRoot.ShowButtons()
|
|
|
|
}
|
|
|
|
|
2024-01-18 00:05:54 -06:00
|
|
|
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) {
|
2024-02-07 07:41:35 -06:00
|
|
|
log.Log(TREEWARN, "node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.GetProgName())
|
2024-01-18 00:05:54 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
var depth int = 0
|
|
|
|
|
2024-02-09 10:26:42 -06:00
|
|
|
func ListWidgets() {
|
|
|
|
treeRoot.ListWidgets()
|
|
|
|
}
|
|
|
|
|
2024-01-18 00:05:54 -06:00
|
|
|
func (n *Node) ListWidgets() {
|
2024-01-18 04:08:11 -06:00
|
|
|
if n == nil {
|
2024-02-07 07:41:35 -06:00
|
|
|
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
|
|
|
|
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
|
|
|
|
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
|
2024-01-18 00:05:54 -06:00
|
|
|
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
|
|
|
|
}
|