util

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoldRichTextStyle = widget.RichTextStyle{TextStyle: fyne.TextStyle{Bold: true}, Inline: true}

Functions

func AddHeaderBackground added in v0.7.0

func AddHeaderBackground(obj fyne.CanvasObject) *fyne.Container

func AddHeaderBackgroundWithColorName added in v0.11.0

func AddHeaderBackgroundWithColorName(obj fyne.CanvasObject, colorName fyne.ThemeColorName) *fyne.Container

func BytesToSizeString

func BytesToSizeString(bytes int64) string

func DisplayReleaseType added in v0.9.0

func DisplayReleaseType(releaseTypes mediaprovider.ReleaseTypes) string

func FindItemByID added in v0.11.0

func FindItemByID(items []*TrackListModel, id string) (mediaprovider.MediaItem, int)

func ImageAspect

func ImageAspect(im image.Image) float32

func LocalizeSlice added in v0.13.0

func LocalizeSlice(s []string) []string

func MakeOpaque added in v0.9.1

func MakeOpaque(c color.Color) color.Color

func NewDebouncer

func NewDebouncer(dur time.Duration, callOnDone func()) func()

Debouncer returns a function that will call callOnDone when it has not been invoked since the last dur interval.

func NewRatingSubmenu

func NewRatingSubmenu(onSetRating func(int)) *fyne.MenuItem

func NewTrailingAlignLabel added in v0.10.0

func NewTrailingAlignLabel() *widget.Label

func NewTruncatingLabel added in v0.10.0

func NewTruncatingLabel() *widget.Label

func NewTruncatingRichText added in v0.10.0

func NewTruncatingRichText() *widget.RichText

func NewTruncatingTooltipLabel added in v0.13.1

func NewTruncatingTooltipLabel() *ttwidget.Label

func NewTruncatingTooltipRichText added in v0.13.1

func NewTruncatingTooltipRichText() *ttwidget.RichText

func PlaintextFromHTMLString added in v0.8.1

func PlaintextFromHTMLString(s string) string

func SaveWindowSize added in v0.13.0

func SaveWindowSize(w fyne.Window, wPtr, hPtr *int)

func SecondsToMMSS added in v0.12.0

func SecondsToMMSS(s float64) string

func SecondsToTimeString

func SecondsToTimeString(s float64) string

func SelectAllItems added in v0.11.0

func SelectAllItems(items []*TrackListModel)

func SelectItem added in v0.11.0

func SelectItem(items []*TrackListModel, idx int)

func SelectItemRange added in v0.11.0

func SelectItemRange(items []*TrackListModel, idx int)

func SelectedIndexes added in v0.13.0

func SelectedIndexes(items []*TrackListModel) []int

func SelectedItemIDs added in v0.11.0

func SelectedItemIDs(items []*TrackListModel) []string

func SelectedItems added in v0.11.0

func SelectedItems(items []*TrackListModel) []mediaprovider.MediaItem

func SelectedTracks added in v0.10.0

func SelectedTracks(items []*TrackListModel) []*mediaprovider.Track

func UnselectAllItems added in v0.11.0

func UnselectAllItems(items []*TrackListModel)

Types

type HSpace

type HSpace struct {
	widget.BaseWidget

	Width float32
}

func NewHSpace

func NewHSpace(w float32) *HSpace

func (*HSpace) CreateRenderer

func (h *HSpace) CreateRenderer() fyne.WidgetRenderer

func (*HSpace) MinSize

func (h *HSpace) MinSize() fyne.Size

type ImageFetcher added in v0.7.0

type ImageFetcher interface {
	GetCoverThumbnailFromCache(string) (image.Image, bool)
	GetCoverThumbnailAsync(string, func(image.Image, error)) context.CancelFunc
}

Image backend interface for the ThumbnailLoader impl: backend.ImageManager

type ThumbnailLoader added in v0.7.0

type ThumbnailLoader struct {
	OnBeforeLoad func()
	OnLoaded     func(image.Image)
	// contains filtered or unexported fields
}

ThumbnailLoader is a utility type that exposes a single API to load a cover thumbnail by ID. If the image is immediately available in the cache, OnLoaded will be called immediately. If it is not, OnBeforeLoad will be called first, then OnLoaded will be called async once the image is available. Any subsequent calls to Load will cancel the previous load if not yet completed.

func NewThumbnailLoader added in v0.7.0

func NewThumbnailLoader(im ImageFetcher, onLoaded func(image.Image)) ThumbnailLoader

func (*ThumbnailLoader) Load added in v0.7.0

func (i *ThumbnailLoader) Load(coverID string)

type ToolTipRichText added in v0.13.1

type ToolTipRichText struct {
	ttwidget.RichText

	OnMouseIn  func(e *desktop.MouseEvent)
	OnMouseOut func()
	OnTapped   func(e *fyne.PointEvent)
}

type TrackListModel added in v0.10.0

type TrackListModel struct {
	Item     mediaprovider.MediaItem
	Selected bool
}

func ToTrackListModels added in v0.10.0

func ToTrackListModels(trs []*mediaprovider.Track) []*TrackListModel

func (TrackListModel) Track added in v0.10.0

func (t TrackListModel) Track() *mediaprovider.Track

Returns the item as a *mediaprovider.Track, or panics if not a Track Use for tracklists that can only contain tracks (ie not PlayQueueList)

type WidgetPool added in v0.5.0

type WidgetPool struct {
	// contains filtered or unexported fields
}

A pool to share commonly-used widgets across pages to reduce creation of new widgets and memory allocations.

func NewWidgetPool added in v0.5.0

func NewWidgetPool() *WidgetPool

func (*WidgetPool) Obtain added in v0.5.0

func (w *WidgetPool) Obtain(typ WidgetType) fyne.CanvasObject

Obtain obtains a widget of the given type from the pool, if one exists. Returns nil if there is no available widget.

func (*WidgetPool) Release added in v0.5.0

func (w *WidgetPool) Release(typ WidgetType, wid fyne.CanvasObject)

Release releases a widget into the pool. The widget must not be modified by the releaser after release, since it may be Obtained for a new use at any time.

type WidgetType added in v0.5.0

type WidgetType int
const (
	WidgetTypeAlbumPageHeader WidgetType = iota
	WidgetTypeArtistPageHeader
	WidgetTypeGridView
	WidgetTypePlaylistPageHeader
	WidgetTypeTracklist
	WidgetTypeCompactTracklist
	WidgetTypeNowPlayingPage
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL