gocui/debug.go

74 lines
1.6 KiB
Go
Raw Normal View History

package main
import (
"fmt"
"go.wit.com/log"
"go.wit.com/widget"
)
func (w *guiWidget) dumpTree(draw bool) {
log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
if w == nil {
log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
return
}
w.showWidgetPlacement(true, "dumpTree()")
for _, child := range w.children {
child.dumpTree(draw)
}
}
func (w *guiWidget) showWidgetPlacement(b bool, s string) {
var s1 string
var pId int
if w.node.Parent == nil {
log.Log(INFO, "showWidgetPlacement() parent == nil", w.node.WidgetId, w.cuiName)
pId = 0
} else {
pId = w.node.Parent.WidgetId
}
s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId)
if w.Visible() {
s1 += fmt.Sprintf("gocui=(%2d,%2d)(%2d,%2d,%2d,%2d)",
w.gocuiSize.Width(), w.gocuiSize.Height(),
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
} else {
s1 += fmt.Sprintf(" w.Visable() == false ")
}
if w.node.Parent != nil {
if w.node.Parent.WidgetType == widget.Grid {
s1 += fmt.Sprintf("At(%2d,%2d) ", w.AtW, w.AtH)
}
}
tmp := "." + w.String() + "."
log.Log(INFO, s1, s, w.node.WidgetType, ",", tmp, "jcarr") // , "text=", w.text)
}
/*
func dumpWidget(n *tree.Node, pad string) {
log.Log(NOW, "node:", pad, n.WidgetId, "At(", n.AtW, n.AtH, ") ,", n.WidgetType, ", n.progname =", n.progname, ", n.label =", n.label)
}
*/
/*
func listWidgets(n *tree.Node) {
if n == nil {
return
}
var pad string
for i := 0; i < me.depth; i++ {
pad = pad + " "
}
n.dumpWidget(pad)
for _, child := range n.children {
me.depth += 1
child.listWidgets()
me.depth -= 1
}
return
}
*/