Documentation ¶
Overview ¶
Package StyleBox provides methods for working with StyleBox object instances.
Index ¶
- type Advanced
- type Any
- type Implementation
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsStyleBox() Instance
- func (self Instance) ContentMarginBottom() Float.X
- func (self Instance) ContentMarginLeft() Float.X
- func (self Instance) ContentMarginRight() Float.X
- func (self Instance) ContentMarginTop() Float.X
- func (self Instance) Draw(canvas_item RID.CanvasItem, rect Rect2.PositionSize)
- func (self Instance) GetCurrentItemDrawn() [1]gdclass.CanvasItem
- func (self Instance) GetMargin(margin Side) Float.X
- func (self Instance) GetMinimumSize() Vector2.XY
- func (self Instance) GetOffset() Vector2.XY
- func (self Instance) SetContentMarginAll(offset Float.X)
- func (self Instance) SetContentMarginBottom(value Float.X)
- func (self Instance) SetContentMarginLeft(value Float.X)
- func (self Instance) SetContentMarginRight(value Float.X)
- func (self Instance) SetContentMarginTop(value Float.X)
- func (self Instance) TestMask(point Vector2.XY, rect Rect2.PositionSize) bool
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
- type Side
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 Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
[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.
%!(EXTRA string=StyleBox)
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsStyleBox ¶
func (Instance) ContentMarginBottom ¶
func (Instance) ContentMarginLeft ¶
func (Instance) ContentMarginRight ¶
func (Instance) ContentMarginTop ¶
func (Instance) Draw ¶
func (self Instance) Draw(canvas_item RID.CanvasItem, rect Rect2.PositionSize)
Draws this stylebox using a canvas item identified by the given [RID]. The [RID] value can either be the result of [method CanvasItem.get_canvas_item] called on an existing [CanvasItem]-derived node, or directly from creating a canvas item in the [RenderingServer] with [method RenderingServer.canvas_item_create].
func (Instance) GetCurrentItemDrawn ¶
func (self Instance) GetCurrentItemDrawn() [1]gdclass.CanvasItem
Returns the [CanvasItem] that handles its [constant CanvasItem.NOTIFICATION_DRAW] or [method CanvasItem._draw] callback at this moment.
func (Instance) GetMargin ¶
Returns the content margin offset for the specified [enum Side]. Positive values reduce size inwards, unlike [Control]'s margin values.
func (Instance) GetMinimumSize ¶
Returns the minimum size that this stylebox can be shrunk to.
func (Instance) GetOffset ¶
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) SetContentMarginAll ¶
Sets the default margin to [param offset] pixels for all sides.
func (Instance) SetContentMarginBottom ¶
func (Instance) SetContentMarginLeft ¶
func (Instance) SetContentMarginRight ¶
func (Instance) SetContentMarginTop ¶
func (*Instance) UnsafePointer ¶
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 }
type Side ¶
type Side int
const ( /*Left side, usually used for [Control] or [StyleBox]-derived classes.*/ SideLeft Side = 0 /*Top side, usually used for [Control] or [StyleBox]-derived classes.*/ SideTop Side = 1 /*Right side, usually used for [Control] or [StyleBox]-derived classes.*/ SideRight Side = 2 /*Bottom side, usually used for [Control] or [StyleBox]-derived classes.*/ SideBottom Side = 3 )