have to fix gocui label sizes elsewhere

This commit is contained in:
Jeff Carr 2025-02-05 11:27:12 -06:00
parent 38a08d66fc
commit ae339cc587
1 changed files with 36 additions and 0 deletions

36
find.go
View File

@ -121,8 +121,10 @@ func (tk *guiWidget) gridFullSize() rectType {
r.w1 = cr.w1
r.h1 = cr.h1
first = false
child.dumpWidget(fmt.Sprintf("grid(f)"))
continue
}
child.dumpWidget(fmt.Sprintf("grid()"))
// use the lowest width and hight from children widgets
if r.w0 > cr.w0 {
r.w0 = cr.w0
@ -138,6 +140,26 @@ func (tk *guiWidget) gridFullSize() rectType {
r.h1 = cr.h1
}
}
tk.full.w0 = r.w0
tk.full.w1 = r.w1
tk.full.h0 = r.h0
tk.full.h1 = r.h1
return r
}
func (tk *guiWidget) buttonFullSize() rectType {
var r rectType
r.w0 = tk.gocuiSize.w0
r.w1 = tk.gocuiSize.w1
r.h0 = tk.gocuiSize.h0
r.h1 = tk.gocuiSize.h1
// try setting the full values here ? is this right?
tk.full.w0 = r.w0
tk.full.w1 = r.w1
tk.full.h0 = r.h0
tk.full.h1 = r.h1
return r
}
@ -150,6 +172,20 @@ func (tk *guiWidget) getFullSize() rectType {
return tk.gridFullSize()
}
// these are 'simple' widgets
// the full size is exactly what gocui uses
switch tk.node.WidgetType {
case widget.Label:
return tk.buttonFullSize()
case widget.Button:
return tk.buttonFullSize()
case widget.Checkbox:
return tk.buttonFullSize()
case widget.Dropdown:
return tk.buttonFullSize()
default:
}
if tk.v == nil {
r.w0 = tk.full.w0
r.w1 = tk.full.w1