Documentation
¶
Overview ¶
Package types provides shared interfaces used across UI packages. This package exists to avoid import cycles between screens and sub-packages.
Index ¶
Constants ¶
const ( DirNone = 0 DirUp = 1 DirDown = 2 DirLeft = 3 DirRight = 4 )
Direction constants for navigation
const ( )
Navigation zone types
const ( )
Navigation index constants
Variables ¶
This section is empty.
Functions ¶
func ChainZones ¶ added in v0.7.0
func ChainZones(focus FocusManager, zones []string)
ChainZones links zones top to bottom: Down from each enters the first target of the next, and Up from each enters the last target of the one above.
Types ¶
type FilePickerRequest ¶ added in v0.7.0
type FilePickerRequest struct {
Title string
Mode filebrowser.Mode
OnSelect func(path string)
}
FilePickerRequest describes a file or folder pick. OnSelect runs on the UI thread with the chosen absolute path; it is not called on cancel.
type FocusManager ¶
type FocusManager interface {
RegisterFocusButton(key string, btn *widget.Button)
RegisterFocusWidget(key string, f widget.Focuser)
SetPendingFocus(key string)
SetScrollContainer(sc *widgets.ScrollView)
SaveScrollPosition()
RestoreScrollPosition()
// RegisterScrollBar registers a scroll view's slider as a navigation
// target that Up and Down scroll
RegisterScrollBar(key string, view *widgets.ScrollView, bar *widget.Slider)
// Zone-based navigation
}
FocusManager interface for focus restoration and scroll management. Implemented by BaseScreen, used by sub-sections that need to register focusable buttons and text fields and manage scroll position.
type FocusRestorer ¶
type FocusRestorer interface {
// GetPendingFocus returns the target that should receive focus after rebuild
GetPendingFocus() widget.Focuser
// ClearPendingFocus clears the pending focus state
ClearPendingFocus()
}
FocusRestorer is implemented by screens that support focus restoration after rebuilds
type ScreenCallback ¶
type ScreenCallback interface {
SwitchToLibrary()
SwitchToDetail(gameID string)
SwitchToSettings()
// SwitchToSettingsSection opens settings with the section identified
// by focusKey selected.
SwitchToSettingsSection(focusKey string)
SwitchToScanProgress()
// SwitchToCleanProgress shows the progress screen and runs Clean
// Library, which removes the library's missing discs and games.
SwitchToCleanProgress()
// OpenFilePicker shows the full-screen file/folder picker. The current
// screen is restored when the picker closes.
OpenFilePicker(req FilePickerRequest)
// LaunchGame starts a game. discIndex selects which disc of a
// multi-disc game to launch; -1 uses the entry's remembered
// SelectedDisc. Ignored for single-disc and cartridge games.
LaunchGame(gameID string, resume bool, discIndex int)
Exit()
GetWindowWidth() int // For responsive layout calculations
RequestRebuild() // Request UI rebuild after state changes
GetPlaceholderImageData() []byte // Get raw placeholder image data (loading indicator)
GetMissingArtImageData() []byte // Get raw missing-art image data (no artwork found)
GetExtensions() []string // Content file extensions (disc formats for disc cores, else ROM extensions)
ShowNotification(msg string) // Show a brief notification message
// GameMetadata returns the core's metadata for a game ID and true, or
// false when the core has none for it.
GameMetadata(gameID string) (content.GameMetadata, bool)
// GameTitle returns the title to show for a library entry: its
// metadata title, else a name from its file.
GameTitle(game *storage.GameEntry) string
// GameInfo returns the keys a library entry is sorted and searched
// by: its title and supported region codes.
GameInfo(game *storage.GameEntry) storage.GameKeys
}
ScreenCallback provides callbacks for screen navigation
type UpdateStatus ¶ added in v0.7.0
type UpdateStatus struct {
Checking bool // A check is running
Available string // Version of an available update, "" when none
Failed bool // The last check this session failed
LastCheck int64 // Unix time of the last check, 0 = never
}
UpdateStatus is the update state shown in Settings > About.
type Updates ¶ added in v0.7.0
type Updates interface {
AppName() string
Status() UpdateStatus
// BarVersion returns the version the update bar offers, or "" when the
// bar is not shown.
BarVersion() string
CheckNow()
IgnoreVersion()
Dismiss()
// Download opens the available version's release page and ignores
// that version for the update bar.
Download()
}
Updates is the update system as seen by the library update bar and Settings > About. Screens are given nil when the update system is off.