gadget window displays correctly for some reason
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
a15aea03ea
commit
94b41aa18a
8
Makefile
8
Makefile
|
@ -5,7 +5,13 @@ plugin:
|
|||
GO111MODULE=off go build -v -buildmode=plugin -o ../gocui.so
|
||||
|
||||
pluginreal:
|
||||
go build -v -buildmode=plugin -o ~/go/lib/gocui.so
|
||||
go build -v -buildmode=plugin -o ~/go/lib/toolkits/gocui.so
|
||||
|
||||
# Test the README.md & doc.go file
|
||||
# this runs pkgsite, the binary that does dev.go.dev
|
||||
# go install golang.org/x/pkgsite/cmd/pkgsite@latest
|
||||
pkgsite:
|
||||
pkgsite
|
||||
|
||||
objdump:
|
||||
objdump -t ../gocui.so |less
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# a console toolkit around gocui
|
||||
|
||||
https://github.com/termstandard/colors#truecolor-support-in-output-devices
|
||||
[terminals that support ture color](https://github.com/termstandard/colors#truecolor-support-in-output-devices)
|
||||
|
|
3
add.go
3
add.go
|
@ -43,7 +43,8 @@ func addWidget(n *tree.Node) {
|
|||
return
|
||||
case widget.Window:
|
||||
nw.frame = false
|
||||
nw.color = &colorWindow
|
||||
// nw.color = &colorWindow
|
||||
nw.setColor(&colorWindow)
|
||||
wRoot := me.treeRoot.TK.(*guiWidget)
|
||||
wRoot.redoWindows(0, 0)
|
||||
// TODO: record the first window here?
|
||||
|
|
4
click.go
4
click.go
|
@ -85,12 +85,12 @@ func (w *guiWidget) doWidgetClick() {
|
|||
w.showWidgets()
|
||||
case widget.Box:
|
||||
// w.showWidgetPlacement(logNow, "drawTree()")
|
||||
if w.direction == widget.Horizontal {
|
||||
if w.node.State.Direction == widget.Horizontal {
|
||||
log.Log(NOW, "BOX IS HORIZONTAL", w.String())
|
||||
} else {
|
||||
log.Log(NOW, "BOX IS VERTICAL", w.String())
|
||||
}
|
||||
w.placeWidgets(me.RawW, me.RawH)
|
||||
w.placeWidgets(w.startW, w.startH)
|
||||
w.toggleTree()
|
||||
case widget.Button:
|
||||
// doUserEvent(n)
|
||||
|
|
14
place.go
14
place.go
|
@ -22,13 +22,15 @@ func (tk *guiWidget) placeBox(startW int, startH int) {
|
|||
log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
|
||||
child.placeWidgets(newW, newH)
|
||||
sizeW, sizeH = child.Size()
|
||||
if child.direction == widget.Horizontal {
|
||||
log.Log(INFO, "BOX IS HORIZONTAL", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String())
|
||||
// expand based on the child width
|
||||
newW += sizeW
|
||||
} else {
|
||||
if child.node.State.Direction == widget.Vertical {
|
||||
log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String())
|
||||
// expand based on the child height
|
||||
// something is wrong here
|
||||
newW += sizeW
|
||||
} else {
|
||||
log.Log(INFO, "BOX IS HORIZONTAL", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String())
|
||||
// expand based on the child width
|
||||
// something is wrong here
|
||||
newH += sizeH
|
||||
}
|
||||
log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
|
||||
|
@ -74,7 +76,6 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
|||
case widget.Group:
|
||||
// move the group to the parent's next location
|
||||
tk.gocuiSetWH(startW, startH)
|
||||
// tk.dumpTree("start place")
|
||||
|
||||
newW := startW + me.GroupPadW
|
||||
newH := startH + 1 // normal hight of the group label
|
||||
|
@ -93,7 +94,6 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
|||
}
|
||||
log.Log(INFO, "REAL HEIGHT sizeW:", sizeW, "sizeH:", sizeH)
|
||||
}
|
||||
// tk.dumpTree("end place")
|
||||
return maxW, newH - startH
|
||||
default:
|
||||
tk.gocuiSetWH(startW, startH)
|
||||
|
|
2
size.go
2
size.go
|
@ -116,7 +116,7 @@ func (w *guiWidget) sizeBox() (int, int) {
|
|||
continue
|
||||
}
|
||||
sizeW, sizeH := child.Size()
|
||||
if child.direction == widget.Horizontal {
|
||||
if child.node.State.Direction == widget.Horizontal {
|
||||
maxW += sizeW
|
||||
if sizeH > maxH {
|
||||
maxH = sizeH
|
||||
|
|
|
@ -155,7 +155,7 @@ type guiWidget struct {
|
|||
// AtW int
|
||||
// AtH int
|
||||
|
||||
direction widget.Orientation
|
||||
// direction widget.Orientation
|
||||
|
||||
// progname string
|
||||
|
||||
|
|
Loading…
Reference in New Issue