window widgets are being displayed

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-29 23:01:39 -06:00
parent d97ce2aecc
commit 5ef1bd1021
5 changed files with 23 additions and 36 deletions

3
add.go
View File

@ -47,7 +47,8 @@ func addWidget(n *tree.Node) {
case widget.Window:
nw.frame = false
nw.color = &colorWindow
// redoWindows(0,0)
wRoot := me.treeRoot.TK.(*guiWidget)
wRoot.redoWindows(0, 0)
return
case widget.Tab:
nw.color = &colorTab

View File

@ -95,7 +95,8 @@ func (w *guiWidget) doWidgetClick() {
case widget.Root:
// THIS IS THE BEGINING OF THE LAYOUT
log.Log(NOW, "doWidgetClick()", w.String())
redoWindows(0, 0)
wRoot := me.treeRoot.TK.(*guiWidget)
wRoot.redoWindows(0, 0)
case widget.Flag:
log.Log(NOW, "doWidgetClick() FLAG widget name =", w.String())
log.Log(NOW, "doWidgetClick() if this is the dropdown menu, handle it here?")

View File

@ -81,7 +81,8 @@ func addDebugKeys(g *gocui.Gui) {
var w *guiWidget
w = me.treeRoot.TK.(*guiWidget)
if redoWidgets {
redoWindows(0, 0)
wRoot := me.treeRoot.TK.(*guiWidget)
wRoot.redoWindows(0, 0)
redoWidgets = false
} else {
w.hideWidgets()
@ -126,7 +127,8 @@ func addDebugKeys(g *gocui.Gui) {
// redo windows
g.SetKeybinding("", 'w', gocui.ModNone,
func(g *gocui.Gui, v *gocui.View) error {
redoWindows(0, 0)
wRoot := me.treeRoot.TK.(*guiWidget)
wRoot.redoWindows(0, 0)
return nil
})

View File

@ -8,7 +8,7 @@ import (
)
func action(a widget.Action) {
log.Log(INFO, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
log.Log(NOW, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
// n := me.rootNode.findWidgetId(a.WidgetId)
n := me.treeRoot.FindWidgetId(a.WidgetId)
var w *guiWidget

45
tab.go
View File

@ -49,41 +49,24 @@ func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) {
}
}
func redoWindows(nextW int, nextH int) {
wRoot := me.treeRoot.TK.(*guiWidget)
for _, win := range wRoot.children {
if win.node.WidgetType != widget.Window {
func (w *guiWidget) redoWindows(nextW int, nextH int) {
var startW int = nextW
var startH int = nextH
for _, child := range w.children {
if child.node.WidgetType != widget.Window {
continue
}
var tabs bool
for _, child := range win.children {
if child.node.WidgetType == widget.Tab {
tabs = true
}
}
if tabs {
// window is tabs. Don't show it as a standard button
win.frame = false
win.hasTabs = true
} else {
win.frame = false
win.hasTabs = false
}
win.gocuiSetWH(nextW, nextH)
win.deleteView()
win.showView()
child.frame = false
child.hasTabs = false
/*
sizeW := win.Width() + me.WindowPadW
sizeH := win.Height()
nextW += sizeW
log.Log(NOW, "redoWindows() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, win.String())
if win.hasTabs {
win.redoTabs(me.TabW, me.TabH)
}
*/
child.gocuiSetWH(nextW, nextH)
child.deleteView()
child.showView()
sizeW := child.gocuiSize.Width()
nextW += sizeW + 4
child.redoWindows(startW + 3, startH + 2)
}
}