add remove from playlist support

This commit is contained in:
Drew Weymouth
2023-02-10 17:17:42 -08:00
parent 12cc315e12
commit dca82b8fee
2 changed files with 18 additions and 0 deletions
+10
View File
@@ -112,6 +112,8 @@ type Tracklist struct {
Tracks []*subsonic.Child
AutoNumber bool
// must be set before the context menu is shown for the first time
AuxiliaryMenuItems []*fyne.MenuItem
// user action callbacks
OnPlayTrackAt func(int)
@@ -219,6 +221,10 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) {
}
}),
)
if len(t.AuxiliaryMenuItems) > 0 {
t.ctxMenu.Items = append(t.ctxMenu.Items, fyne.NewMenuItemSeparator())
t.ctxMenu.Items = append(t.ctxMenu.Items, t.AuxiliaryMenuItems...)
}
}
widget.ShowPopUpMenuAtPosition(t.ctxMenu, fyne.CurrentApp().Driver().CanvasForObject(t), e.AbsolutePosition)
}
@@ -240,3 +246,7 @@ func (t *Tracklist) selectedTrackIDs() []string {
}
return tracks
}
func (t *Tracklist) SelectedTrackIndexes() []int {
return t.selectionMgr.GetSelection()
}