2024-01-01 16:11:54 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-08 20:52:10 -06:00
|
|
|
log "go.wit.com/log"
|
2024-01-05 13:35:01 -06:00
|
|
|
"go.wit.com/gui/widget"
|
2024-01-01 16:11:54 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
var fakeStartWidth int = me.FakeW
|
|
|
|
var fakeStartHeight int = me.TabH + me.FramePadH
|
|
|
|
// setup fake labels for non-visible things off screen
|
|
|
|
func (n *node) setFake() {
|
|
|
|
w := n.tk
|
|
|
|
w.isFake = true
|
|
|
|
|
|
|
|
n.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
|
|
|
|
}
|
2024-01-08 20:52:10 -06:00
|
|
|
if (true) {
|
2024-01-01 16:11:54 -06:00
|
|
|
n.showView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// set the widget start width & height
|
|
|
|
func (n *node) addWidget() {
|
|
|
|
nw := n.tk
|
2024-01-08 20:52:10 -06:00
|
|
|
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.Name)
|
2024-01-01 16:11:54 -06:00
|
|
|
switch n.WidgetType {
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Root:
|
2024-01-08 20:52:10 -06:00
|
|
|
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.Name)
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorRoot
|
|
|
|
n.setFake()
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Flag:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorFlag
|
|
|
|
n.setFake()
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Window:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.frame = false
|
|
|
|
nw.color = &colorWindow
|
|
|
|
// redoWindows(0,0)
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Tab:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorTab
|
|
|
|
// redoWindows(0,0)
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Button:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorButton
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Box:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorBox
|
|
|
|
nw.isFake = true
|
|
|
|
n.setFake()
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Grid:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorGrid
|
|
|
|
nw.isFake = true
|
|
|
|
n.setFake()
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Group:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorGroup
|
|
|
|
nw.frame = false
|
|
|
|
return
|
2024-01-05 13:35:01 -06:00
|
|
|
case widget.Label:
|
2024-01-01 16:11:54 -06:00
|
|
|
nw.color = &colorLabel
|
|
|
|
nw.frame = false
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
if n.IsCurrent() {
|
|
|
|
n.updateCurrent()
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
2024-01-08 20:52:10 -06:00
|
|
|
n.showWidgetPlacement(true, "addWidget()")
|
2024-01-01 16:11:54 -06:00
|
|
|
}
|