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 MinimumSize() image.Point SetBounds(image.Rectangle) SetColor(color.Color) SetBorder(...Border) SetMinimumSize(image.Point) 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 }
Box is a basic styled box.
type CanvasBox ¶
CanvasBox is a box that can be drawn to.
func NewCanvasBox ¶
func NewCanvasBox() CanvasBox
type ContainerBox ¶
type ContainerBox interface { ContentBox SetGap(image.Point) Add(Object) Delete(Object) Insert(child Object, before Object) Clear() Length() int At(int) Object SetLayout(Layout) }
ContentBox is a box that can contain child objects. It arranges them according to a layout rule.
func NewContainerBox ¶
func NewContainerBox() ContainerBox
type ContentBox ¶ added in v0.7.3
type ContentBox interface { Box SetOverflow(horizontal, vertical bool) ContentBounds() image.Rectangle ScrollTo(image.Point) OnContentBoundsChange(func()) event.Cookie }
ContentBox is an abstract box that has some kind of content. Its only purpose is to be embedded into TextBox and 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 Layout ¶
type Layout interface { MinimumSize(LayoutHints, []Box) image.Point Arrange(LayoutHints, []Box) }
Layout can be given to a ContainerBox to arrange child objects.
type LayoutHints ¶ added in v0.9.0
LayoutHints are passed to a layout to tell it how to arrange child boxes.
type MainWindow ¶
MainWindow is a top-level operating system window.
type Object ¶
type Object interface {
Box() Box
}
Object is any obscreen object. Each object must be linked to a box, even if it is that box.
type TextBox ¶
type TextBox interface { ContentBox SetText(string) SetTextColor(color.Color) SetFace(font.Face) SetHAlign(Align) SetVAlign(Align) }
TextBox is a box that contains text content.
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 }
Window is an operating system window. It can contain one object.
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. |