add debugWindow()

This commit is contained in:
Jeff Carr 2025-02-05 15:55:56 -06:00
parent 83e9787e75
commit 07f6b7842e
1 changed files with 17 additions and 0 deletions

View File

@ -24,6 +24,22 @@ func (w *guiWidget) dumpTree(s string) {
}
}
func (w *guiWidget) dumpWindows(s string) {
// log.Log(ERROR, "dump w", w.node.WidgetId, w.WidgetType, w.String())
if w == nil {
log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.node.WidgetType, w.String())
return
}
s += fmt.Sprintf("(%d,%d)", w.force.w0, w.force.h0)
if w.node.WidgetType == widget.Window {
w.dumpWidget("dumpWindow() " + s)
}
for _, child := range w.children {
child.dumpWindows(s)
}
}
// a standard function to print out information about a widget
func (tk *guiWidget) dumpWidget(s string) {
var s1 string
@ -89,5 +105,6 @@ func printWidgetTree(g *gocui.Gui, v *gocui.View) error {
func printWidgetPlacements(g *gocui.Gui, v *gocui.View) error {
w := me.treeRoot.TK.(*guiWidget)
w.dumpTree("MM")
w.dumpWindows("WW")
return nil
}