summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-05 14:29:38 -0600
committerJeff Carr <[email protected]>2025-02-05 14:29:38 -0600
commitc328a755c60d1e4bcad64c23077d4bb0f1016537 (patch)
tree212a69232a3d55e64771c07d605cd28fe98e7b73
parent3fa508f786fc6830640ce185145eb07253429f71 (diff)
windowFrame is below window widget correctly
-rw-r--r--structs.go1
-rw-r--r--treeDraw.go6
-rw-r--r--window.go19
3 files changed, 21 insertions, 5 deletions
diff --git a/structs.go b/structs.go
index 718bb47..ce06d02 100644
--- a/structs.go
+++ b/structs.go
@@ -100,6 +100,7 @@ type guiWidget struct {
children []*guiWidget // mirrors the binary node tree
node *tree.Node // the pointer back to the tree
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?
currentTab bool // the visible tab
value string // ?
diff --git a/treeDraw.go b/treeDraw.go
index b70bab2..3bea50c 100644
--- a/treeDraw.go
+++ b/treeDraw.go
@@ -50,7 +50,11 @@ func (tk *guiWidget) drawView() {
d = tk.full.h1
}
} 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
b = tk.gocuiSize.h0
c = tk.gocuiSize.w1
diff --git a/window.go b/window.go
index 50c08a3..6948029 100644
--- a/window.go
+++ b/window.go
@@ -42,8 +42,18 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
tk.windowFrame.makeTK([]string{"windowFrame"})
}
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()
+ me.baseGui.SetViewBeneath(tk.windowFrame.cuiName, tk.cuiName, 1)
}
// 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
tk := new(guiWidget)
tk.frame = true
- tk.labelN = "DropBox text"
+ tk.labelN = "windowFrame text"
+ tk.internal = true
tk.node = n
if tk.node.Parent == nil {
tk.node.Parent = me.treeRoot
}
// 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
tk.cuiName = fmt.Sprintf("%d DR", wId)
- tk.color = &colorFlag
+ tk.color = &colorGroup
// add this new widget on the binary tree
tk.parent = win