Documentation
¶
Overview ¶
Package platform provides low-level bindings for windows, event loops, graphics, typography, and other operating-system services.
Platform objects are thread-affine and use a single-threaded model. The caller is responsible for creating and using them on the same OS thread. Unless an API explicitly says otherwise, methods are not safe for concurrent use. EventLoop.Post and EventLoop.Quit are the only cross-thread operations.
Index ¶
- Constants
- Variables
- func DefaultName() string
- type Clipboard
- type ColorScheme
- type Cursor
- type CursorShape
- type Event
- type EventHandler
- type EventLoop
- type Image
- type InputMethod
- type InputMethodHandler
- type InputMethodKind
- type InputMethodResult
- type Platform
- type Popup
- type Settings
- type Surface
- type Window
Constants ¶
View Source
const ( ColorSchemeLight = common.ColorSchemeLight ColorSchemeDark = common.ColorSchemeDark InputMethodCommit = common.InputMethodCommit InputMethodPreedit = common.InputMethodPreedit CursorDefault = common.CursorDefault CursorText = common.CursorText CursorPointing = common.CursorPointing CursorCrosshair = common.CursorCrosshair CursorForbidden = common.CursorForbidden CursorNone = common.CursorNone )
Variables ¶
View Source
var ErrUnsupported = errors.New("unsupported platform")
Functions ¶
func DefaultName ¶
func DefaultName() string
Types ¶
type ColorScheme ¶
type ColorScheme = common.ColorScheme
type CursorShape ¶
type CursorShape = common.CursorShape
type EventHandler ¶
type EventHandler = events.EventHandler
type InputMethod ¶
type InputMethod = common.InputMethod
type InputMethodHandler ¶
type InputMethodHandler = common.InputMethodHandler
type InputMethodKind ¶
type InputMethodKind = common.InputMethodKind
type InputMethodResult ¶
type InputMethodResult = common.InputMethodResult
type Platform ¶
type Platform interface {
Destroy()
Name() string
NewImage(width, height uint) (Image, error)
// NewWindow creates a top-level window. width/height is a logical (DIP)
// preferred size; the platform may override it (WM/compositor), and the
// authoritative size always arrives via SizeEvent.
NewWindow(width, height float32, handler EventHandler) (Window, error)
// NewPopup creates a borderless popup owned by owner. width/height is its
// authoritative logical (DIP) size; use SetSize to change it later.
NewPopup(owner Window, width, height float32, handler EventHandler) (Popup, error)
NewEventLoop() (EventLoop, error)
NewTypography() (typography.Context, error)
// NewPainter creates a painter for any paint target — a Window or a Popup.
NewPainter(surface Surface, typo typography.Context) (graphics.Painter, error)
NewSettings() (Settings, error)
NewClipboard() (Clipboard, error)
// NewInputMethod creates the text-composition (IME) capability for window.
// handler receives committed/preedit text. Returns ErrUnsupported when the
// platform or window does not support input methods.
NewInputMethod(window Window, handler InputMethodHandler) (InputMethod, error)
// NewCursor creates the mouse-cursor capability for window, used to change
// the window's current cursor shape. Returns ErrUnsupported when the platform
// or window does not support cursor control.
NewCursor(window Window) (Cursor, error)
}
Platform owns low-level operating-system resources. It and every object created from it must be used on the same OS thread, except for EventLoop.Post and EventLoop.Quit.
func NewPlatform ¶
Click to show internal directories.
Click to hide internal directories.