summaryrefslogtreecommitdiff
path: root/toolkit/gocui/click.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-26 14:25:48 -0500
committerJeff Carr <[email protected]>2023-04-26 14:25:48 -0500
commitd4b0b8b6b6e3141114ebb448438922192c725763 (patch)
tree7439b651b89c68ec117adaf3126e7b5bcbc677f4 /toolkit/gocui/click.go
parent18661d38da0a56c2044b6964f2e09f8bb81d1be3 (diff)
gocui: code cleanups
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/click.go')
-rw-r--r--toolkit/gocui/click.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go
index 14ae53d..d0c5d90 100644
--- a/toolkit/gocui/click.go
+++ b/toolkit/gocui/click.go
@@ -19,6 +19,27 @@ func UnsetCurrent(w *cuiWidget) {
}
}
+func updateCurrentTabs() {
+ me.rootNode.nextW = 0
+ me.rootNode.nextH = 0
+ me.rootNode.redoTabs(true)
+}
+
+// shows the widgets in a tab
+func setCurrent(w *cuiWidget) {
+ if w.widgetType != toolkit.Tab {
+ return
+ }
+ me.current = w
+ UnsetCurrent(me.rootNode)
+ me.rootNode.hideWidgets()
+ w.isCurrent = true
+ w.parent.isCurrent = true
+ updateCurrentTabs()
+ w.placeWidgets()
+ w.showWidgets()
+}
+
func (w *cuiWidget) doWidgetClick() {
switch w.widgetType {
case toolkit.Root:
@@ -50,13 +71,7 @@ func (w *cuiWidget) doWidgetClick() {
w.showWidgets()
// THIS IS THE BEGINING OF THE LAYOUT
case toolkit.Tab:
- UnsetCurrent(me.rootNode)
-
- me.rootNode.hideWidgets()
- w.isCurrent = true
- w.parent.isCurrent = true
- w.placeWidgets()
- w.showWidgets()
+ setCurrent(w)
case toolkit.Group:
w.placeWidgets()
w.toggleTree()