add (non-focused) keyboard scrolling to grid view pages
This commit is contained in:
@@ -30,10 +30,17 @@ type Searchable interface {
|
||||
SearchWidget() fyne.Focusable
|
||||
}
|
||||
|
||||
// Pages with selection should implement this interface to receive Ctrl+A events
|
||||
type CanSelectAll interface {
|
||||
SelectAll()
|
||||
}
|
||||
|
||||
// Pages that have one main scrollable view should implement this interface
|
||||
// to receive callbacks from window-level keyboard scrolling (up/down)
|
||||
type Scrollable interface {
|
||||
Scroll(amount float32)
|
||||
}
|
||||
|
||||
type CanShowNowPlaying interface {
|
||||
OnSongChange(song, lastScrobbledIfAny *mediaprovider.Track)
|
||||
}
|
||||
@@ -169,6 +176,18 @@ func (b *BrowsingPane) SelectAll() {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) ScrollUp() {
|
||||
if s, ok := b.curPage.(Scrollable); ok {
|
||||
s.Scroll(-75)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) ScrollDown() {
|
||||
if s, ok := b.curPage.(Scrollable); ok {
|
||||
s.Scroll(75)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) doSetPage(p Page) bool {
|
||||
if b.curPage != nil && b.curPage.Route() == p.Route() {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user