hmm. still stumped. added tk.full
This commit is contained in:
parent
012273d8d3
commit
1867bae62c
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
// register how the 'gocui' will work as a GO toolkit plugin
|
||||
|
@ -145,6 +144,8 @@ var notsure *guiWidget
|
|||
// use this to test code ideas
|
||||
func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
||||
log.Info("got keypress 2. now what?")
|
||||
wRoot := me.treeRoot.TK.(*guiWidget)
|
||||
wRoot.redoWindows(0, 0)
|
||||
// closes anything under your mouse
|
||||
w, h := g.MousePosition()
|
||||
if notsure == nil {
|
||||
|
@ -152,19 +153,21 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
|||
notsure = addDropdownTK(-118)
|
||||
notsure.makeTK([]string{"apple", "pear"})
|
||||
}
|
||||
notsure.MoveToOffset(w+10, h+10)
|
||||
notsure.MoveToOffset(w+2, h+1)
|
||||
// notsure.SetText("theNotsure")
|
||||
notsure.drawView()
|
||||
notsure.Show()
|
||||
|
||||
for _, tk := range findByXY(w, h) {
|
||||
// vx0, vy0, vx1, vy1, err := g.ViewPosition("msg")
|
||||
log.Log(GOCUI, "verify rect:", tk.v.Name())
|
||||
tk.verifyRect()
|
||||
/*
|
||||
for _, tk := range findByXY(w, h) {
|
||||
// vx0, vy0, vx1, vy1, err := g.ViewPosition("msg")
|
||||
log.Log(GOCUI, "verify rect:", tk.v.Name())
|
||||
tk.verifyRect()
|
||||
|
||||
if tk.node.WidgetType == widget.Stdout {
|
||||
if tk.node.WidgetType == widget.Stdout {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
20
find.go
20
find.go
|
@ -68,27 +68,27 @@ func (tk *guiWidget) setFullSize() rectType {
|
|||
r.h1 = tk.gocuiSize.h1
|
||||
*/
|
||||
var changed bool
|
||||
if tk.gocuiSize.w0 != r.w0 {
|
||||
tk.gocuiSize.w0 = r.w0
|
||||
if tk.full.w0 != r.w0 {
|
||||
tk.full.w0 = r.w0
|
||||
changed = true
|
||||
}
|
||||
if tk.gocuiSize.w1 != r.w1 {
|
||||
tk.gocuiSize.w1 = r.w1
|
||||
if tk.full.w1 != r.w1 {
|
||||
tk.full.w1 = r.w1
|
||||
changed = true
|
||||
}
|
||||
if tk.gocuiSize.h0 != r.h0 {
|
||||
tk.gocuiSize.h0 = r.h0
|
||||
if tk.full.h0 != r.h0 {
|
||||
tk.full.h0 = r.h0
|
||||
changed = true
|
||||
}
|
||||
if tk.gocuiSize.h1 != r.h1 {
|
||||
tk.gocuiSize.h1 = r.h1
|
||||
if tk.full.h1 != r.h1 {
|
||||
tk.full.h1 = r.h1
|
||||
changed = true
|
||||
}
|
||||
if changed {
|
||||
if tk.node.WidgetType == widget.Window {
|
||||
log.Info("REDRAW WINDOW IN setFullSize()")
|
||||
tk.gocuiSize.w1 = r.w1 + 2
|
||||
tk.gocuiSize.h1 = r.h1 + 1
|
||||
tk.full.w1 = r.w1 + 2
|
||||
tk.full.h1 = r.h1 + 1
|
||||
tk.Hide()
|
||||
tk.drawView()
|
||||
}
|
||||
|
|
28
treeDraw.go
28
treeDraw.go
|
@ -33,19 +33,31 @@ func (tk *guiWidget) drawView() {
|
|||
me.baseGui.DeleteView(tk.cuiName)
|
||||
tk.v = nil
|
||||
|
||||
if tk.node.WidgetType == widget.Window {
|
||||
if !tk.resize {
|
||||
tk.resize = true
|
||||
tk.textResize() // resize window only once
|
||||
}
|
||||
} else {
|
||||
tk.textResize() // resize everything except windows
|
||||
}
|
||||
a := tk.gocuiSize.w0
|
||||
b := tk.gocuiSize.h0
|
||||
c := tk.gocuiSize.w1
|
||||
d := tk.gocuiSize.h1
|
||||
|
||||
if tk.node.WidgetType == widget.Window {
|
||||
if !tk.resize {
|
||||
tk.resize = true
|
||||
tk.textResize() // resize window only once
|
||||
} else {
|
||||
// for windows, make it the full size
|
||||
a = tk.full.w0
|
||||
b = tk.full.h0
|
||||
c = tk.full.w1
|
||||
d = tk.full.h1
|
||||
}
|
||||
} else {
|
||||
tk.textResize() // resize everything except windows
|
||||
a = tk.gocuiSize.w0
|
||||
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)
|
||||
if err == nil {
|
||||
tk.dumpWidget("drawView() err")
|
||||
|
|
Loading…
Reference in New Issue