diff options
| author | Jeff Carr <[email protected]> | 2023-04-26 12:18:08 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-04-26 12:18:08 -0500 |
| commit | 41aa58692fd1937b71dee4e1e710dee822a84556 (patch) | |
| tree | 6bd162dc61a51b843021db10931679cad10f2cab | |
| parent | 4c353421343966912124aa8ad612f0fa72685b0b (diff) | |
gocli: close to working tabs
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | toolkit/gocui/add.go | 1 | ||||
| -rw-r--r-- | toolkit/gocui/click.go | 31 |
2 files changed, 26 insertions, 6 deletions
diff --git a/toolkit/gocui/add.go b/toolkit/gocui/add.go index dc81130..1282081 100644 --- a/toolkit/gocui/add.go +++ b/toolkit/gocui/add.go @@ -46,7 +46,6 @@ func (w *cuiWidget) addWidget() { case toolkit.Window: w.setTabWH() w.drawView() - // w.frame = false return case toolkit.Tab: w.setTabWH() 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: |
