mirror of https://github.com/rivo/tview.git
Added Page.GetPageNames(visibleOnly bool) API.
This commit is contained in:
parent
b0d41c484b
commit
74079f4570
12
pages.go
12
pages.go
|
@ -52,6 +52,18 @@ func (p *Pages) GetPageCount() int {
|
||||||
return len(p.pages)
|
return len(p.pages)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPageNames returns all page names ordered from front to back,
|
||||||
|
// optionally limited to visible pages.
|
||||||
|
func (p *Pages) GetPageNames(visibleOnly bool) []string {
|
||||||
|
var names []string
|
||||||
|
for index := len(p.pages) - 1; index >= 0; index-- {
|
||||||
|
if !visibleOnly || p.pages[index].Visible {
|
||||||
|
names = append(names, p.pages[index].Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return names
|
||||||
|
}
|
||||||
|
|
||||||
// AddPage adds a new page with the given name and primitive. If there was
|
// AddPage adds a new page with the given name and primitive. If there was
|
||||||
// previously a page with the same name, it is overwritten. Leaving the name
|
// previously a page with the same name, it is overwritten. Leaving the name
|
||||||
// empty may cause conflicts in other functions so always specify a non-empty
|
// empty may cause conflicts in other functions so always specify a non-empty
|
||||||
|
|
Loading…
Reference in New Issue