somethings still wrong somewhere

This commit is contained in:
Jeff Carr 2025-02-04 10:14:00 -06:00
parent acfb80a2e7
commit 9d5cd2c865
3 changed files with 16 additions and 9 deletions

View File

@ -23,8 +23,8 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
h = h + 4 h = h + 4
tk.DrawAt(w, h) tk.DrawAt(w, h)
tk.setColor(&colorActiveW) // sets the window to Green BG tk.setColor(&colorActiveW) // sets the window to Green BG
tk.showWidgets()
tk.placeWidgets(w, h) // compute the sizes & places for each widget tk.placeWidgets(w, h) // compute the sizes & places for each widget
tk.showWidgets()
tk.setFullSize() tk.setFullSize()
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0) me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)

View File

@ -98,6 +98,8 @@ func (tk *guiWidget) moveNew(g *gocui.Gui) {
tk.verifyRect() tk.verifyRect()
s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName) s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)
*/ */
tk.gocuiSize.w0 = w
tk.gocuiSize.h0 = h
tk.redrawWindow(w, h) tk.redrawWindow(w, h)
s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName) s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)
tk.dumpWidget(s) tk.dumpWidget(s)

View File

@ -77,20 +77,25 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
case widget.Window: case widget.Window:
newW := startW newW := startW
newH := startH newH := startH
var maxH int = 0 // var maxH int = 0
for _, child := range tk.children { for _, child := range tk.children {
child.placeWidgets(newW, newH) child.placeWidgets(newW, newH)
sizeW, sizeH := child.Size() sizeW, sizeH := child.Size()
/*
if sizeW < 20 { if sizeW < 20 {
sizeW = 20 sizeW = 20
} }
*/
newW += sizeW newW += sizeW
newH += sizeH
/*
if sizeH > maxH { if sizeH > maxH {
maxH = sizeH maxH = sizeH
} }
*/
} }
return newW - startW, maxH return newW - startW, newH - startH
case widget.Tab: case widget.Tab:
case widget.Grid: case widget.Grid:
return tk.placeGrid(startW, startH) return tk.placeGrid(startW, startH)