Struct gdnative_bindings_lily::TextureButton[][src]

pub struct TextureButton { /* fields omitted */ }
Expand description

core class TextureButton inherits BaseButton (unsafe).

Official documentation

See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.

Memory management

Non reference counted objects such as the ones of this type are usually owned by the engine.

TextureButton is a reference-only type. Persistent references can only exist in the unsafe Ref<TextureButton> form.

In the cases where Rust code owns an object of this type, for example if the object was just created on the Rust side and not passed to the engine yet, ownership should be either given to the engine or the object must be manually destroyed using Ref::free, or Ref::queue_free if it is a Node.

Class hierarchy

TextureButton inherits methods from:

Safety

All types in the Godot API have “interior mutability” in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

Constants

Creates a new instance of this object.

Because this type is not reference counted, the lifetime of the returned object is not automatically managed.

Immediately after creation, the object is owned by the caller, and can be passed to the engine (in which case the engine will be responsible for destroying the object) or destroyed manually using Ref::free, or preferably Ref::queue_free if it is a Node.

Pure black and white BitMap image to use for click detection. On the mask, white pixels represent the button’s clickable area. Use it to create buttons with curved shapes.

Texture to display when the node is disabled. See [member BaseButton.disabled].

If true, the texture stretches to the edges of the node’s bounding rectangle using the [member stretch_mode]. If false, the texture will not scale with the node.

Texture to display when the node has mouse or keyboard focus.

Texture to display when the mouse hovers the node.

Texture to display by default, when the node is not in the disabled, focused, hover or pressed state.

Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the Enter key or if the player presses the [member BaseButton.shortcut] key.

Controls the texture’s behavior when you resize the node’s bounding rectangle, only if [member expand] is true. Set it to one of the [enum StretchMode] constants. See the constants to learn more.

Pure black and white BitMap image to use for click detection. On the mask, white pixels represent the button’s clickable area. Use it to create buttons with curved shapes.

Texture to display when the node is disabled. See [member BaseButton.disabled].

If true, the texture stretches to the edges of the node’s bounding rectangle using the [member stretch_mode]. If false, the texture will not scale with the node.

Texture to display when the node has mouse or keyboard focus.

Texture to display when the mouse hovers the node.

Texture to display by default, when the node is not in the disabled, focused, hover or pressed state.

Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the Enter key or if the player presses the [member BaseButton.shortcut] key.

Controls the texture’s behavior when you resize the node’s bounding rectangle, only if [member expand] is true. Set it to one of the [enum StretchMode] constants. See the constants to learn more.

Methods from Deref<Target = BaseButton>

Determines when the button is considered clicked, one of the [enum ActionMode] constants.

ButtonGroup associated to the button.

Binary mask to choose which mouse buttons this button will respond to. To allow both left-click and right-click, use BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT.

Returns the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to “draw” signal. The visual state of the button is defined by the [enum DrawMode] enum.

Focus access mode to use when switching between enabled/disabled (see [member Control.focus_mode] and [member disabled]).

ShortCut associated to the button.

If true, the button is in disabled state and can’t be clicked or toggled.

Returns true if the mouse has entered the button and has not left it yet.

If true, the button stays pressed when moving the cursor outside the button while pressing it. Note: This property only affects the button’s visual appearance. Signals will be emitted at the same moment regardless of this property’s value.

If true, the button’s state is pressed. Means the button is pressed down or toggled (if [member toggle_mode] is active).

If true, the button will add information about its shortcut in the tooltip.

If true, the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.

Determines when the button is considered clicked, one of the [enum ActionMode] constants.

ButtonGroup associated to the button.

Binary mask to choose which mouse buttons this button will respond to. To allow both left-click and right-click, use BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT.

If true, the button is in disabled state and can’t be clicked or toggled.

Focus access mode to use when switching between enabled/disabled (see [member Control.focus_mode] and [member disabled]).

If true, the button stays pressed when moving the cursor outside the button while pressing it. Note: This property only affects the button’s visual appearance. Signals will be emitted at the same moment regardless of this property’s value.

If true, the button’s state is pressed. Means the button is pressed down or toggled (if [member toggle_mode] is active).

ShortCut associated to the button.

If true, the button will add information about its shortcut in the tooltip.

If true, the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

Creates an explicitly null reference of Self as a method argument. This makes type inference easier for the compiler compared to Option. Read more

Creates a new instance of Self using a zero-argument constructor, as a Unique reference. Read more

Performs a dynamic reference downcast to target type. Read more

Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more

Creates a persistent reference to the same Godot object with shared thread access. Read more

Creates a persistent reference to the same Godot object with thread-local thread access. Read more

Creates a persistent reference to the same Godot object with unique access. Read more

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive. See also TRef::try_from_instance_id. Read more

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive, and panics otherwise. This does NOT guarantee that the resulting reference is safe to use. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.