system

package
Version: v0.0.0-...-dee53b3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT, Unlicense Imports: 7 Imported by: 330

Documentation

Overview

Package system contains events usually handled at the top-level program level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint

Action is a set of window decoration actions.

const (
	// ActionMinimize minimizes a window.
	ActionMinimize Action = 1 << iota
	// ActionMaximize maximizes a window.
	ActionMaximize
	// ActionUnmaximize restores a maximized window.
	ActionUnmaximize
	// ActionFullscreen makes a window fullscreen.
	ActionFullscreen
	// ActionRaise requests that the platform bring this window to the top of all open windows.
	// Some platforms do not allow this except under certain circumstances, such as when
	// a window from the same application already has focus. If the platform does not
	// support it, this method will do nothing.
	ActionRaise
	// ActionCenter centers the window on the screen.
	// It is ignored in Fullscreen mode and on Wayland.
	ActionCenter
	// ActionClose closes a window.
	// Only applicable on macOS, Windows, X11 and Wayland.
	ActionClose
	// ActionMove moves a window directed by the user.
	ActionMove
)

func (Action) String

func (a Action) String() string

type ActionInputOp

type ActionInputOp Action

ActionAreaOp makes the current clip area available for system gestures.

Note: only ActionMove is supported.

func (ActionInputOp) Add

func (op ActionInputOp) Add(o *op.Ops)

type DestroyEvent

type DestroyEvent struct {
	// Err is nil for normal window closures. If a
	// window is prematurely closed, Err is the cause.
	Err error
}

DestroyEvent is the last event sent through a window event channel.

func (DestroyEvent) ImplementsEvent

func (DestroyEvent) ImplementsEvent()

type FrameEvent

type FrameEvent struct {
	// Now is the current animation. Use Now instead of time.Now to
	// synchronize animation and to avoid the time.Now call overhead.
	Now time.Time
	// Metric converts device independent dp and sp to device pixels.
	Metric unit.Metric
	// Size is the dimensions of the window.
	Size image.Point
	// Insets represent the space occupied by system decorations and controls.
	Insets Insets
	// Frame completes the FrameEvent by drawing the graphical operations
	// from ops into the window.
	Frame func(frame *op.Ops)
	// Queue supplies the events for event handlers.
	Queue event.Queue
}

A FrameEvent requests a new frame in the form of a list of operations that describes what to display and how to handle input.

func (FrameEvent) ImplementsEvent

func (FrameEvent) ImplementsEvent()

type Insets

type Insets struct {
	// Values are in pixels.
	Top, Bottom, Left, Right unit.Dp
}

Insets is the space taken up by system decoration such as translucent system bars and software keyboards.

type Locale

type Locale struct {
	// Language is the BCP-47 tag for the primary language of the system.
	Language string
	// Direction indicates the primary direction of text and layout
	// flow for the system.
	Direction TextDirection
}

Locale provides language information for the current system.

type Stage

type Stage uint8

Stage of a Window.

const (
	// StagePaused is the stage for windows that have no on-screen representation.
	// Paused windows don't receive FrameEvent.
	StagePaused Stage = iota
	// StageInactive is the stage for windows that are visible, but not active.
	// Inactive windows receive FrameEvent.
	StageInactive
	// StageRunning is for active and visible Windows.
	// Running windows receive FrameEvent.
	StageRunning
)

func (Stage) String

func (l Stage) String() string

String implements fmt.Stringer.

type StageEvent

type StageEvent struct {
	Stage Stage
}

A StageEvent is generated whenever the stage of a Window changes.

func (StageEvent) ImplementsEvent

func (StageEvent) ImplementsEvent()

type TextAxis

type TextAxis byte

TextAxis defines the layout axis of text.

const (
	// Horizontal indicates text that flows along the X axis.
	Horizontal TextAxis = iota
	// Vertical indicates text that flows along the Y axis.
	Vertical
)

type TextDirection

type TextDirection byte

TextDirection defines a direction for text flow.

const (
	// LTR is left-to-right text.
	LTR TextDirection = TextDirection(Horizontal<<axisShift) | TextDirection(FromOrigin<<progressionShift)
	// RTL is right-to-left text.
	RTL TextDirection = TextDirection(Horizontal<<axisShift) | TextDirection(TowardOrigin<<progressionShift)
)

func (TextDirection) Axis

func (d TextDirection) Axis() TextAxis

Axis returns the axis of the text layout.

func (TextDirection) Progression

func (d TextDirection) Progression() TextProgression

Progression returns the way that the text flows relative to the origin.

func (TextDirection) String

func (d TextDirection) String() string

type TextProgression

type TextProgression byte

TextProgression indicates how text flows along an axis relative to the origin. For these purposes, the origin is defined as the upper-left corner of coordinate space.

const (
	// FromOrigin indicates text that flows along its axis away from the
	// origin (upper left corner).
	FromOrigin TextProgression = iota
	// TowardOrigin indicates text that flows along its axis towards the
	// origin (upper left corner).
	TowardOrigin
)

Jump to

Keyboard shortcuts

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