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 14:03:06 -06:00
|
|
|
func (w *guiWidget) dumpTree(s string) {
|
2024-01-28 12:09:48 -06:00
|
|
|
// 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 14:03:06 -06:00
|
|
|
w.showWidgetPlacement("dumpTree() " + s)
|
2024-01-18 00:08:37 -06:00
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
for _, child := range w.children {
|
2024-01-28 14:03:06 -06:00
|
|
|
child.dumpTree(s)
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-28 13:14:43 -06:00
|
|
|
func (w *guiWidget) showWidgetPlacement(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-28 20:15:59 -06:00
|
|
|
sizeW, sizeH := w.Size()
|
2024-01-28 20:36:59 -06:00
|
|
|
s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH)
|
|
|
|
s1 += fmt.Sprintf("gocui=(%2d,%2d,%2d,%2d)",
|
2024-01-18 00:08:37 -06:00
|
|
|
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
|
|
|
} else {
|
2024-02-05 04:28:42 -06:00
|
|
|
sizeW, sizeH := w.Size()
|
|
|
|
s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH)
|
|
|
|
s1 += fmt.Sprintf(" ")
|
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 {
|
2024-01-28 20:36:59 -06:00
|
|
|
s1 += fmt.Sprintf("At(%2d,%2d) ", w.node.State.AtW, w.node.State.AtH)
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
|
|
|
}
|
2024-02-05 04:28:42 -06:00
|
|
|
tmp := "." + w.String() + ". " + w.cuiName
|
|
|
|
if w.node.WidgetType == widget.Box {
|
|
|
|
tmp = "." + w.node.State.Direction.String() + ". " + w.cuiName
|
|
|
|
}
|
|
|
|
log.Log(NOW, s1, s, w.node.WidgetType, ",", tmp) //
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|