X backend entity

This commit is contained in:
2023-04-13 02:22:54 -04:00
parent 407b957687
commit bb9c5df088
4 changed files with 187 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package tomo
import "image"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
// Entity is a handle given to elements by the backend. Different types of
// entities may be assigned to elements that support different capabilities.
@@ -25,13 +26,18 @@ type Entity interface {
// DrawBackground asks the parent element to draw its background pattern
// within the specified rectangle. This should be used for transparent
// elements like text labels.
DrawBackground (bounds image.Rectangle)
DrawBackground (destination canvas.Canvas, bounds image.Rectangle)
}
// ContainerEntity is given to elements that support the Container interface.
type ContainerEntity interface {
Entity
// InvalidateLayout marks the element's layout as invalid. At the end of
// every event, the backend will ask all invalid containers to
// recalculate their layouts.
InvalidateLayout ()
// Adopt adds an element as a child.
Adopt (child Element)