From ae339cc587c57dfbe3263ad017258cfe8e7bfbc8 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 5 Feb 2025 11:27:12 -0600 Subject: [PATCH] have to fix gocui label sizes elsewhere --- find.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/find.go b/find.go index d423151..3c76755 100644 --- a/find.go +++ b/find.go @@ -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