Range

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Range is an abstract base class for controls that represent a number within a range, using a configured Step and Page size. See e.g. ScrollBar and Slider for examples of higher-level nodes using Range.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsRange() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRange

func (self *Extension[T]) AsRange() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.Range

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AllowGreater

func (self Instance) AllowGreater() bool

If true, Value may be greater than MaxValue.

func (Instance) AllowLesser

func (self Instance) AllowLesser() bool

If true, Value may be less than MinValue.

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRange

func (self Instance) AsRange() Instance

func (Instance) ExpEdit

func (self Instance) ExpEdit() bool

If true, and MinValue is greater or equal to 0, Value will be represented exponentially rather than linearly.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MaxValue

func (self Instance) MaxValue() Float.X

Maximum value. Range is clamped if Value is greater than MaxValue.

func (Instance) MinValue

func (self Instance) MinValue() Float.X

Minimum value. Range is clamped if Value is less than MinValue.

func (Instance) OnChanged

func (self Instance) OnChanged(cb func(), flags ...Signal.Flags)

Emitted when MinValue, MaxValue, Page, or Step change.

func (Instance) OnValueChanged

func (self Instance) OnValueChanged(cb func(value Float.X), flags ...Signal.Flags)

Emitted when Value changes. When used on a Slider, this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to OnValueChanged, consider using a debouncing Timer to call the function less often.

Note: Unlike signals such as OnLineedit.TextChanged, OnValueChanged is also emitted when 'value' is set directly via code.

func (Instance) Page

func (self Instance) Page() Float.X

Page size. Used mainly for ScrollBar. A ScrollBar's grabber length is the ScrollBar's size multiplied by Page over the difference between MinValue and MaxValue.

func (Instance) Ratio

func (self Instance) Ratio() Float.X

The value mapped between 0 and 1.

func (Instance) Rounded

func (self Instance) Rounded() bool

If true, Value will always be rounded to the nearest integer.

func (Instance) SetAllowGreater

func (self Instance) SetAllowGreater(value bool)

SetAllowGreater sets the property returned by [IsGreaterAllowed].

func (Instance) SetAllowLesser

func (self Instance) SetAllowLesser(value bool)

SetAllowLesser sets the property returned by [IsLesserAllowed].

func (Instance) SetExpEdit

func (self Instance) SetExpEdit(value bool)

SetExpEdit sets the property returned by [IsRatioExp].

func (Instance) SetMaxValue

func (self Instance) SetMaxValue(value Float.X)

SetMaxValue sets the property returned by [GetMax].

func (Instance) SetMinValue

func (self Instance) SetMinValue(value Float.X)

SetMinValue sets the property returned by [GetMin].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPage

func (self Instance) SetPage(value Float.X)

SetPage sets the property returned by [GetPage].

func (Instance) SetRatio

func (self Instance) SetRatio(value Float.X)

SetRatio sets the property returned by [GetAsRatio].

func (Instance) SetRounded

func (self Instance) SetRounded(value bool)

SetRounded sets the property returned by [IsUsingRoundedValues].

func (Instance) SetStep

func (self Instance) SetStep(value Float.X)

SetStep sets the property returned by [GetStep].

func (Instance) SetValue

func (self Instance) SetValue(value Float.X)

SetValue sets the property returned by [GetValue].

func (Instance) SetValueNoSignal

func (self Instance) SetValueNoSignal(value Float.X)

Sets the Range's current value to the specified 'value', without emitting the OnValueChanged signal.

func (Instance) Share

func (self Instance) Share(with Node.Instance)

Binds two Ranges together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group.

func (Instance) Step

func (self Instance) Step() Float.X

If greater than 0, Value will always be rounded to a multiple of this property's value above MinValue. For example, if MinValue is 0.1 and step is 0.2, then Value is limited to 0.1, 0.3, 0.5, and so on. If Rounded is also true, Value will first be rounded to a multiple of this property's value, then rounded to the nearest integer.

func (Instance) Unshare

func (self Instance) Unshare()

Stops the Range from sharing its member variables with any other.

func (Instance) Value

func (self Instance) Value() Float.X

Range's current value. Changing this property (even via code) will trigger OnValueChanged signal. Use SetValueNoSignal if you want to avoid it.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	// Called when the [Range]'s value is changed (following the same conditions as [OnValueChanged]).
	//
	// [OnValueChanged]: https://pkg.go.dev/graphics.gd/classdb/Range#Instance.OnValueChanged
	// [Range]: https://pkg.go.dev/graphics.gd/classdb/Range
	ValueChanged(new_value Float.X)
}

Jump to

Keyboard shortcuts

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