Files
godot-docs/classes/class_boxcontainer.rst
2024-05-07 11:26:31 +00:00

192 lines
6.7 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/BoxContainer.xml.
.. _class_BoxContainer:
BoxContainer
============
**Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`HBoxContainer<class_HBoxContainer>`, :ref:`VBoxContainer<class_VBoxContainer>`
A container that arranges its child controls horizontally or vertically.
.. rst-class:: classref-introduction-group
Description
-----------
A container that arranges its child controls horizontally or vertically, rearranging them automatically when their minimum size changes.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`Using Containers <../tutorials/ui/gui_containers>`
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-------------------------------------------------------+---------------------------------------------------------+-----------+
| :ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` | :ref:`alignment<class_BoxContainer_property_alignment>` | ``0`` |
+-------------------------------------------------------+---------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`vertical<class_BoxContainer_property_vertical>` | ``false`` |
+-------------------------------------------------------+---------------------------------------------------------+-----------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------+---------------------------------------------------------------------------------------------------+
| :ref:`Control<class_Control>` | :ref:`add_spacer<class_BoxContainer_method_add_spacer>` **(** :ref:`bool<class_bool>` begin **)** |
+-------------------------------+---------------------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
Theme Properties
----------------
.. table::
:widths: auto
+-----------------------+-----------------------------------------------------------------+-------+
| :ref:`int<class_int>` | :ref:`separation<class_BoxContainer_theme_constant_separation>` | ``4`` |
+-----------------------+-----------------------------------------------------------------+-------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_BoxContainer_AlignmentMode:
.. rst-class:: classref-enumeration
enum **AlignmentMode**:
.. _class_BoxContainer_constant_ALIGNMENT_BEGIN:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` **ALIGNMENT_BEGIN** = ``0``
The child controls will be arranged at the beginning of the container, i.e. top if orientation is vertical, left if orientation is horizontal (right for RTL layout).
.. _class_BoxContainer_constant_ALIGNMENT_CENTER:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` **ALIGNMENT_CENTER** = ``1``
The child controls will be centered in the container.
.. _class_BoxContainer_constant_ALIGNMENT_END:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` **ALIGNMENT_END** = ``2``
The child controls will be arranged at the end of the container, i.e. bottom if orientation is vertical, right if orientation is horizontal (left for RTL layout).
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_BoxContainer_property_alignment:
.. rst-class:: classref-property
:ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` **alignment** = ``0``
.. rst-class:: classref-property-setget
- void **set_alignment** **(** :ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` value **)**
- :ref:`AlignmentMode<enum_BoxContainer_AlignmentMode>` **get_alignment** **(** **)**
The alignment of the container's children (must be one of :ref:`ALIGNMENT_BEGIN<class_BoxContainer_constant_ALIGNMENT_BEGIN>`, :ref:`ALIGNMENT_CENTER<class_BoxContainer_constant_ALIGNMENT_CENTER>`, or :ref:`ALIGNMENT_END<class_BoxContainer_constant_ALIGNMENT_END>`).
.. rst-class:: classref-item-separator
----
.. _class_BoxContainer_property_vertical:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **vertical** = ``false``
.. rst-class:: classref-property-setget
- void **set_vertical** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **is_vertical** **(** **)**
If ``true``, the **BoxContainer** will arrange its children vertically, rather than horizontally.
Can't be changed when using :ref:`HBoxContainer<class_HBoxContainer>` and :ref:`VBoxContainer<class_VBoxContainer>`.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_BoxContainer_method_add_spacer:
.. rst-class:: classref-method
:ref:`Control<class_Control>` **add_spacer** **(** :ref:`bool<class_bool>` begin **)**
Adds a :ref:`Control<class_Control>` node to the box as a spacer. If ``begin`` is ``true``, it will insert the :ref:`Control<class_Control>` node in front of all other children.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Theme Property Descriptions
---------------------------
.. _class_BoxContainer_theme_constant_separation:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **separation** = ``4``
The space between the **BoxContainer**'s elements, in pixels.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`