This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
tomo-old/elements/window.go
Sasha Koshka b08cbea320 Overhauled the element interfaces
Instead of the previous parenting model where parents would set
child callbacks during adoption by probing for callback setters,
child elements will instead probe their parents for notify methods
listed in the standard parent interfaces. This means that an
element cannot be half-parented to something, nor can it be
parented to two things at once. Parent elements may themselves
fulfill these interfaces, or they can pass a hook that fulfills
them to the child.
2023-03-14 17:08:39 -04:00

41 lines
1.2 KiB
Go

package elements
import "image"
// Window represents a top-level container generated by the currently running
// backend. It can contain a single element. It is hidden by default, and must
// be explicitly shown with the Show() method.
type Window interface {
Parent
// Adopt sets the root element of the window. There can only be one of
// these at one time.
Adopt (Element)
// Child returns the root element of the window.
Child () Element
// SetTitle sets the title that appears on the window's title bar. This
// method might have no effect with some backends.
SetTitle (string)
// SetIcon taks in a list different sizes of the same icon and selects
// the best one to display on the window title bar, dock, or whatever is
// applicable for the given backend. This method might have no effect
// for some backends.
SetIcon (sizes []image.Image)
// Show shows the window. The window starts off hidden, so this must be
// called after initial setup to make sure it is visible.
Show ()
// Hide hides the window.
Hide ()
// Close closes the window.
Close ()
// OnClose specifies a function to be called when the window is closed.
OnClose (func ())
}