refactor: extract out TracklistRow interface and base impl

This commit is contained in:
Drew Weymouth
2024-05-29 16:56:37 -07:00
parent 3fb3922bc9
commit 9928861db9
3 changed files with 242 additions and 193 deletions
+5
View File
@@ -24,6 +24,7 @@ type FocusList struct {
type FocusListRow interface {
fyne.Focusable
ItemID() widget.ListItemID
SetItemID(widget.ListItemID)
}
func NewFocusList(len func() int, create func() fyne.CanvasObject, update func(widget.GridWrapItemID, fyne.CanvasObject)) *FocusList {
@@ -105,6 +106,10 @@ func (l *FocusListRowBase) ItemID() widget.ListItemID {
return l.ListItemID
}
func (l *FocusListRowBase) SetItemID(id widget.ListItemID) {
l.ListItemID = id
}
func (l *FocusListRowBase) EnsureUnfocused() {
if l.Focused {
fyne.CurrentApp().Driver().CanvasForObject(l).Unfocus()