Elements are no longer images

This commit is contained in:
2023-02-13 01:49:33 -05:00
parent 7f0462d588
commit 8ac5108211
18 changed files with 117 additions and 112 deletions
+9 -10
View File
@@ -8,16 +8,9 @@ import "git.tebibyte.media/sashakoshka/tomo/config"
// Element represents a basic on-screen object.
type Element interface {
// Element must implement the Canvas interface. Elements should start
// out with a completely blank buffer, and only allocate memory and draw
// on it for the first time when sent an EventResize event.
canvas.Canvas
// MinimumSize specifies the minimum amount of pixels this element's
// width and height may be set to. If the element is given a resize
// event with dimensions smaller than this, it will use its minimum
// instead of the offending dimension(s).
MinimumSize () (width, height int)
// Bounds reports the element's bounding box. This must reflect the
// bounding box of the last canvas given to the element by DrawTo.
Bounds () (bounds image.Rectangle)
// DrawTo sets this element's canvas. This should only be called by the
// parent element. This is typically a region of the parent element's
@@ -28,6 +21,12 @@ type Element interface {
// drawn on and should be pushed to the screen.
OnDamage (callback func (region canvas.Canvas))
// MinimumSize specifies the minimum amount of pixels this element's
// width and height may be set to. If the element is given a resize
// event with dimensions smaller than this, it will use its minimum
// instead of the offending dimension(s).
MinimumSize () (width, height int)
// OnMinimumSizeChange sets a function to be called when the element's
// minimum size is changed.
OnMinimumSizeChange (callback func ())