StyleBox

package
v0.0.0-...-6566898 Latest Latest
Warning

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

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

Documentation

Overview

Package StyleBox provides methods for working with StyleBox object instances.

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
	AsStyleBox() 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

func (*Extension[T]) AsObject

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

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

func (*Extension[T]) AsStyleBox

func (self *Extension[T]) AsStyleBox() 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.StyleBox

[StyleBox] is an abstract base class for drawing stylized boxes for UI elements. It is used for panels, buttons, [LineEdit] backgrounds, [Tree] backgrounds, etc. and also for testing a transparency mask for pointer signals. If mask test fails on a [StyleBox] assigned as mask to a control, clicks and motion signals will go through it to the one below. [b]Note:[/b] For control nodes that have [i]Theme Properties[/i], the [code]focus[/code] [StyleBox] is displayed over the [code]normal[/code], [code]hover[/code] or [code]pressed[/code] [StyleBox]. This makes the [code]focus[/code] [StyleBox] more reusable across different nodes.

See [Interface] for methods that can be overridden by a [Class] that extends it.
var Nil Instance

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

func New

func New() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsStyleBox

func (self Instance) AsStyleBox() Instance

func (Instance) ContentMarginBottom

func (self Instance) ContentMarginBottom() Float.X

func (Instance) ContentMarginLeft

func (self Instance) ContentMarginLeft() Float.X

func (Instance) ContentMarginRight

func (self Instance) ContentMarginRight() Float.X

func (Instance) ContentMarginTop

func (self Instance) ContentMarginTop() Float.X

func (Instance) Draw

func (self Instance) Draw(peer CanvasItem.Instance, rect Rect2.PositionSize)

Draws a styled rectangle.

func (Instance) GetCurrentItemDrawn

func (self Instance) GetCurrentItemDrawn() CanvasItem.Instance

Returns the [CanvasItem] that handles its [constant CanvasItem.NOTIFICATION_DRAW] or [method CanvasItem._draw] callback at this moment.

func (Instance) GetMargin

func (self Instance) GetMargin(margin Rect2.Side) Float.X

Returns the content margin offset for the specified [enum Side]. Positive values reduce size inwards, unlike [Control]'s margin values.

func (Instance) GetMinimumSize

func (self Instance) GetMinimumSize() Vector2.XY

Returns the minimum size that this stylebox can be shrunk to.

func (Instance) GetOffset

func (self Instance) GetOffset() Vector2.XY

Returns the "offset" of a stylebox. This helper function returns a value equivalent to [code]Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))[/code].

func (Instance) ID

func (self Instance) ID() ID

func (Instance) SetContentMarginAll

func (self Instance) SetContentMarginAll(offset Float.X)

Sets the default margin to [param offset] pixels for all sides.

func (Instance) SetContentMarginBottom

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

func (Instance) SetContentMarginLeft

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

func (Instance) SetContentMarginRight

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

func (Instance) SetContentMarginTop

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

func (*Instance) SetObject

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

func (Instance) TestMask

func (self Instance) TestMask(point Vector2.XY, rect Rect2.PositionSize) bool

Test a position in a rectangle, return whether it passes the mask test.

func (Instance) Virtual

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

type Interface

type Interface interface {
	Draw(to_canvas_item RID.Any, rect Rect2.PositionSize)
	GetDrawRect(rect Rect2.PositionSize) Rect2.PositionSize
	//Virtual method to be implemented by the user. Returns a custom minimum size that the stylebox must respect when drawing. By default [method get_minimum_size] only takes content margins into account. This method can be overridden to add another size restriction. A combination of the default behavior and the output of this method will be used, to account for both sizes.
	GetMinimumSize() Vector2.XY
	TestMask(point Vector2.XY, rect Rect2.PositionSize) bool
}

Jump to

Keyboard shortcuts

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