summaryrefslogtreecommitdiff
path: root/toolkit/gocui/click.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-26 12:18:08 -0500
committerJeff Carr <[email protected]>2023-04-26 12:18:08 -0500
commit41aa58692fd1937b71dee4e1e710dee822a84556 (patch)
tree6bd162dc61a51b843021db10931679cad10f2cab /toolkit/gocui/click.go
parent4c353421343966912124aa8ad612f0fa72685b0b (diff)
gocli: close to working tabs
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/click.go')
-rw-r--r--toolkit/gocui/click.go31
1 files changed, 26 insertions, 5 deletions
diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go
index 6f9aa06..214ef0b 100644
--- a/toolkit/gocui/click.go
+++ b/toolkit/gocui/click.go
@@ -10,6 +10,15 @@ import (
"git.wit.org/wit/gui/toolkit"
)
+// set isCurrent = false everywhere
+func UnsetCurrent(w *cuiWidget) {
+ w.isCurrent = false
+
+ for _, child := range w.children {
+ UnsetCurrent(child)
+ }
+}
+
func (w *cuiWidget) doWidgetClick() {
switch w.widgetType {
case toolkit.Root:
@@ -18,20 +27,32 @@ func (w *cuiWidget) doWidgetClick() {
me.rootNode.nextH = 0
me.rootNode.redoTabs(true)
case toolkit.Flag:
- me.rootNode.redoColor(true)
+ // me.rootNode.redoColor(true)
+ me.rootNode.dumpTree(true)
case toolkit.Window:
+ UnsetCurrent(me.rootNode)
me.rootNode.hideWidgets()
+
+ me.rootNode.nextW = 0
+ me.rootNode.nextH = 0
+ me.rootNode.redoTabs(true)
+
+ w.isCurrent = true
if w.hasTabs {
- // w.isCurrent = false
- w.isCurrent = true
- } else {
- w.isCurrent = true
+ // set isCurrent = true on the first tab
+ for _, child := range w.children {
+ child.isCurrent = true
+ break
+ }
}
+
w.placeWidgets()
w.showWidgets()
+ // THIS IS THE BEGINING OF THE LAYOUT
case toolkit.Tab:
me.rootNode.hideWidgets()
w.isCurrent = true
+ w.parent.isCurrent = true
w.placeWidgets()
w.showWidgets()
case toolkit.Group: