virtualx-engine-docs/_sources/classes/class_aspectratiocontainer.rst.txt
2024-10-23 09:41:33 -07:00

208 lines
7.8 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/AspectRatioContainer.xml.
.. _class_AspectRatioContainer:
AspectRatioContainer
====================
**Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
Container that preserves its child controls' aspect ratio.
.. rst-class:: classref-introduction-group
Description
-----------
Arranges child controls in a way to preserve their aspect ratio automatically whenever the container is resized. Solves the problem where the container size is dynamic and the contents' size needs to adjust accordingly without losing proportions.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`GUI containers <../tutorials/ui/gui_containers>`
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
| :ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` | :ref:`alignment_horizontal<class_AspectRatioContainer_property_alignment_horizontal>` | ``1`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
| :ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` | :ref:`alignment_vertical<class_AspectRatioContainer_property_alignment_vertical>` | ``1`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
| :ref:`float<class_float>` | :ref:`ratio<class_AspectRatioContainer_property_ratio>` | ``1.0`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
| :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` | :ref:`stretch_mode<class_AspectRatioContainer_property_stretch_mode>` | ``2`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_AspectRatioContainer_StretchMode:
.. rst-class:: classref-enumeration
enum **StretchMode**:
.. _class_AspectRatioContainer_constant_STRETCH_WIDTH_CONTROLS_HEIGHT:
.. rst-class:: classref-enumeration-constant
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_WIDTH_CONTROLS_HEIGHT** = ``0``
The height of child controls is automatically adjusted based on the width of the container.
.. _class_AspectRatioContainer_constant_STRETCH_HEIGHT_CONTROLS_WIDTH:
.. rst-class:: classref-enumeration-constant
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_HEIGHT_CONTROLS_WIDTH** = ``1``
The width of child controls is automatically adjusted based on the height of the container.
.. _class_AspectRatioContainer_constant_STRETCH_FIT:
.. rst-class:: classref-enumeration-constant
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_FIT** = ``2``
The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio.
.. _class_AspectRatioContainer_constant_STRETCH_COVER:
.. rst-class:: classref-enumeration-constant
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_COVER** = ``3``
The width and height of child controls is automatically adjusted to make their bounding rectangle cover the entire area of the container while keeping the aspect ratio.
When the bounding rectangle of child controls exceed the container's size and :ref:`Control.rect_clip_content<class_Control_property_rect_clip_content>` is enabled, this allows to show only the container's area restricted by its own bounding rectangle.
.. rst-class:: classref-item-separator
----
.. _enum_AspectRatioContainer_AlignMode:
.. rst-class:: classref-enumeration
enum **AlignMode**:
.. _class_AspectRatioContainer_constant_ALIGN_BEGIN:
.. rst-class:: classref-enumeration-constant
:ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **ALIGN_BEGIN** = ``0``
Aligns child controls with the beginning (left or top) of the container.
.. _class_AspectRatioContainer_constant_ALIGN_CENTER:
.. rst-class:: classref-enumeration-constant
:ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **ALIGN_CENTER** = ``1``
Aligns child controls with the center of the container.
.. _class_AspectRatioContainer_constant_ALIGN_END:
.. rst-class:: classref-enumeration-constant
:ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **ALIGN_END** = ``2``
Aligns child controls with the end (right or bottom) of the container.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_AspectRatioContainer_property_alignment_horizontal:
.. rst-class:: classref-property
:ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **alignment_horizontal** = ``1``
.. rst-class:: classref-property-setget
- void **set_alignment_horizontal** **(** :ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` value **)**
- :ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **get_alignment_horizontal** **(** **)**
Specifies the horizontal relative position of child controls.
.. rst-class:: classref-item-separator
----
.. _class_AspectRatioContainer_property_alignment_vertical:
.. rst-class:: classref-property
:ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **alignment_vertical** = ``1``
.. rst-class:: classref-property-setget
- void **set_alignment_vertical** **(** :ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` value **)**
- :ref:`AlignMode<enum_AspectRatioContainer_AlignMode>` **get_alignment_vertical** **(** **)**
Specifies the vertical relative position of child controls.
.. rst-class:: classref-item-separator
----
.. _class_AspectRatioContainer_property_ratio:
.. rst-class:: classref-property
:ref:`float<class_float>` **ratio** = ``1.0``
.. rst-class:: classref-property-setget
- void **set_ratio** **(** :ref:`float<class_float>` value **)**
- :ref:`float<class_float>` **get_ratio** **(** **)**
The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the :ref:`stretch_mode<class_AspectRatioContainer_property_stretch_mode>`.
.. rst-class:: classref-item-separator
----
.. _class_AspectRatioContainer_property_stretch_mode:
.. rst-class:: classref-property
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **stretch_mode** = ``2``
.. rst-class:: classref-property-setget
- void **set_stretch_mode** **(** :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` value **)**
- :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **get_stretch_mode** **(** **)**
The stretch mode used to align child controls.
.. |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.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`