macoslite

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package macoslite is a minimal macOS-native window host for small utility windows (settings, updaters, prompts). It talks to AppKit, CoreGraphics and CoreText directly through purego and does not load the Tango App, WebView, ui.Runner, layout, accessibility or GPU renderer, so an idle window costs far less memory than a full Tango surface.

Experimental: the API may change incompatibly between minor releases.

It is independent of uihost.Open and does not replace it. On platforms other than macOS, New returns ErrUnsupported. See docs/specs/macos-native-lite-design.md.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupported is returned by New on platforms other than macOS.
	ErrUnsupported = errors.New("macoslite: unsupported platform")
	// ErrInvalidOptions wraps option validation failures.
	ErrInvalidOptions = errors.New("macoslite: invalid options")
	// ErrNilView is returned when New is given a nil View.
	ErrNilView = errors.New("macoslite: nil view")
)

Functions

This section is empty.

Types

type App

type App struct{}

App is unavailable on this platform; New always fails.

func New

func New(o Options, v View) (*App, error)

New validates its arguments and returns ErrUnsupported.

func (*App) Invalidate

func (*App) Invalidate()

func (*App) Run

func (*App) Run() error

func (*App) Stop

func (*App) Stop()

func (*App) TrimCaches

func (*App) TrimCaches()

type Canvas

type Canvas struct{}

Canvas is unavailable on this platform.

func (*Canvas) Fill

func (*Canvas) Fill(Rect, Color)

func (*Canvas) RoundRect

func (*Canvas) RoundRect(Rect, float64, Color)

func (*Canvas) Text

func (*Canvas) Text(string, Point, float64, Color)

type Color

type Color struct{ R, G, B, A uint8 }

Color is a non-premultiplied 8-bit RGBA color.

type Frame

type Frame struct {
	Width, Height, Scale float64
}

Frame describes the frame being drawn, in points; Scale is the backing scale factor (2 on Retina).

type KeyEvent

type KeyEvent struct {
	Key  string
	Code uint16
	Down bool
}

KeyEvent is a key press or release. Key is "Escape", "Enter", "Tab", "Backspace" or the typed characters; Code is the hardware key code.

type MouseEvent

type MouseEvent struct {
	Kind   MouseKind
	Pos    Point
	Button int
}

MouseEvent is a pointer event in view coordinates.

type MouseKind

type MouseKind int

MouseKind classifies a MouseEvent.

const (
	MouseDown MouseKind = iota
	MouseUp
	MouseMove
)

type Options

type Options struct {
	Name, Title   string
	Width, Height float64 // content size in points; both must be > 0
}

Options configures the single window of an App.

type Point

type Point struct{ X, Y float64 }

Point is a position in points, origin top-left.

type Rect

type Rect struct{ X, Y, W, H float64 }

Rect is an axis-aligned rectangle in points, origin top-left.

func (Rect) Contains

func (r Rect) Contains(p Point) bool

Contains reports whether p lies in r; the right and bottom edges are excluded.

type View

type View interface {
	Draw(*Frame, *Canvas)
	Mouse(MouseEvent)
	Key(KeyEvent)
	Close()
}

View receives drawing and input callbacks on the main thread.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL