summaryrefslogtreecommitdiff
path: root/toolkit/gocui/click.go
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/gocui/click.go')
-rw-r--r--toolkit/gocui/click.go50
1 files changed, 29 insertions, 21 deletions
diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go
index d0c5d90..f0f325e 100644
--- a/toolkit/gocui/click.go
+++ b/toolkit/gocui/click.go
@@ -25,8 +25,34 @@ func updateCurrentTabs() {
me.rootNode.redoTabs(true)
}
+// shows the widgets in a window
+func setCurrentWindow(w *cuiWidget) {
+ if w.widgetType != toolkit.Window {
+ return
+ }
+ UnsetCurrent(me.rootNode)
+ me.rootNode.hideWidgets()
+
+ // THIS IS THE BEGINING OF THE LAYOUT
+ me.rootNode.nextW = 0
+ me.rootNode.nextH = 0
+
+ w.isCurrent = true
+ if w.hasTabs {
+ // set isCurrent = true on the first tab
+ for _, child := range w.children {
+ child.isCurrent = true
+ break
+ }
+ }
+ me.rootNode.redoTabs(true)
+
+ w.placeWidgets()
+ w.showWidgets()
+}
+
// shows the widgets in a tab
-func setCurrent(w *cuiWidget) {
+func setCurrentTab(w *cuiWidget) {
if w.widgetType != toolkit.Tab {
return
}
@@ -51,27 +77,9 @@ func (w *cuiWidget) doWidgetClick() {
// 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
-
- w.isCurrent = true
- if w.hasTabs {
- // set isCurrent = true on the first tab
- for _, child := range w.children {
- child.isCurrent = true
- break
- }
- }
- me.rootNode.redoTabs(true)
-
- w.placeWidgets()
- w.showWidgets()
- // THIS IS THE BEGINING OF THE LAYOUT
+ setCurrentWindow(w)
case toolkit.Tab:
- setCurrent(w)
+ setCurrentTab(w)
case toolkit.Group:
w.placeWidgets()
w.toggleTree()