86 lines
1.7 KiB
Go
86 lines
1.7 KiB
Go
package main
|
|
|
|
import (
|
|
log "go.wit.com/log"
|
|
"go.wit.com/toolkits/tree"
|
|
"go.wit.com/widget"
|
|
)
|
|
|
|
var fakeStartWidth int = me.FakeW
|
|
var fakeStartHeight int = me.TabH + me.FramePadH
|
|
|
|
// setup fake labels for non-visible things off screen
|
|
func setFake(n *tree.Node) {
|
|
var w *guiWidget
|
|
w = n.TK.(*guiWidget)
|
|
w.isFake = true
|
|
|
|
w.gocuiSetWH(fakeStartWidth, fakeStartHeight)
|
|
|
|
fakeStartHeight += w.gocuiSize.Height()
|
|
// TODO: use the actual max hight of the terminal window
|
|
if fakeStartHeight > 24 {
|
|
fakeStartHeight = me.TabH
|
|
fakeStartWidth += me.FakeW
|
|
}
|
|
if true {
|
|
w.showView()
|
|
}
|
|
}
|
|
|
|
// set the widget start width & height
|
|
// func (n *node) addWidget(n *tree.Node) {
|
|
func addWidget(n *tree.Node) {
|
|
var nw *guiWidget
|
|
nw = n.TK.(*guiWidget)
|
|
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.String())
|
|
switch n.WidgetType {
|
|
case widget.Root:
|
|
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
|
nw.color = &colorRoot
|
|
setFake(n)
|
|
return
|
|
case widget.Flag:
|
|
nw.color = &colorFlag
|
|
setFake(n)
|
|
return
|
|
case widget.Window:
|
|
nw.frame = false
|
|
nw.color = &colorWindow
|
|
wRoot := me.treeRoot.TK.(*guiWidget)
|
|
wRoot.redoWindows(0, 0)
|
|
return
|
|
case widget.Tab:
|
|
nw.color = &colorTab
|
|
// redoWindows(0,0)
|
|
return
|
|
case widget.Button:
|
|
nw.color = &colorButton
|
|
case widget.Box:
|
|
nw.color = &colorBox
|
|
nw.isFake = true
|
|
setFake(n)
|
|
return
|
|
case widget.Grid:
|
|
nw.color = &colorGrid
|
|
nw.isFake = true
|
|
setFake(n)
|
|
return
|
|
case widget.Group:
|
|
nw.color = &colorGroup
|
|
nw.frame = false
|
|
return
|
|
case widget.Label:
|
|
nw.color = &colorLabel
|
|
nw.frame = false
|
|
return
|
|
default:
|
|
/*
|
|
if n.IsCurrent() {
|
|
n.updateCurrent()
|
|
}
|
|
*/
|
|
}
|
|
nw.showWidgetPlacement("addWidget()")
|
|
}
|