types

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: GPL-3.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	DirNone  = 0
	DirUp    = 1
	DirDown  = 2
	DirLeft  = 3
	DirRight = 4
)

Direction constants for navigation

View Source
const (
	NavZoneHorizontal = "horizontal" // Left/Right navigates, Up/Down exits zone
	NavZoneVertical   = "vertical"   // Up/Down navigates, Left/Right exits zone
	NavZoneGrid       = "grid"       // 2D grid navigation
)

Navigation zone types

View Source
const (
	NavIndexPreserve = -1 // Try to preserve column/row position
	NavIndexFirst    = -2 // Go to first item
	NavIndexLast     = -3 // Go to last item
)

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
	RegisterNavZone(name string, zoneType string, keys []string, columns int)
	SetNavTransition(fromZone string, direction int, toZone string, toIndex int)
}

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.

Jump to

Keyboard shortcuts

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