summaryrefslogtreecommitdiff
path: root/toolkit/gocui/structs.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-26 11:18:26 -0500
committerJeff Carr <[email protected]>2023-04-26 11:18:26 -0500
commit4c353421343966912124aa8ad612f0fa72685b0b (patch)
tree863c658146c323d83a5a90e6d45d7ffcc6128c89 /toolkit/gocui/structs.go
parente0269b216e1bbd04c1f2f8d6f9e6f3140a219870 (diff)
gocui: tracking windows and tabs separately
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/structs.go')
-rw-r--r--toolkit/gocui/structs.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/toolkit/gocui/structs.go b/toolkit/gocui/structs.go
index a772d8a..7972cfd 100644
--- a/toolkit/gocui/structs.go
+++ b/toolkit/gocui/structs.go
@@ -55,8 +55,8 @@ type config struct {
TabPadW int `default:"4" dense:"0"`
// how far down to start Window or Tab headings
- WindowW int `default:"20" dense:"0"`
- WindowH int `default:"0" dense:"0"`
+ WindowW int `default:"8" dense:"0"`
+ WindowH int `default:"-1"`
TabW int `default:"2" dense:"0"`
TabH int `default:"2" dense:"0"`
@@ -118,10 +118,12 @@ type cuiWidget struct {
vals []string // dropdown menu options
- // visable bool // track if it's currently supposed to be shown
+ isCurrent bool // is this the currently displayed Window or Tab?
+ hasTabs bool // does the window have tabs?
isFake bool // widget types like 'box' are 'false'
// where the widget's real corner is
+ // should we always compute this?
startW int
startH int
@@ -168,6 +170,25 @@ type cuiWidget struct {
children []*cuiWidget
}
+func (w *cuiWidget) IsCurrent() bool {
+ if (w.widgetType == toolkit.Tab) {
+ return w.isCurrent
+ }
+ if (w.widgetType == toolkit.Window) {
+ return w.isCurrent
+ }
+ if (w.widgetType == toolkit.Root) {
+ return false
+ }
+ return w.parent.IsCurrent()
+}
+
+func (w *cuiWidget) StartW() {
+}
+
+func (w *cuiWidget) StartH() {
+}
+
// from the gocui devs:
// Write appends a byte slice into the view's internal buffer. Because
// View implements the io.Writer interface, it can be passed as parameter