abilities

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: BSD-3-Clause Imports: 5 Imported by: 10

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: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes)

const (
	// Editable means the element can be edited.  Otherwise, it remains in
	// ReadOnly mode.
	Editable Abilities = iota

	// Selectable means it can be Selected
	Selectable

	// Activatable means it can be made Active
	Activatable

	// Pressable means it can be pressed but is not Activatable.
	// Pressed items receive Click events, but do not get the automatic
	// Active state otherwise associated with Activatable items.
	Pressable

	// LongPressable indicates that an element can be LongPressed
	LongPressable

	// DoubleClickable indicates that an element does something different
	// when it is clicked on twice in a row. If this is not set, DoubleClick
	// events are processed in the same way as Click events.
	DoubleClickable

	// 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
	Focusable

	// FocusWithinable means it can be FocusedWithin
	FocusWithinable

	// 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) IsValid

func (i Abilities) IsValid() bool

IsValid returns whether the value is a valid option for type Abilities.

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