types

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

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

This section is empty.

Types

type FocusManager

type FocusManager interface {
	RegisterFocusButton(key string, btn *widget.Button)
	SetPendingFocus(key string)
	SetScrollWidgets(sc *widget.ScrollContainer, slider *widget.Slider)
	SaveScrollPosition()
	RestoreScrollPosition()
	// 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 manage scroll position.

type FocusRestorer

type FocusRestorer interface {
	// GetPendingFocusButton returns the button that should receive focus after rebuild
	GetPendingFocusButton() *widget.Button
	// 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(gameCRC string)
	SwitchToSettings()
	SwitchToScanProgress(rescanAll bool)
	LaunchGame(gameCRC string, resume bool)
	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)
	GetMD5ByCRC32(crc32 uint32) string // Get MD5 hash from RDB by CRC32
	GetExtensions() []string           // Get supported ROM file extensions
	ShowNotification(msg string)       // Show a brief notification message
}

ScreenCallback provides callbacks for screen navigation

Jump to

Keyboard shortcuts

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