add context menu actions to search dialog, refactor controller
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user