2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 13:18:53 +00:00
<class name= "StyleBox" inherits= "Resource" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
Base class for drawing stylized boxes for the UI.
</brief_description>
<description >
StyleBox is [Resource] that provides an abstract base class for drawing stylized boxes for the UI. StyleBoxes are used for drawing the styles of buttons, line edit 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.
2020-10-06 12:14:09 +00:00
[b]Note:[/b] For children of [Control] 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.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
</tutorials>
<methods >
2022-03-10 07:17:38 +00:00
<method name= "_draw" qualifiers= "virtual const" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "to_canvas_item" type= "RID" />
<param index= "1" name= "rect" type= "Rect2" />
2022-03-10 07:17:38 +00:00
<description >
</description>
</method>
<method name= "_get_center_size" qualifiers= "virtual const" >
<return type= "Vector2" />
<description >
</description>
</method>
<method name= "_get_draw_rect" qualifiers= "virtual const" >
<return type= "Rect2" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "rect" type= "Rect2" />
2022-03-10 07:17:38 +00:00
<description >
</description>
</method>
<method name= "_get_style_margin" qualifiers= "virtual const" >
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "side" type= "int" enum= "Side" />
2022-03-10 07:17:38 +00:00
<description >
</description>
</method>
<method name= "_test_mask" qualifiers= "virtual const" >
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "point" type= "Vector2" />
<param index= "1" name= "rect" type= "Rect2" />
2022-03-10 07:17:38 +00:00
<description >
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "draw" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas_item" type= "RID" />
<param index= "1" name= "rect" type= "Rect2" />
2017-09-12 20:42:36 +00:00
<description >
2022-07-05 04:15:44 +00:00
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].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_center_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2017-09-12 20:42:36 +00:00
<description >
2020-01-13 22:08:42 +00:00
Returns the size of this [StyleBox] without the margins.
2017-09-12 20:42:36 +00:00
</description>
</method>
2019-01-26 21:21:53 +00:00
<method name= "get_current_item_drawn" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "CanvasItem" />
2019-01-26 21:21:53 +00:00
<description >
2020-01-13 22:08:42 +00:00
Returns the [CanvasItem] that handles its [constant CanvasItem.NOTIFICATION_DRAW] or [method CanvasItem._draw] callback at this moment.
2019-01-26 21:21:53 +00:00
</description>
</method>
2019-06-27 14:10:09 +00:00
<method name= "get_default_margin" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "margin" type= "int" enum= "Side" />
2019-06-27 14:10:09 +00:00
<description >
2020-12-22 16:24:29 +00:00
Returns the default margin of the specified [enum Side].
2019-06-27 14:10:09 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_margin" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "margin" type= "int" enum= "Side" />
2017-09-12 20:42:36 +00:00
<description >
2020-12-22 16:24:29 +00:00
Returns the content margin offset for the specified [enum Side].
2019-02-06 16:18:02 +00:00
Positive values reduce size inwards, unlike [Control]'s margin values.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_minimum_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2017-09-12 20:42:36 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the minimum size that this stylebox can be shrunk to.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_offset" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-21 23:04:47 +00:00
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].
2017-09-12 20:42:36 +00:00
</description>
</method>
2019-06-27 14:10:09 +00:00
<method name= "set_default_margin" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "margin" type= "int" enum= "Side" />
<param index= "1" name= "offset" type= "float" />
2019-06-27 14:10:09 +00:00
<description >
2022-08-10 02:00:19 +00:00
Sets the default value of the specified [enum Side] to [param offset] pixels.
2019-06-27 14:10:09 +00:00
</description>
</method>
2022-03-12 04:38:44 +00:00
<method name= "set_default_margin_all" >
<return type= "void" />
<param index= "0" name= "offset" type= "float" />
<description >
Sets the default margin to [param offset] pixels for all sides.
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "test_mask" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "point" type= "Vector2" />
<param index= "1" name= "rect" type= "Rect2" />
2017-09-12 20:42:36 +00:00
<description >
Test a position in a rectangle, return whether it passes the mask test.
</description>
</method>
</methods>
<members >
2022-03-14 14:52:03 +00:00
<member name= "content_margin_bottom" type= "float" setter= "set_default_margin" getter= "get_default_margin" >
2019-02-06 16:18:02 +00:00
The bottom margin for the contents of this style box. Increasing this value reduces the space available to the contents from the bottom.
If this value is negative, it is ignored and a child-specific margin is used instead. For example for [StyleBoxFlat] the border thickness (if any) is used instead.
It is up to the code using this style box to decide what these contents are: for example, a [Button] respects this content margin for the textual contents of the button.
[method get_margin] should be used to fetch this value as consumer instead of reading these properties directly. This is because it correctly respects negative values and the fallback mentioned above.
2017-09-12 20:42:36 +00:00
</member>
2022-03-14 14:52:03 +00:00
<member name= "content_margin_left" type= "float" setter= "set_default_margin" getter= "get_default_margin" >
2019-02-06 16:18:02 +00:00
The left margin for the contents of this style box. Increasing this value reduces the space available to the contents from the left.
Refer to [member content_margin_bottom] for extra considerations.
2017-09-12 20:42:36 +00:00
</member>
2022-03-14 14:52:03 +00:00
<member name= "content_margin_right" type= "float" setter= "set_default_margin" getter= "get_default_margin" >
2019-02-06 16:18:02 +00:00
The right margin for the contents of this style box. Increasing this value reduces the space available to the contents from the right.
Refer to [member content_margin_bottom] for extra considerations.
2017-09-12 20:42:36 +00:00
</member>
2022-03-14 14:52:03 +00:00
<member name= "content_margin_top" type= "float" setter= "set_default_margin" getter= "get_default_margin" >
2019-02-06 16:18:02 +00:00
The top margin for the contents of this style box. Increasing this value reduces the space available to the contents from the top.
Refer to [member content_margin_bottom] for extra considerations.
2017-09-12 20:42:36 +00:00
</member>
</members>
</class>