cursors

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: BSD-3-Clause Imports: 3 Imported by: 3

README

cursors

Cursors provides Go constant names for cursors as SVG files. These cursors are sourced from daviddarnes/mac-cursors, which are from macOS and are licensed under the Apple User Agreement.

Documentation

Overview

Package cursors provides Go constant names for cursors as SVG files.

Index

Constants

This section is empty.

Variables

View Source
var Cursors embed.FS

Cursors contains all of the default embedded svg cursors

View Source
var Hotspots = map[enums.Enum]image.Point{
	Arrow:               image.Pt(88, 80),
	ContextMenu:         image.Pt(72, 80),
	Help:                image.Pt(128, 128),
	Pointer:             image.Pt(104, 76),
	Progress:            image.Pt(64, 24),
	Wait:                image.Pt(132, 127),
	Cell:                image.Pt(125, 128),
	Crosshair:           image.Pt(128, 128),
	Text:                image.Pt(128, 128),
	VerticalText:        image.Pt(128, 124),
	Alias:               image.Pt(156, 80),
	Copy:                image.Pt(64, 24),
	Move:                image.Pt(128, 128),
	NotAllowed:          image.Pt(64, 24),
	Grab:                image.Pt(124, 124),
	Grabbing:            image.Pt(124, 124),
	ResizeCol:           image.Pt(128, 128),
	ResizeRow:           image.Pt(128, 128),
	ResizeUp:            image.Pt(128, 128),
	ResizeRight:         image.Pt(128, 128),
	ResizeDown:          image.Pt(128, 128),
	ResizeLeft:          image.Pt(128, 128),
	ResizeN:             image.Pt(128, 128),
	ResizeE:             image.Pt(128, 128),
	ResizeS:             image.Pt(128, 128),
	ResizeW:             image.Pt(128, 128),
	ResizeNE:            image.Pt(128, 128),
	ResizeNW:            image.Pt(128, 128),
	ResizeSE:            image.Pt(128, 128),
	ResizeSW:            image.Pt(128, 128),
	ResizeEW:            image.Pt(128, 128),
	ResizeNS:            image.Pt(128, 128),
	ResizeNESW:          image.Pt(128, 128),
	ResizeNWSE:          image.Pt(128, 128),
	ZoomIn:              image.Pt(128, 128),
	ZoomOut:             image.Pt(128, 128),
	ScreenshotSelection: image.Pt(128, 128),
	ScreenshotWindow:    image.Pt(128, 128),
	Poof:                image.Pt(64, 24),
}

Hotspots contains the cursor hotspot points for every cursor. It is initialized to contain the hotspots for all of the default cursors, but it should be extended by anyone defining custom cursors. Each hotspot is expressed as a point relative to the top-left corner of the cursor, on a scale of 0-256, which is scaled to the size of the cursor later on.

Functions

This section is empty.

Types

type Cursor

type Cursor int32 //enums:enum -transform kebab

Cursor represents a cursor

const (
	// None indicates no preference for a cursor; will typically be inherited
	None Cursor = iota
	// Arrow is a standard arrow cursor, which is the default window cursor
	Arrow
	// ContextMenu indicates that a context menu is available
	ContextMenu
	// Help indicates that help information is available
	Help
	// Pointer is a pointing hand that indicates a link or an interactive element
	Pointer
	// Progress indicates that the app is busy in the background, but can still be
	// interacted with (use [Wait] to indicate that it can't be interacted with)
	Progress
	// Wait indicates that the app is busy and can not be interacted with
	// (use [Progress] to indicate that it can be interacted with)
	Wait
	// Cell indicates a table cell, especially one that can be selected
	Cell
	// Crosshair is a cross cursor that typically indicates precision selection, such as in an image
	Crosshair
	// Text is an I-Beam that indicates text that can be selected
	Text
	// VerticalText is a sideways I-Beam that indicates vertical text that can be selected
	VerticalText
	// Alias indicates that a shortcut or alias will be created
	Alias
	// Copy indicates that a copy of something will be created
	Copy
	// Move indicates that something is being moved
	Move
	// NotAllowed indicates that something can not be done
	NotAllowed
	// Grab indicates that something can be grabbed
	Grab
	// Grabbing indicates that something is actively being grabbed
	Grabbing
	// ResizeCol indicates that something can be resized in the horizontal direction
	ResizeCol
	// ResizeRow indicates that something can be resized in the vertical direction
	ResizeRow
	// ResizeUp indicates that something can be resized in the upper direction
	ResizeUp
	// ResizeRight indicates that something can be resized in the right direction
	ResizeRight
	// ResizeDown indicates that something can be resized in the downward direction
	ResizeDown
	// ResizeLeft indicates that something can be resized in the left direction
	ResizeLeft
	// ResizeN indicates that something can be resized in the upper direction
	ResizeN
	// ResizeE indicates that something can be resized in the right direction
	ResizeE
	// ResizeS indicates that something can be resized in the downward direction
	ResizeS
	// ResizeW indicates that something can be resized in the left direction
	ResizeW
	// ResizeNE indicates that something can be resized in the upper-right direction
	ResizeNE
	// ResizeNW indicates that something can be resized in the upper-left direction
	ResizeNW
	// ResizeSE indicates that something can be resized in the lower-right direction
	ResizeSE
	// ResizeSW indicates that something can be resized in the lower-left direction
	ResizeSW
	// ResizeEW indicates that something can be resized bidirectionally in the right-left direction
	ResizeEW
	// ResizeNS indicates that something can be resized bidirectionally in the top-bottom direction
	ResizeNS
	// ResizeNESW indicates that something can be resized bidirectionally in the top-right to bottom-left direction
	ResizeNESW
	// ResizeNWSE indicates that something can be resized bidirectionally in the top-left to bottom-right direction
	ResizeNWSE
	// ZoomIn indicates that something can be zoomed in
	ZoomIn
	// ZoomOut indicates that something can be zoomed out
	ZoomOut
	// ScreenshotSelection indicates that a screenshot selection box is being selected
	ScreenshotSelection
	// ScreenshotWindow indicates that a screenshot is being taken of an entire window
	ScreenshotWindow
	// Poof indicates that an item will dissapear when it is released
	Poof
)

Cursor constants, with names based on CSS (see https://developer.mozilla.org/en-US/docs/Web/CSS/cursor) TODO: maybe add NoDrop and AllScroll

const CursorN Cursor = 40

CursorN is the highest valid value for type Cursor, plus one.

func CursorValues

func CursorValues() []Cursor

CursorValues returns all possible values for the type Cursor.

func (Cursor) Desc

func (i Cursor) Desc() string

Desc returns the description of the Cursor value.

func (Cursor) Int64

func (i Cursor) Int64() int64

Int64 returns the Cursor value as an int64.

func (Cursor) MarshalText

func (i Cursor) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Cursor) SetInt64

func (i *Cursor) SetInt64(in int64)

SetInt64 sets the Cursor value from an int64.

func (*Cursor) SetString

func (i *Cursor) SetString(s string) error

SetString sets the Cursor value from its string representation, and returns an error if the string is invalid.

func (Cursor) String

func (i Cursor) String() string

String returns the string representation of this Cursor value.

func (*Cursor) UnmarshalText

func (i *Cursor) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Cursor) Values

func (i Cursor) Values() []enums.Enum

Values returns all possible values for the type Cursor.

Directories

Path Synopsis
Package cursorimg provides the cached rendering of SVG cursors to images.
Package cursorimg provides the cached rendering of SVG cursors to images.

Jump to

Keyboard shortcuts

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