add context menu actions to search dialog, refactor controller

This commit is contained in:
Drew Weymouth
2025-03-29 13:25:56 -07:00
parent 9ddb5e6e69
commit 31c23490d1
9 changed files with 693 additions and 423 deletions
+10 -3
View File
@@ -30,9 +30,10 @@ type SearchDialog struct {
// of the dismiss buttons
ActionItem fyne.CanvasObject
OnDismiss func()
OnNavigateTo func(mediaprovider.ContentType, string)
OnSearched func(string) []*mediaprovider.SearchResult
OnDismiss func()
OnNavigateTo func(mediaprovider.ContentType, string)
OnShowContextMenu func(itemIdx int, pos fyne.Position)
OnSearched func(string) []*mediaprovider.SearchResult
imgSource util.ImageFetcher
resultsMutex sync.RWMutex
@@ -326,6 +327,12 @@ func (q *searchResult) Tapped(_ *fyne.PointEvent) {
q.parent.onSelected(q.index)
}
func (q *searchResult) TappedSecondary(e *fyne.PointEvent) {
if q.parent.OnShowContextMenu != nil {
q.parent.OnShowContextMenu(q.index, e.AbsolutePosition)
}
}
func (q *searchResult) CreateRenderer() fyne.WidgetRenderer {
if q.content == nil {
q.content = container.NewBorder(nil, nil, container.NewCenter(q.image), nil,