types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: GPL-3.0 Imports: 2 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 for missing artwork
	GetRDB() *rdb.RDB                // Get RDB for metadata lookups
	GetExtensions() []string         // Get supported ROM file extensions
}

ScreenCallback provides callbacks for screen navigation

Jump to

Keyboard shortcuts

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