working on window drag

This commit is contained in:
Jeff Carr 2025-02-03 10:55:50 -06:00
parent f0d403e834
commit d61e03b877
2 changed files with 21 additions and 19 deletions

View File

@ -24,33 +24,34 @@ func (w *guiWidget) dumpTree(s string) {
}
// a standard function to print out information about a widget
func (w *guiWidget) dumpWidget(s string) {
func (tk *guiWidget) dumpWidget(s string) {
var s1 string
var pId int
w.verifyRect()
if w.node.Parent == nil {
log.Log(INFO, "showWidgetPlacement() parent == nil", w.node.WidgetId, w.cuiName)
tk.verifyRect()
if tk.node.Parent == nil {
log.Log(INFO, "showWidgetPlacement() parent == nil", tk.node.WidgetId, tk.cuiName)
pId = 0
} else {
pId = w.node.Parent.WidgetId
pId = tk.node.Parent.WidgetId
}
s1 = fmt.Sprintf("(wId,pId)=(%4d,%4d) ", w.node.WidgetId, pId)
sizeW, sizeH := w.Size()
s1 = fmt.Sprintf("(wId,pId)=(%4d,%4d) ", tk.node.WidgetId, pId)
sizeW, sizeH := tk.Size()
s1 += fmt.Sprintf("size=(%3d,%3d)", sizeW, sizeH)
if w.Visible() {
if tk.Visible() {
s1 += fmt.Sprintf("gocui=(%3d,%3d,%3d,%3d)",
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1)
// vx0, vy0, vx1, vy1, _ := me.baseGui.ViewPosition("msg")
vx0, vy0, vx1, vy1, _ := me.baseGui.ViewPosition(w.v.Name())
// vw0, vh0, vw1, vh1, _ := me.baseGui.ViewPosition(tk.v.Name())
vw0, vh0, vw1, vh1, _ := me.baseGui.ViewPosition(tk.v.Name())
s1 += fmt.Sprintf(" real=(%3d,%3d,%3d,%3d)",
vx0, vy0, vx1, vy1)
vw0, vh0, vw1, vh1)
} else {
s1 += fmt.Sprintf(" %3s %3s %3s %3s ", "", "", "", "")
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)
if tk.node.Parent != nil {
if tk.node.Parent.WidgetType == widget.Grid {
s1 += fmt.Sprintf("At(%3d,%3d) ", tk.node.State.AtW, tk.node.State.AtH)
} else {
s1 += fmt.Sprintf(" %3s %3s ", "", "")
}
@ -58,14 +59,14 @@ func (w *guiWidget) dumpWidget(s string) {
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())
if tk.node.WidgetType == widget.Box {
end = fmt.Sprintf("%5s %-8s %s", tk.cuiName, tk.node.WidgetType, tk.node.State.Direction.String())
} else {
curval := w.String()
curval := tk.String()
if curval == "" {
curval = w.node.GetLabel()
curval = tk.node.GetLabel()
}
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String())
end = fmt.Sprintf("%5s %-8s %s", tk.cuiName, tk.node.WidgetType, tk.String())
}
log.Log(NOW, s1, s, end)
}

View File

@ -109,6 +109,7 @@ type guiWidget struct {
enable bool // ?
defaultColor *colorT // store the color to go back to
gocuiSize rectType // should mirror the real display size. todo: verify these are accurate. they are not yet
full rectType // full size of children (used by widget.Window, etc)
startW int // ?
startH int // ?
isCurrent bool // is this the currently displayed Window or Tab?