Added Themeable and Configurable element interfaces

This commit is contained in:
Sasha Koshka 2023-02-03 01:14:03 -05:00
parent 83b8040520
commit 8ccaa0faba

View File

@ -2,7 +2,9 @@ package elements
import "image"
import "git.tebibyte.media/sashakoshka/tomo/input"
import "git.tebibyte.media/sashakoshka/tomo/theme"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/config"
// Element represents a basic on-screen object.
type Element interface {
@ -157,3 +159,19 @@ type Scrollable interface {
// ScrollContentBounds, ScrollViewportBounds, or ScrollAxes are changed.
OnScrollBoundsChange (callback func ())
}
// Themeable represents an element that can modify its appearance to fit within
// a theme.
type Themeable interface {
// SetTheme sets the element's theme to something fulfilling the
// theme.Theme interface.
SetTheme (theme.Theme)
}
// Configurable represents an element that can modify its behavior to fit within
// a set of configuration parameters.
type Configurable interface {
// SetConfig sets the element's configuration to something fulfilling
// the config.Config interface.
SetConfig (config.Config)
}