tracklist column visibility menu can be dismissed with escape key
This commit is contained in:
@@ -87,6 +87,9 @@ func (m *Controller) ConnectTracklistActions(tracklist *widgets.Tracklist) {
|
|||||||
tracklist.OnShowArtistPage = func(artistID string) {
|
tracklist.OnShowArtistPage = func(artistID string) {
|
||||||
m.NavigateTo(ArtistRoute(artistID))
|
m.NavigateTo(ArtistRoute(artistID))
|
||||||
}
|
}
|
||||||
|
tracklist.OnColumnVisibilityMenuShown = func(pop *widget.PopUp) {
|
||||||
|
m.ClosePopUpOnEscape(pop)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Controller) PromptForFirstServer() {
|
func (m *Controller) PromptForFirstServer() {
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ type ListColumn struct {
|
|||||||
type ListHeader struct {
|
type ListHeader struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
OnColumnVisibilityChanged func(int, bool)
|
OnColumnVisibilityChanged func(int, bool)
|
||||||
|
OnColumnVisibilityMenuShown func(*widget.PopUp)
|
||||||
|
|
||||||
columns []ListColumn
|
columns []ListColumn
|
||||||
columnVisible []bool
|
columnVisible []bool
|
||||||
@@ -84,6 +85,9 @@ func (l *ListHeader) TappedSecondary(e *fyne.PointEvent) {
|
|||||||
}
|
}
|
||||||
pop := widget.NewPopUp(l.popUpMenu, fyne.CurrentApp().Driver().CanvasForObject(l))
|
pop := widget.NewPopUp(l.popUpMenu, fyne.CurrentApp().Driver().CanvasForObject(l))
|
||||||
pop.ShowAtPosition(e.AbsolutePosition)
|
pop.ShowAtPosition(e.AbsolutePosition)
|
||||||
|
if l.OnColumnVisibilityMenuShown != nil {
|
||||||
|
l.OnColumnVisibilityMenuShown(pop)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *ListHeader) setupPopUpMenu() {
|
func (l *ListHeader) setupPopUpMenu() {
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ type Tracklist struct {
|
|||||||
OnShowArtistPage func(artistID string)
|
OnShowArtistPage func(artistID string)
|
||||||
OnShowAlbumPage func(albumID string)
|
OnShowAlbumPage func(albumID string)
|
||||||
|
|
||||||
|
OnColumnVisibilityMenuShown func(*widget.PopUp)
|
||||||
|
|
||||||
visibleColumns []bool
|
visibleColumns []bool
|
||||||
|
|
||||||
selectionMgr util.ListSelectionManager
|
selectionMgr util.ListSelectionManager
|
||||||
@@ -69,6 +71,11 @@ func NewTracklist(tracks []*subsonic.Child) *Tracklist {
|
|||||||
t.colLayout = layouts.NewColumnsLayout([]float32{35, -1, -1, -1, 60, 60, 47, 65, 75})
|
t.colLayout = layouts.NewColumnsLayout([]float32{35, -1, -1, -1, 60, 60, 47, 65, 75})
|
||||||
t.buildHeader()
|
t.buildHeader()
|
||||||
t.hdr.OnColumnVisibilityChanged = t.setColumnVisible
|
t.hdr.OnColumnVisibilityChanged = t.setColumnVisible
|
||||||
|
t.hdr.OnColumnVisibilityMenuShown = func(pop *widget.PopUp) {
|
||||||
|
if t.OnColumnVisibilityMenuShown != nil {
|
||||||
|
t.OnColumnVisibilityMenuShown(pop)
|
||||||
|
}
|
||||||
|
}
|
||||||
playingIcon := container.NewCenter(container.NewHBox(NewHSpace(2), widget.NewIcon(theme.MediaPlayIcon())))
|
playingIcon := container.NewCenter(container.NewHBox(NewHSpace(2), widget.NewIcon(theme.MediaPlayIcon())))
|
||||||
t.list = widget.NewList(
|
t.list = widget.NewList(
|
||||||
func() int { return len(t.Tracks) },
|
func() int { return len(t.Tracks) },
|
||||||
|
|||||||
Reference in New Issue
Block a user