// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( "fmt" "go.wit.com/log" "go.wit.com/widget" ) func (w *guiWidget) dumpTree(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 } w.dumpWidget("dumpTree() " + s) for _, child := range w.children { child.dumpTree(s) } } // a standard function to print out information about a widget func (w *guiWidget) dumpWidget(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)=(%4d,%4d) ", w.node.WidgetId, pId) sizeW, sizeH := w.Size() s1 += fmt.Sprintf("size=(%3d,%3d)", sizeW, sizeH) if w.Visible() { s1 += fmt.Sprintf("gocui=(%3d,%3d,%3d,%3d)", w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1) } else { s1 += fmt.Sprintf(" %3s %3s %3s %3s ", "", "", "", "") } if w.node.Parent != nil { if w.node.Parent.WidgetType == widget.Grid { s1 += fmt.Sprintf("At(%3d,%3d) ", w.node.State.AtW, w.node.State.AtH) } else { s1 += fmt.Sprintf(" %3s %3s ", "", "") } } else { s1 += fmt.Sprintf(" %3s %3s ", "", "") } var end string if w.node.WidgetType == widget.Box { end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.node.State.Direction.String()) } else { end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String()) } log.Log(NOW, s1, s, end) }