Add TabbedPanels.HasTab

This commit is contained in:
Trevor Slocum 2020-10-26 10:04:59 -07:00
parent a3709cc49b
commit 7a5e47b598
1 changed files with 13 additions and 0 deletions

View File

@ -88,6 +88,19 @@ func (t *TabbedPanels) RemoveTab(name string) {
t.updateAll()
}
// HasTab returns true if a tab with the given name exists in this object.
func (t *TabbedPanels) HasTab(name string) bool {
t.RLock()
defer t.RUnlock()
for _, panel := range t.panels.panels {
if panel.Name == name {
return true
}
}
return false
}
// SetCurrentTab sets the currently visible tab.
func (t *TabbedPanels) SetCurrentTab(name string) {
t.Lock()