refactor: extract out TracklistRow interface and base impl
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user