windowFrame is below window widget correctly

This commit is contained in:
Jeff Carr 2025-02-05 14:29:38 -06:00
parent 3fa508f786
commit c328a755c6
3 changed files with 21 additions and 5 deletions

View File

@ -100,6 +100,7 @@ type guiWidget struct {
children []*guiWidget // mirrors the binary node tree children []*guiWidget // mirrors the binary node tree
node *tree.Node // the pointer back to the tree node *tree.Node // the pointer back to the tree
windowFrame *guiWidget // this is the frame for a window widget windowFrame *guiWidget // this is the frame for a window widget
internal bool // indicates the widget is internal to gocui and should be treated differently
hasTabs bool // does the window have tabs? hasTabs bool // does the window have tabs?
currentTab bool // the visible tab currentTab bool // the visible tab
value string // ? value string // ?

View File

@ -50,7 +50,11 @@ func (tk *guiWidget) drawView() {
d = tk.full.h1 d = tk.full.h1
} }
} else { } else {
tk.textResize() // resize everything except windows if tk.internal {
// do nothing
} else {
tk.textResize() // resize gocui frame to the widget text
}
a = tk.gocuiSize.w0 a = tk.gocuiSize.w0
b = tk.gocuiSize.h0 b = tk.gocuiSize.h0
c = tk.gocuiSize.w1 c = tk.gocuiSize.w1

View File

@ -42,8 +42,18 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
tk.windowFrame.makeTK([]string{"windowFrame"}) tk.windowFrame.makeTK([]string{"windowFrame"})
} }
tk.windowFrame.MoveToOffset(w, h+2) tk.windowFrame.MoveToOffset(w, h+2)
tk.windowFrame.drawView() r := tk.getFullSize()
tk.windowFrame.gocuiSize.w0 = r.w0
tk.windowFrame.gocuiSize.w1 = r.w1
tk.windowFrame.gocuiSize.h0 = r.h0
tk.windowFrame.gocuiSize.h1 = r.h1
tk.windowFrame.full.w0 = r.w0
tk.windowFrame.full.w1 = r.w1
tk.windowFrame.full.h0 = r.h0
tk.windowFrame.full.h1 = r.h1
// tk.windowFrame.drawView()
tk.windowFrame.Show() tk.windowFrame.Show()
me.baseGui.SetViewBeneath(tk.windowFrame.cuiName, tk.cuiName, 1)
} }
// re-draws the buttons for each of the windows // re-draws the buttons for each of the windows
@ -73,19 +83,20 @@ func (win *guiWidget) addWindowFrame(wId int) *tree.Node {
// store the internal toolkit information // store the internal toolkit information
tk := new(guiWidget) tk := new(guiWidget)
tk.frame = true tk.frame = true
tk.labelN = "DropBox text" tk.labelN = "windowFrame text"
tk.internal = true
tk.node = n tk.node = n
if tk.node.Parent == nil { if tk.node.Parent == nil {
tk.node.Parent = me.treeRoot tk.node.Parent = me.treeRoot
} }
// copy the data from the action message // copy the data from the action message
tk.node.State.Label = "DropBox" tk.node.State.Label = "windowFrame"
// set the name used by gocui to the id // set the name used by gocui to the id
tk.cuiName = fmt.Sprintf("%d DR", wId) tk.cuiName = fmt.Sprintf("%d DR", wId)
tk.color = &colorFlag tk.color = &colorGroup
// add this new widget on the binary tree // add this new widget on the binary tree
tk.parent = win tk.parent = win