unexport SearchEntry
This commit is contained in:
@@ -54,5 +54,5 @@ func (q *QuickSearch) MinSize() fyne.Size {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (q *QuickSearch) GetSearchEntry() fyne.Focusable {
|
func (q *QuickSearch) GetSearchEntry() fyne.Focusable {
|
||||||
return q.SearchDialog.SearchEntry
|
return q.SearchDialog.GetSearchEntry()
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-17
@@ -24,23 +24,21 @@ import (
|
|||||||
type SearchDialog struct {
|
type SearchDialog struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
SearchEntry fyne.Focusable // exported so it can be focused by the Controller
|
|
||||||
|
|
||||||
imgSource util.ImageFetcher
|
|
||||||
|
|
||||||
resultsMutex sync.RWMutex
|
|
||||||
searchResults []*mediaprovider.SearchResult
|
|
||||||
loadingDots *widgets.LoadingDots
|
|
||||||
list *widget.List
|
|
||||||
selectedIndex int
|
|
||||||
|
|
||||||
placeholderTitle string
|
|
||||||
content *fyne.Container
|
|
||||||
|
|
||||||
OnDismiss func()
|
OnDismiss func()
|
||||||
OnNavigateTo func(mediaprovider.ContentType, string, string)
|
OnNavigateTo func(mediaprovider.ContentType, string, string)
|
||||||
OnSearched func(string) []*mediaprovider.SearchResult
|
OnSearched func(string) []*mediaprovider.SearchResult
|
||||||
OnInit func() ([]*mediaprovider.SearchResult, *widget.Check)
|
OnInit func() ([]*mediaprovider.SearchResult, *widget.Check)
|
||||||
|
|
||||||
|
imgSource util.ImageFetcher
|
||||||
|
resultsMutex sync.RWMutex
|
||||||
|
searchResults []*mediaprovider.SearchResult
|
||||||
|
selectedIndex int
|
||||||
|
|
||||||
|
searchEntry *searchEntry
|
||||||
|
loadingDots *widgets.LoadingDots
|
||||||
|
list *widget.List
|
||||||
|
placeholderTitle string
|
||||||
|
content *fyne.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSearchDialog(im util.ImageFetcher, placeholderTitle string, onSearched func(string) []*mediaprovider.SearchResult, onInit func() ([]*mediaprovider.SearchResult, *widget.Check)) *SearchDialog {
|
func NewSearchDialog(im util.ImageFetcher, placeholderTitle string, onSearched func(string) []*mediaprovider.SearchResult, onInit func() ([]*mediaprovider.SearchResult, *widget.Check)) *SearchDialog {
|
||||||
@@ -61,7 +59,7 @@ func NewSearchDialog(im util.ImageFetcher, placeholderTitle string, onSearched f
|
|||||||
se.OnTypedDown = sd.moveSelectionDown
|
se.OnTypedDown = sd.moveSelectionDown
|
||||||
se.OnTypedUp = sd.moveSelectionUp
|
se.OnTypedUp = sd.moveSelectionUp
|
||||||
se.OnTypedEscape = sd.onDismiss
|
se.OnTypedEscape = sd.onDismiss
|
||||||
sd.SearchEntry = se
|
sd.searchEntry = se
|
||||||
sd.list = widget.NewList(
|
sd.list = widget.NewList(
|
||||||
func() int {
|
func() int {
|
||||||
sd.resultsMutex.RLock()
|
sd.resultsMutex.RLock()
|
||||||
@@ -84,6 +82,10 @@ func NewSearchDialog(im util.ImageFetcher, placeholderTitle string, onSearched f
|
|||||||
return sd
|
return sd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sd *SearchDialog) GetSearchEntry() fyne.Focusable {
|
||||||
|
return sd.searchEntry
|
||||||
|
}
|
||||||
|
|
||||||
func (sd *SearchDialog) Show() {
|
func (sd *SearchDialog) Show() {
|
||||||
sd.onInit()
|
sd.onInit()
|
||||||
sd.BaseWidget.Show()
|
sd.BaseWidget.Show()
|
||||||
@@ -143,11 +145,10 @@ func (sd *SearchDialog) SetContent(checkBox *widget.Check) {
|
|||||||
dismissBtn := widget.NewButton("Close", sd.onDismiss)
|
dismissBtn := widget.NewButton("Close", sd.onDismiss)
|
||||||
title := widget.NewRichText(&widget.TextSegment{Text: sd.placeholderTitle, Style: util.BoldRichTextStyle})
|
title := widget.NewRichText(&widget.TextSegment{Text: sd.placeholderTitle, Style: util.BoldRichTextStyle})
|
||||||
title.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignCenter
|
title.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignCenter
|
||||||
se := sd.SearchEntry.(fyne.CanvasObject)
|
|
||||||
if checkBox != nil {
|
if checkBox != nil {
|
||||||
sd.content = container.NewStack(
|
sd.content = container.NewStack(
|
||||||
container.NewBorder(
|
container.NewBorder(
|
||||||
container.NewVBox(title, se),
|
container.NewVBox(title, sd.searchEntry),
|
||||||
container.NewVBox(widget.NewSeparator(), container.NewHBox(checkBox, layout.NewSpacer(), dismissBtn)),
|
container.NewVBox(widget.NewSeparator(), container.NewHBox(checkBox, layout.NewSpacer(), dismissBtn)),
|
||||||
nil, nil, sd.list),
|
nil, nil, sd.list),
|
||||||
container.NewCenter(sd.loadingDots),
|
container.NewCenter(sd.loadingDots),
|
||||||
@@ -155,7 +156,7 @@ func (sd *SearchDialog) SetContent(checkBox *widget.Check) {
|
|||||||
} else {
|
} else {
|
||||||
sd.content = container.NewStack(
|
sd.content = container.NewStack(
|
||||||
container.NewBorder(
|
container.NewBorder(
|
||||||
container.NewVBox(title, se),
|
container.NewVBox(title, sd.searchEntry),
|
||||||
container.NewVBox(widget.NewSeparator(), container.NewHBox(layout.NewSpacer(), dismissBtn)),
|
container.NewVBox(widget.NewSeparator(), container.NewHBox(layout.NewSpacer(), dismissBtn)),
|
||||||
nil, nil, sd.list),
|
nil, nil, sd.list),
|
||||||
container.NewCenter(sd.loadingDots),
|
container.NewCenter(sd.loadingDots),
|
||||||
|
|||||||
@@ -111,5 +111,5 @@ func (sp *SelectPlaylist) MinSize() fyne.Size {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sp *SelectPlaylist) GetSearchEntry() fyne.Focusable {
|
func (sp *SelectPlaylist) GetSearchEntry() fyne.Focusable {
|
||||||
return sp.SearchDialog.SearchEntry
|
return sp.SearchDialog.GetSearchEntry()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user