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.
This commit is contained in:
@@ -4,19 +4,20 @@ 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. If it contains no element, it
|
||||
// displays a black (or transprent) background.
|
||||
// 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 (child Element)
|
||||
Adopt (Element)
|
||||
|
||||
// Child returns the root element of the window.
|
||||
Child () (child Element)
|
||||
Child () Element
|
||||
|
||||
// SetTitle sets the title that appears on the window's title bar. This
|
||||
// method might have no effect with some backends.
|
||||
SetTitle (title string)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user