diff options
Diffstat (limited to 'find.go')
| -rw-r--r-- | find.go | 46 |
1 files changed, 31 insertions, 15 deletions
@@ -4,8 +4,9 @@ package main import ( + "fmt" + "github.com/awesome-gocui/gocui" - log "go.wit.com/log" "go.wit.com/widget" ) @@ -48,7 +49,7 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget { // log.Log(GOCUI, "findByXY() found", widget.node.WidgetType, w, h) } } - tk.verifyRect() + // tk.verifyRect() // search through the children widgets in the binary tree for _, child := range tk.children { @@ -78,7 +79,7 @@ func (tk *guiWidget) findWindows() []*guiWidget { return found } -func (tk *guiWidget) setFullSize() rectType { +func (tk *guiWidget) setFullSize() bool { r := tk.getFullSize() var changed bool @@ -99,15 +100,9 @@ func (tk *guiWidget) setFullSize() rectType { changed = true } if changed { - if tk.node.WidgetType == widget.Window { - log.Info("REDRAW WINDOW IN setFullSize()") - tk.full.w1 = r.w1 + 2 - tk.full.h1 = r.h1 + 1 - tk.Hide() - tk.drawView() - } + tk.dumpWidget(fmt.Sprintf("setFullSize(changed)")) } - return r + return changed } // this checks a widget to see if it is under (W,H), then checks the widget's children @@ -115,28 +110,49 @@ func (tk *guiWidget) setFullSize() rectType { func (tk *guiWidget) getFullSize() rectType { var r rectType - r.w0 = tk.gocuiSize.w0 - r.w1 = tk.gocuiSize.w1 - r.h0 = tk.gocuiSize.h0 - r.h1 = tk.gocuiSize.h1 + if tk.v == nil { + r.w0 = tk.full.w0 + r.w1 = tk.full.w1 + r.h0 = tk.full.h0 + r.h1 = tk.full.h1 + } else { + r.w0 = tk.gocuiSize.w0 + r.w1 = tk.gocuiSize.w1 + r.h0 = tk.gocuiSize.h0 + r.h1 = tk.gocuiSize.h1 + } // search through the children widgets in the binary tree for _, child := range tk.children { cr := child.getFullSize() + /* this didn't make things work either + if child.v == nil { + continue + } + */ + // use the lowest width and hight from children widgets if r.w0 > cr.w0 { r.w0 = cr.w0 } if r.h0 > cr.h0 { r.h0 = cr.h0 } + // use the highest width and hight from children widgets if r.w1 < cr.w1 { r.w1 = cr.w1 } if r.h1 < cr.h1 { r.h1 = cr.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 } |
