more work on artist list page
This commit is contained in:
@@ -38,26 +38,22 @@ type BrowsingPane struct {
|
||||
|
||||
app *backend.App
|
||||
|
||||
// Invoked when the home button is clicked
|
||||
OnGoHome func()
|
||||
|
||||
curPage Page
|
||||
|
||||
home *widget.Button
|
||||
forward *widget.Button
|
||||
back *widget.Button
|
||||
reload *widget.Button
|
||||
history []SavedPage
|
||||
historyIdx int
|
||||
|
||||
pageContainer *fyne.Container
|
||||
container *fyne.Container
|
||||
navBtnsContainer *fyne.Container
|
||||
pageContainer *fyne.Container
|
||||
container *fyne.Container
|
||||
}
|
||||
|
||||
func NewBrowsingPane(app *backend.App) *BrowsingPane {
|
||||
b := &BrowsingPane{app: app}
|
||||
b.ExtendBaseWidget(b)
|
||||
b.home = widget.NewButtonWithIcon("", theme.HomeIcon(), b.goHome)
|
||||
b.back = widget.NewButtonWithIcon("", theme.NavigateBackIcon(), b.GoBack)
|
||||
b.forward = widget.NewButtonWithIcon("", theme.NavigateNextIcon(), b.GoForward)
|
||||
b.reload = widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), b.Reload)
|
||||
@@ -65,8 +61,9 @@ func NewBrowsingPane(app *backend.App) *BrowsingPane {
|
||||
b.pageContainer = container.NewMax(
|
||||
canvas.NewRectangle(color.RGBA{R: 24, G: 24, B: 24, A: 255}),
|
||||
layout.NewSpacer())
|
||||
b.navBtnsContainer = container.NewHBox()
|
||||
b.container = container.NewBorder(
|
||||
container.NewHBox(b.home, b.back, b.forward, b.reload),
|
||||
container.NewHBox(b.back, b.forward, b.reload, layout.NewSpacer(), b.navBtnsContainer, layout.NewSpacer()),
|
||||
nil, nil, nil, b.pageContainer)
|
||||
return b
|
||||
}
|
||||
@@ -78,6 +75,10 @@ func (b *BrowsingPane) SetPage(p Page) {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) AddNavigationButton(iconRes fyne.Resource, action func()) {
|
||||
b.navBtnsContainer.Add(widget.NewButtonWithIcon("", iconRes, action))
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) doSetPage(p Page) bool {
|
||||
if b.curPage != nil && b.curPage.Route() == p.Route() {
|
||||
return false
|
||||
@@ -121,12 +122,6 @@ func (b *BrowsingPane) addPageToHistory(p Page, truncate bool) {
|
||||
b.historyIdx++
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) goHome() {
|
||||
if b.OnGoHome != nil {
|
||||
b.OnGoHome()
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) GoBack() {
|
||||
if b.historyIdx > 0 {
|
||||
b.addPageToHistory(b.curPage, false)
|
||||
|
||||
Reference in New Issue
Block a user