Files
godot-docs/classes/class_stylebox.rst
Rémi Verschelde 2f06d055e3 De-headline the Inherits and Category fields
Also escape _ and * characters in e.g. "TYPE_*" description content.
2016-02-08 18:31:35 +01:00

86 lines
5.3 KiB
ReStructuredText

.. _class_StyleBox:
StyleBox
========
**Inherits:** :ref:`Resource<class_resource>`
**Category:** Core
Base class for drawing stylized boxes for the UI.
Member Functions
----------------
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`test_mask<class_StyleBox_test_mask>` **(** :ref:`Vector2<class_vector2>` point, :ref:`Rect2<class_rect2>` rect **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_default_margin<class_StyleBox_set_default_margin>` **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` offset **)** |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_default_margin<class_StyleBox_get_default_margin>` **(** :ref:`int<class_int>` margin **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_margin<class_StyleBox_get_margin>` **(** :ref:`int<class_int>` margin **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_vector2>` | :ref:`get_minimum_size<class_StyleBox_get_minimum_size>` **(** **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_vector2>` | :ref:`get_center_size<class_StyleBox_get_center_size>` **(** **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_StyleBox_get_offset>` **(** **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`draw<class_StyleBox_draw>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect **)** const |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
Description
-----------
StyleBox is :ref:`Resource<class_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.
Member Function Description
---------------------------
.. _class_StyleBox_test_mask:
- :ref:`bool<class_bool>` **test_mask** **(** :ref:`Vector2<class_vector2>` point, :ref:`Rect2<class_rect2>` rect **)** const
Test a position in a rectangle, return wether it pases the mask test.
.. _class_StyleBox_set_default_margin:
- void **set_default_margin** **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` offset **)**
Set the default offset "offset" of the margin "margin" (see MARGIN\_\* enum) for a StyleBox, Controls that draw styleboxes with context inside need to know the margin, so the border of the stylebox is not occluded.
.. _class_StyleBox_get_default_margin:
- :ref:`float<class_float>` **get_default_margin** **(** :ref:`int<class_int>` margin **)** const
Return the default offset of the margin "margin" (see MARGIN\_\* enum) of a StyleBox, Controls that draw styleboxes with context inside need to know the margin, so the border of the stylebox is not occluded.
.. _class_StyleBox_get_margin:
- :ref:`float<class_float>` **get_margin** **(** :ref:`int<class_int>` margin **)** const
Return the offset of margin "margin" (see MARGIN\_\* enum).
.. _class_StyleBox_get_minimum_size:
- :ref:`Vector2<class_vector2>` **get_minimum_size** **(** **)** const
Return the minimum size that this stylebox can be shrunk to.
.. _class_StyleBox_get_center_size:
- :ref:`Vector2<class_vector2>` **get_center_size** **(** **)** const
.. _class_StyleBox_get_offset:
- :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
Return the "offset" of a stylebox, this is a helper function, like writing Point2( style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP) )
.. _class_StyleBox_draw:
- void **draw** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect **)** const