diff options
| author | Jeff Carr <[email protected]> | 2025-02-09 09:00:40 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-09 09:00:40 -0600 |
| commit | 87d31a3d94a26c733e3efda9dd2f60688332bc5a (patch) | |
| tree | ed32eade7a266e645e10a639aac55220b4c5594f /treeDraw.go | |
| parent | c5d9522c0b1d176ecea10b9347c65dc6d99e898e (diff) | |
stub in code to page large windows
Diffstat (limited to 'treeDraw.go')
| -rw-r--r-- | treeDraw.go | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/treeDraw.go b/treeDraw.go index e9f9d20..c2d8864 100644 --- a/treeDraw.go +++ b/treeDraw.go @@ -41,6 +41,41 @@ func (tk *guiWidget) doNotDraw() bool { return false } +// page widgets in the window +func (tk *guiWidget) pageWidget() *rectType { + r := new(rectType) + + var check bool + switch tk.node.WidgetType { + case widget.Button: + check = true + case widget.Label: + check = true + default: + } + if !check { + return nil + } + win := tk.findParentWindow() + if win == nil { + // don't draw anything if you can't find the parent window + return nil + } + + r.w0 = tk.gocuiSize.w0 + r.h0 = tk.gocuiSize.h0 + r.w1 = tk.gocuiSize.w1 + r.h1 = tk.gocuiSize.h1 + + // r.h0 = tk.gocuiSize.h0 - win.gocuiSize.h0 + + if r.h0 > 20 { + return r + } + + return r +} + // display's the text of the widget in gocui // deletes the old view if it exists and recreates it func (tk *guiWidget) drawView() { @@ -70,9 +105,23 @@ func (tk *guiWidget) drawView() { c := tk.gocuiSize.w1 d := tk.gocuiSize.h1 + if r := tk.pageWidget(); r == nil { + // if nil, draw whatever it is anyway + } else { + if r.Width() == 0 && r.Height() == 0 { + // don't draw empty stuff + return + } + a = r.w0 + b = r.h0 + c = r.w1 + d = r.h1 + } + if tk.node.WidgetType == widget.Window || tk.node.WidgetType == widget.Flag { - if tk.gocuiSize.Height() > 30 { - tk.gocuiSize.h1 = tk.gocuiSize.h0 + 30 + if tk.gocuiSize.Height() > 40 { + tk.window.large = true + tk.gocuiSize.h1 = tk.gocuiSize.h0 + 40 d = tk.gocuiSize.h1 } } @@ -98,7 +147,6 @@ func (tk *guiWidget) drawView() { b = tk.gocuiSize.h0 c = tk.gocuiSize.w1 d = tk.gocuiSize.h1 - } tk.v, err = me.baseGui.SetView(tk.cuiName, a, b, c, d, 0) |
