Add ability to create an undecorated window

This commit is contained in:
Sasha Koshka 2023-09-05 13:21:59 -04:00
parent bebd58dac1
commit 89f7bf47ce
2 changed files with 16 additions and 1 deletions

View File

@ -11,12 +11,19 @@ import "git.tebibyte.media/tomo/tomo/canvas"
type Backend interface { type Backend interface {
// These methods create new objects. The backend must reject any object // These methods create new objects. The backend must reject any object
// that was not made by it. // that was not made by it.
NewWindow (image.Rectangle) (MainWindow, error)
NewBox () Box NewBox () Box
NewTextBox () TextBox NewTextBox () TextBox
NewCanvasBox () CanvasBox NewCanvasBox () CanvasBox
NewContainerBox () ContainerBox NewContainerBox () ContainerBox
// NewWindow creates a normal MainWindow and returns it.
NewWindow (image.Rectangle) (MainWindow, error)
// NewPlainWindow creates an undecorated window that does not appear in
// window lists and returns it. This is intended for making things like
// panels, docks, etc.
NewPlainWindow (image.Rectangle) (MainWindow, error)
// NewTexture creates a new texture from an image. The backend must // NewTexture creates a new texture from an image. The backend must
// reject any texture that was not made by it. // reject any texture that was not made by it.
NewTexture (image.Image) canvas.TextureCloser NewTexture (image.Image) canvas.TextureCloser

View File

@ -57,6 +57,14 @@ func NewWindow (bounds image.Rectangle) (MainWindow, error) {
return backend.NewWindow(bounds) return backend.NewWindow(bounds)
} }
// NewPlainWindow is like NewWindow, but it creates an undecorated window that
// does not appear in window lists. It is intended for creating things like
// docks, panels, etc.
func NewPlainWindow (bounds image.Rectangle) (MainWindow, error) {
assertBackend()
return backend.NewPlainWindow(bounds)
}
// NewBox creates and returns a basic Box. // NewBox creates and returns a basic Box.
func NewBox () Box { func NewBox () Box {
assertBackend() assertBackend()