things resized
This commit is contained in:
parent
bff0943dc5
commit
ba629f1892
12
debug.go
12
debug.go
|
@ -5,7 +5,6 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
|
@ -83,16 +82,9 @@ func (tk *guiWidget) dumpWidget(s string) {
|
|||
}
|
||||
var end string
|
||||
if tk.node.WidgetType == widget.Box {
|
||||
end = fmt.Sprintf("%-8s %-8s %s", tk.node.WidgetType, tk.cuiName, tk.node.State.Direction.String())
|
||||
end = fmt.Sprintf("%-8s %-8s %s %s", tk.node.WidgetType, tk.cuiName, tk.node.State.Direction.String(), tk.String())
|
||||
} else {
|
||||
curval := strings.TrimSpace(tk.node.ProgName())
|
||||
if curval == "" {
|
||||
curval = strings.TrimSpace(tk.node.GetLabel())
|
||||
}
|
||||
if curval == "" {
|
||||
curval = strings.TrimSpace(tk.labelN)
|
||||
}
|
||||
end = fmt.Sprintf("%-8s %-8s %s", tk.node.WidgetType, tk.cuiName, curval)
|
||||
end = fmt.Sprintf("%-8s %-8s %s", tk.node.WidgetType, tk.cuiName, tk.String())
|
||||
}
|
||||
log.Log(GOCUI, s1, s, end)
|
||||
}
|
||||
|
|
4
place.go
4
place.go
|
@ -314,8 +314,8 @@ func textSize(n *tree.Node) (int, int) {
|
|||
*/
|
||||
|
||||
func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) {
|
||||
w := len(widget.GetString(tk.value))
|
||||
lines := strings.Split(widget.GetString(tk.value), "\n")
|
||||
w := len(tk.node.GetLabel())
|
||||
lines := strings.Split(tk.node.GetLabel(), "\n")
|
||||
h := len(lines)
|
||||
|
||||
if tk.Hidden() {
|
||||
|
|
2
size.go
2
size.go
|
@ -76,7 +76,7 @@ func (tk *guiWidget) Size() (int, int) {
|
|||
case widget.Label:
|
||||
return len(tk.String()) + 2, 1
|
||||
case widget.Textbox:
|
||||
return len(tk.String()) + 10, 3 // TODO: compute this based on 'window dense'
|
||||
return len(tk.String()) + 2, 3 // TODO: compute this based on 'window dense'
|
||||
case widget.Checkbox:
|
||||
return len(tk.String()) + 2, 3 // TODO: compute this based on 'window dense'
|
||||
case widget.Button:
|
||||
|
|
|
@ -109,6 +109,11 @@ func textboxClosed() {
|
|||
win := me.textbox.callerTK.findParentWindow()
|
||||
if win != nil {
|
||||
win.dumpWidget("redraw this!!!")
|
||||
tk := me.textbox.callerTK
|
||||
me.textbox.callerTK.dumpWidget("resize this!!!")
|
||||
me.textbox.callerTK.Size()
|
||||
me.textbox.callerTK.placeWidgets(tk.gocuiSize.w0-4, tk.gocuiSize.h0-4)
|
||||
tk.dumpWidget("resize:" + tk.String())
|
||||
win.redrawWindow(win.gocuiSize.w0, win.gocuiSize.h0)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ package main
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
|
@ -74,7 +75,24 @@ func (w *guiWidget) deleteView() {
|
|||
}
|
||||
|
||||
func (tk *guiWidget) String() string {
|
||||
return tk.node.String()
|
||||
curval := strings.TrimSpace(tk.node.GetLabel())
|
||||
if curval != "" {
|
||||
return curval
|
||||
}
|
||||
curval = tk.node.String()
|
||||
if curval != "" {
|
||||
return curval
|
||||
}
|
||||
curval = strings.TrimSpace(tk.node.ProgName())
|
||||
if curval != "" {
|
||||
return curval
|
||||
}
|
||||
// deprecate this?
|
||||
curval = strings.TrimSpace(tk.labelN)
|
||||
if curval != "" {
|
||||
return curval
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (tk *guiWidget) Visible() bool {
|
||||
|
|
Loading…
Reference in New Issue