class_aspectratiocontainer.rst 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AspectRatioContainer.xml.
  6. .. _class_AspectRatioContainer:
  7. AspectRatioContainer
  8. ====================
  9. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A container that preserves the proportions of its child controls.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A container type that arranges its child controls in a way that preserves their proportions automatically when the container is resized. Useful when a container has a dynamic size and the child nodes must adjust their sizes accordingly without losing their aspect ratios.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`Using Containers <../tutorials/ui/gui_containers>`
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
  25. | :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` | :ref:`alignment_horizontal<class_AspectRatioContainer_property_alignment_horizontal>` | ``1`` |
  26. +---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
  27. | :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` | :ref:`alignment_vertical<class_AspectRatioContainer_property_alignment_vertical>` | ``1`` |
  28. +---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
  29. | :ref:`float<class_float>` | :ref:`ratio<class_AspectRatioContainer_property_ratio>` | ``1.0`` |
  30. +---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
  31. | :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` | :ref:`stretch_mode<class_AspectRatioContainer_property_stretch_mode>` | ``2`` |
  32. +---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
  33. .. rst-class:: classref-section-separator
  34. ----
  35. .. rst-class:: classref-descriptions-group
  36. Enumerations
  37. ------------
  38. .. _enum_AspectRatioContainer_StretchMode:
  39. .. rst-class:: classref-enumeration
  40. enum **StretchMode**: :ref:`🔗<enum_AspectRatioContainer_StretchMode>`
  41. .. _class_AspectRatioContainer_constant_STRETCH_WIDTH_CONTROLS_HEIGHT:
  42. .. rst-class:: classref-enumeration-constant
  43. :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_WIDTH_CONTROLS_HEIGHT** = ``0``
  44. The height of child controls is automatically adjusted based on the width of the container.
  45. .. _class_AspectRatioContainer_constant_STRETCH_HEIGHT_CONTROLS_WIDTH:
  46. .. rst-class:: classref-enumeration-constant
  47. :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_HEIGHT_CONTROLS_WIDTH** = ``1``
  48. The width of child controls is automatically adjusted based on the height of the container.
  49. .. _class_AspectRatioContainer_constant_STRETCH_FIT:
  50. .. rst-class:: classref-enumeration-constant
  51. :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_FIT** = ``2``
  52. The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio.
  53. .. _class_AspectRatioContainer_constant_STRETCH_COVER:
  54. .. rst-class:: classref-enumeration-constant
  55. :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_COVER** = ``3``
  56. 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.
  57. When the bounding rectangle of child controls exceed the container's size and :ref:`Control.clip_contents<class_Control_property_clip_contents>` is enabled, this allows to show only the container's area restricted by its own bounding rectangle.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _enum_AspectRatioContainer_AlignmentMode:
  61. .. rst-class:: classref-enumeration
  62. enum **AlignmentMode**: :ref:`🔗<enum_AspectRatioContainer_AlignmentMode>`
  63. .. _class_AspectRatioContainer_constant_ALIGNMENT_BEGIN:
  64. .. rst-class:: classref-enumeration-constant
  65. :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **ALIGNMENT_BEGIN** = ``0``
  66. Aligns child controls with the beginning (left or top) of the container.
  67. .. _class_AspectRatioContainer_constant_ALIGNMENT_CENTER:
  68. .. rst-class:: classref-enumeration-constant
  69. :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **ALIGNMENT_CENTER** = ``1``
  70. Aligns child controls with the center of the container.
  71. .. _class_AspectRatioContainer_constant_ALIGNMENT_END:
  72. .. rst-class:: classref-enumeration-constant
  73. :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **ALIGNMENT_END** = ``2``
  74. Aligns child controls with the end (right or bottom) of the container.
  75. .. rst-class:: classref-section-separator
  76. ----
  77. .. rst-class:: classref-descriptions-group
  78. Property Descriptions
  79. ---------------------
  80. .. _class_AspectRatioContainer_property_alignment_horizontal:
  81. .. rst-class:: classref-property
  82. :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **alignment_horizontal** = ``1`` :ref:`🔗<class_AspectRatioContainer_property_alignment_horizontal>`
  83. .. rst-class:: classref-property-setget
  84. - |void| **set_alignment_horizontal**\ (\ value\: :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>`\ )
  85. - :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **get_alignment_horizontal**\ (\ )
  86. Specifies the horizontal relative position of child controls.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_AspectRatioContainer_property_alignment_vertical:
  90. .. rst-class:: classref-property
  91. :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **alignment_vertical** = ``1`` :ref:`🔗<class_AspectRatioContainer_property_alignment_vertical>`
  92. .. rst-class:: classref-property-setget
  93. - |void| **set_alignment_vertical**\ (\ value\: :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>`\ )
  94. - :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **get_alignment_vertical**\ (\ )
  95. Specifies the vertical relative position of child controls.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_AspectRatioContainer_property_ratio:
  99. .. rst-class:: classref-property
  100. :ref:`float<class_float>` **ratio** = ``1.0`` :ref:`🔗<class_AspectRatioContainer_property_ratio>`
  101. .. rst-class:: classref-property-setget
  102. - |void| **set_ratio**\ (\ value\: :ref:`float<class_float>`\ )
  103. - :ref:`float<class_float>` **get_ratio**\ (\ )
  104. 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>`.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_AspectRatioContainer_property_stretch_mode:
  108. .. rst-class:: classref-property
  109. :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **stretch_mode** = ``2`` :ref:`🔗<class_AspectRatioContainer_property_stretch_mode>`
  110. .. rst-class:: classref-property-setget
  111. - |void| **set_stretch_mode**\ (\ value\: :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>`\ )
  112. - :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **get_stretch_mode**\ (\ )
  113. The stretch mode used to align child controls.
  114. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  115. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  116. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  117. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  118. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  119. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  120. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  121. .. |void| replace:: :abbr:`void (No return value.)`