blob: b89aa800bc90fa13a3ab5baa80433833e0dc9e5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
package tree
import (
"fmt"
"go.wit.com/log"
"go.wit.com/widget"
)
func ShowButtons() {
treeRoot.ShowButtons()
}
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) {
s := n.GetProgName()
if s == "" {
s = n.CurrentS()
}
if s == "" {
s = n.String()
}
if s == "" {
s = n.ProgName()
}
if s == "" {
s = n.GetLabel()
}
if s == "" {
s = n.State.NewString
}
end := fmt.Sprintf("%d,%-9s .%s.", n.WidgetId, n.WidgetType, s)
log.Log(TREEWARN, "node:", pad, end)
}
var depth int = 0
func ListWidgets() {
treeRoot.ListWidgets()
}
func (n *Node) ListWidgets() {
if n == nil {
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
log.Log(TREEWARN, "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
}
|