Added GetFrontPage() to Pages. Resolves #355

This commit is contained in:
Oliver 2019-10-18 14:55:27 +02:00
parent 731cb7162a
commit 685bf6da76
1 changed files with 11 additions and 0 deletions

View File

@ -226,6 +226,17 @@ func (p *Pages) SendToBack(name string) *Pages {
return p
}
// GetFrontPage returns the front-most visible page. If there are no visible
// pages, ("", nil) is returned.
func (p *Pages) GetFrontPage() (name string, item Primitive) {
for index := len(p.pages) - 1; index >= 0; index-- {
if p.pages[index].Visible {
return p.pages[index].Name, p.pages[index].Item
}
}
return
}
// HasFocus returns whether or not this primitive has focus.
func (p *Pages) HasFocus() bool {
for _, page := range p.pages {