Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend interface { NewWindow(image.Rectangle) (MainWindow, error) NewBox() Box NewTextBox() TextBox NewCanvasBox() CanvasBox NewContainerBox() ContainerBox // Stop must unblock run. Run() error Stop() // Do performs a callback function in the main thread as soon as // possible. This method must be safe to call concurrently. Do(func()) }
func Initialize ¶
Initialize instantiates a backend. The first backend (sorted by priority) that does not throw an error when initialized is used. If no backend could be instantiated, this function returns an error. This function should be called only once.
type Box ¶
type Box interface { Object Window() Window Bounds() image.Rectangle InnerBounds() image.Rectangle SetBounds(image.Rectangle) SetColor(color.Color) SetBorder(...Border) SetMinimumSize(int, int) SetPadding(Inset) SetDNDData(data.Data) SetDNDAccept(...data.Mime) SetFocused(bool) SetFocusable(bool) Focused() bool Modifiers() input.Modifiers MousePosition() image.Point OnFocusEnter(func()) event.Cookie OnFocusLeave(func()) event.Cookie OnDNDEnter(func()) event.Cookie OnDNDLeave(func()) event.Cookie OnDNDDrop(func(data.Data)) event.Cookie OnMouseEnter(func()) event.Cookie OnMouseLeave(func()) event.Cookie OnMouseMove(func()) event.Cookie OnMouseDown(func(input.Button)) event.Cookie OnMouseUp(func(input.Button)) event.Cookie OnScroll(func(deltaX, deltaY float64)) event.Cookie OnKeyDown(func(key input.Key, numberPad bool)) event.Cookie OnKeyUp(func(key input.Key, numberPad bool)) event.Cookie ContentBounds() image.Rectangle ScrollTo(image.Point) OnContentBoundsChange(func()) event.Cookie }
type CanvasBox ¶
func NewCanvasBox ¶
func NewCanvasBox() CanvasBox
type ContainerBox ¶
type ContainerBox interface { Box SetGap(Gap) Add(Object) Delete(Object) Insert(child Object, before Object) Clear() Length() int At(int) Object SetLayout(Layout) }
func NewContainerBox ¶
func NewContainerBox() ContainerBox
type Factory ¶
Factory is a function that attempts to instatiate a backend. If the instantiation process fails at any point, it must clean up all resources and return nil and an error explaining what happened.
type Inset ¶
type Inset [4]int
func I ¶ added in v0.7.0
I allows you to create an inset in a CSS-ish way:
- One argument: all sides are set to this value
- Two arguments: the top and bottom sides are set to the first value, and the left and right sides are set to the second value.
- Three arguments: the top side is set by the first value, the left and right sides are set by the second vaue, and the bottom side is set by the third value.
- Four arguments: each value corresponds to a side.
This function will panic if an argument count that isn't one of these is given.
func (Inset) Apply ¶ added in v0.7.0
Apply returns the given rectangle, shrunk on all four sides by the given inset. If a measurment of the inset is negative, that side will instead be expanded outward. If the rectangle's dimensions cannot be reduced any further, an empty rectangle near its center will be returned.
func (Inset) Horizontal ¶ added in v0.7.0
Horizontal returns the sum of SideRight and SideLeft.
type MainWindow ¶
type TextBox ¶
type TextBox interface { Box SetTextColor(color.Color) SetFace(font.Face) SetHAlign(Align) SetVAlign(Align) }
func NewTextBox ¶
func NewTextBox() TextBox
type Window ¶
type Window interface { SetRoot(Object) SetTitle(string) SetIcon(sizes []image.Image) NewMenu(image.Rectangle) (Window, error) NewModal(image.Rectangle) (Window, error) Widget() (Window, error) Copy(data.Data) Paste(callback func(data.Data, error), accept ...data.Mime) Show() Hide() Close() OnClose(func()) event.Cookie }
Directories ¶
Path | Synopsis |
---|---|
Canvas defines a standard interface for images that support drawing primitives.
|
Canvas defines a standard interface for images that support drawing primitives. |
Package data provides operations to deal with arbitrary data and MIME types.
|
Package data provides operations to deal with arbitrary data and MIME types. |
Package event provides a system for broadcasting events to multiple event handlers.
|
Package event provides a system for broadcasting events to multiple event handlers. |
Package input defines keyboard and mouse code constants.
|
Package input defines keyboard and mouse code constants. |