2024-01-18 00:08:37 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-01-28 02:20:31 -06:00
|
|
|
|
2024-01-18 00:08:37 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-18 04:10:08 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-18 00:08:37 -06:00
|
|
|
)
|
|
|
|
|
2024-01-28 11:44:36 -06:00
|
|
|
func (w *guiWidget) dumpTree(draw bool) {
|
|
|
|
log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
|
2024-01-18 00:08:37 -06:00
|
|
|
if w == nil {
|
2024-01-28 11:44:36 -06:00
|
|
|
log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
|
2024-01-18 00:08:37 -06:00
|
|
|
return
|
|
|
|
}
|
2024-01-28 11:44:36 -06:00
|
|
|
w.showWidgetPlacement(true, "dumpTree()")
|
2024-01-18 00:08:37 -06:00
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
for _, child := range w.children {
|
2024-01-28 11:44:36 -06:00
|
|
|
child.dumpTree(draw)
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
func (w *guiWidget) showWidgetPlacement(b bool, s string) {
|
2024-01-18 00:08:37 -06:00
|
|
|
var s1 string
|
|
|
|
var pId int
|
2024-01-28 02:20:31 -06:00
|
|
|
if w.node.Parent == nil {
|
|
|
|
log.Log(INFO, "showWidgetPlacement() parent == nil", w.node.WidgetId, w.cuiName)
|
2024-01-18 00:08:37 -06:00
|
|
|
pId = 0
|
|
|
|
} else {
|
2024-01-28 02:20:31 -06:00
|
|
|
pId = w.node.Parent.WidgetId
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
2024-01-28 02:20:31 -06:00
|
|
|
s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId)
|
|
|
|
if w.Visible() {
|
2024-01-18 00:08:37 -06:00
|
|
|
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 {
|
2024-01-28 03:33:08 -06:00
|
|
|
s1 += fmt.Sprintf(" w.Visable() == false ")
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
2024-01-28 02:20:31 -06:00
|
|
|
if w.node.Parent != nil {
|
|
|
|
if w.node.Parent.WidgetType == widget.Grid {
|
|
|
|
s1 += fmt.Sprintf("At(%2d,%2d) ", w.AtW, w.AtH)
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
|
|
|
}
|
2024-01-28 02:20:31 -06:00
|
|
|
tmp := "." + w.String() + "."
|
2024-01-28 03:33:08 -06:00
|
|
|
log.Log(INFO, s1, s, w.node.WidgetType, ",", tmp, "jcarr") // , "text=", w.text)
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
/*
|
|
|
|
func dumpWidget(n *tree.Node, pad string) {
|
2024-01-18 00:08:37 -06:00
|
|
|
log.Log(NOW, "node:", pad, n.WidgetId, "At(", n.AtW, n.AtH, ") ,", n.WidgetType, ", n.progname =", n.progname, ", n.label =", n.label)
|
|
|
|
}
|
2024-01-28 02:20:31 -06:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
func listWidgets(n *tree.Node) {
|
2024-01-18 00:08:37 -06:00
|
|
|
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
|
|
|
|
}
|
2024-01-28 02:20:31 -06:00
|
|
|
*/
|