68 lines
1.1 KiB
Go
68 lines
1.1 KiB
Go
package app
|
|
|
|
import (
|
|
"image"
|
|
|
|
"github.com/BeatGlow/beatglow/player"
|
|
"github.com/BeatGlow/display"
|
|
)
|
|
|
|
type Layout interface {
|
|
String() string
|
|
|
|
// Widgets used by this screen.
|
|
Widgets() []Widget
|
|
}
|
|
|
|
type Context interface {
|
|
// Display is the display driver.
|
|
Display() display.Display
|
|
|
|
// Player is the music player.
|
|
Player() player.Player
|
|
|
|
// Track is the current track playing.
|
|
Track() *player.Track
|
|
}
|
|
|
|
type Widget interface {
|
|
String() string
|
|
|
|
// Bounds is the bounding box.
|
|
Bounds() image.Rectangle
|
|
|
|
// Move the drawable to a new position on the screen.
|
|
Move(image.Point) Widget
|
|
|
|
// Resize changes the widget's size.
|
|
Resize(image.Point) Widget
|
|
|
|
// Hide the drawable.
|
|
Hide(Context) Widget
|
|
|
|
// Show the drawable.
|
|
Show(Context) Widget
|
|
|
|
// IsVisible checks if the drawable is visible.
|
|
IsVisible() bool
|
|
|
|
Refresh(Context) Widget
|
|
}
|
|
|
|
type RotaryInputHandler interface {
|
|
HandleRotary(delta int)
|
|
}
|
|
|
|
type ButtonInputHandler interface {
|
|
HandleButtonPress()
|
|
HandleButtonLongPress()
|
|
}
|
|
|
|
type StatusChangeHandler interface {
|
|
StatusChanged(*player.Status)
|
|
}
|
|
|
|
type TrackChangeHandler interface {
|
|
TrackChanged(*player.Track)
|
|
}
|