aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/interfaces.go5
-rw-r--r--lib/ui/tab.go8
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go
index a28c6c29..8ede22c7 100644
--- a/lib/ui/interfaces.go
+++ b/lib/ui/interfaces.go
@@ -20,6 +20,11 @@ type Closeable interface {
Close()
}
+type Visible interface {
+ // Indicate that this component is visible or not
+ Show(bool)
+}
+
type RootDrawable interface {
Initialize(ui *UI)
}
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index b992a8a2..b62764fb 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -153,9 +153,17 @@ func (tabs *Tabs) selectPriv(index int) bool {
if tabs.curIndex != index {
// only push valid tabs onto the history
if tabs.curIndex < len(tabs.tabs) {
+ prev := tabs.tabs[tabs.curIndex]
+ if vis, ok := prev.Content.(Visible); ok {
+ vis.Show(false)
+ }
tabs.pushHistory(tabs.curIndex)
}
tabs.curIndex = index
+ next := tabs.tabs[tabs.curIndex]
+ if vis, ok := next.Content.(Visible); ok {
+ vis.Show(true)
+ }
Invalidate()
}
return true