abilities

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: BSD-3-Clause Imports: 1 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Abilities

type Abilities int64 //enums:bitflag

Abilities represent abilities of GUI elements to take on different States, and are aligned with the States flags. All elements can be disabled. These correspond to some of the global attributes in CSS: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes

const (
	// Selectable means it can be Selected
	Selectable Abilities = iota

	// Activatable means it can be made Active by pressing down on it,
	// which gives it a visible state layer color change.
	// This also implies Clickable, receiving Click events when
	// the user executes a mouse down and up event on the same element.
	Activatable

	// Clickable means it can be Clicked, receiving Click events when
	// the user executes a mouse down and up event on the same element,
	// but otherwise does not change its rendering when pressed
	// (as Activatable does).  Use this for items that are more passively
	// clickable, such as frames or tables, whereas e.g., a Button is
	// Activatable.
	Clickable

	// DoubleClickable indicates that an element does something different
	// when it is clicked on twice in a row.
	DoubleClickable

	// TripleClickable indicates that an element does something different
	// when it is clicked on three times in a row.
	TripleClickable

	// RepeatClickable indicates that an element should receive repeated
	// click events when the pointer is held down on it.
	RepeatClickable

	// LongPressable indicates that an element can be LongPressed
	LongPressable

	// Draggable means it can be Dragged
	Draggable

	// Droppable means it can receive DragEnter, DragLeave, and Drop events
	// (not specific to current Drag item, just generally)
	Droppable

	// Slideable means it has a slider element that can be dragged
	// to change value.  Cannot be both Draggable and Slideable.
	Slideable

	// Checkable means it can be Checked
	Checkable

	// Scrollable means it can be Scrolled
	Scrollable

	// Focusable means it can be Focused: capable of receiving and processing key events directly
	// and typically changing the style when focused to indicate this property to the user.
	Focusable

	// Hoverable means it can be Hovered
	Hoverable

	// LongHoverable means it can be LongHovered
	LongHoverable
)
const AbilitiesN Abilities = 15

AbilitiesN is the highest valid value for type Abilities, plus one.

func AbilitiesValues

func AbilitiesValues() []Abilities

AbilitiesValues returns all possible values for the type Abilities.

func (Abilities) BitIndexString

func (i Abilities) BitIndexString() string

BitIndexString returns the string representation of this Abilities value if it is a bit index value (typically an enum constant), and not an actual bit flag value.

func (Abilities) Desc

func (i Abilities) Desc() string

Desc returns the description of the Abilities value.

func (*Abilities) HasFlag

func (i *Abilities) HasFlag(f enums.BitFlag) bool

HasFlag returns whether these bit flags have the given bit flag set.

func (Abilities) Int64

func (i Abilities) Int64() int64

Int64 returns the Abilities value as an int64.

func (*Abilities) Is

func (ab *Abilities) Is(flag enums.BitFlag) bool

Is is a shortcut for HasFlag for Abilities

func (*Abilities) IsHoverable

func (ab *Abilities) IsHoverable() bool

IsHoverable is true for both Hoverable and LongHoverable

func (*Abilities) IsPressable

func (ab *Abilities) IsPressable() bool

IsPressable returns true when an element is Selectable, Activatable, DoubleClickable, Draggable, Slideable, or Checkable

func (Abilities) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface.

func (*Abilities) SetFlag

func (i *Abilities) SetFlag(on bool, f ...enums.BitFlag)

SetFlag sets the value of the given flags in these flags to the given value.

func (*Abilities) SetInt64

func (i *Abilities) SetInt64(in int64)

SetInt64 sets the Abilities value from an int64.

func (*Abilities) SetString

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

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

func (*Abilities) SetStringOr

func (i *Abilities) SetStringOr(s string) error

SetStringOr sets the Abilities value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.

func (Abilities) String

func (i Abilities) String() string

String returns the string representation of this Abilities value.

func (*Abilities) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Abilities) Values

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

Values returns all possible values for the type Abilities.

Jump to

Keyboard shortcuts

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