cursor

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package cursor defines the oswin cursor interface and standard system cursors that are supported across platforms

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cursor

type Cursor interface {

	// Current returns the current cursor as an enum, which is a
	// [goki.dev/cursors.Cursor]
	// by default, but could be something else if you are extending
	// the default cursor set.
	Current() enums.Enum

	// Set sets the active cursor to the given cursor as an enum, which is typically
	// a [cursors.Cursor], unless you are extending the default cursor set, in
	// which case it should be a type you defined. The string version of the
	// enum value must correspond to a filename of the form "name.svg" in
	// [goki.dev/cursors.Cursors]; this will be satisfied automatically by all
	// [cursor.Cursor] values.
	Set(cursor enums.Enum) error

	// IsVisible returns whether cursor is currently visible (according to [Cursor.Hide] and [Cursor.Show] actions)
	IsVisible() bool

	// Hide hides the cursor if it is not already hidden.
	Hide()

	// Show shows the cursor after a hide if it is hidden.
	Show()

	// SetSize sets the size that cursors are rendered at.
	SetSize(size int)
}

Cursor manages the mouse cursor / pointer appearance. Currently only a fixed set of standard cursors are supported, but in the future it will be possible to set the cursor from an image / svg.

type CursorBase

type CursorBase struct {
	// Cur is the current cursor, which is maintained by the standard methods.
	Cur enums.Enum

	// Vis is whether the cursor is visible; be sure to initialize to true!
	Vis bool

	// Size is the size that cursors are rendered at
	Size int
}

CursorBase provides the common infrastructure for the Cursor interface, to be extended on desktop platforms. It can also be used as an empty implementation of the Cursor interface on mobile platforms, as they do not have cursors.

func (*CursorBase) Current

func (c *CursorBase) Current() enums.Enum

func (*CursorBase) Hide

func (c *CursorBase) Hide()

func (*CursorBase) IsVisible

func (c *CursorBase) IsVisible() bool

func (*CursorBase) Set

func (c *CursorBase) Set(cursor enums.Enum) error

func (*CursorBase) SetSize

func (c *CursorBase) SetSize(size int)

func (*CursorBase) Show

func (c *CursorBase) Show()

Jump to

Keyboard shortcuts

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