debian/gocui/add.go

80 lines
1.5 KiB
Go
Raw Permalink Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
log "go.wit.com/log"
"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
}
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
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.Name)
2024-01-01 16:11:54 -06:00
switch n.WidgetType {
case widget.Root:
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
case widget.Flag:
2024-01-01 16:11:54 -06:00
nw.color = &colorFlag
n.setFake()
return
case widget.Window:
2024-01-01 16:11:54 -06:00
nw.frame = false
nw.color = &colorWindow
// redoWindows(0,0)
return
case widget.Tab:
2024-01-01 16:11:54 -06:00
nw.color = &colorTab
// redoWindows(0,0)
return
case widget.Button:
2024-01-01 16:11:54 -06:00
nw.color = &colorButton
case widget.Box:
2024-01-01 16:11:54 -06:00
nw.color = &colorBox
nw.isFake = true
n.setFake()
return
case widget.Grid:
2024-01-01 16:11:54 -06:00
nw.color = &colorGrid
nw.isFake = true
n.setFake()
return
case widget.Group:
2024-01-01 16:11:54 -06:00
nw.color = &colorGroup
nw.frame = false
return
case widget.Label:
2024-01-01 16:11:54 -06:00
nw.color = &colorLabel
nw.frame = false
return
default:
/*
if n.IsCurrent() {
n.updateCurrent()
}
*/
}
n.showWidgetPlacement(true, "addWidget()")
2024-01-01 16:11:54 -06:00
}