0.2.0-dev Download ZIP
50 lines ·3.2 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AspectRatioContainer" inherits="Container" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A container that preserves the proportions of its child controls. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Using Containers">$DOCS_URL/tutorials/ui/gui_containers.html</link> |
| 11 | </tutorials> |
| 12 | <members> |
| 13 | <member name="alignment_horizontal" type="int" setter="set_alignment_horizontal" getter="get_alignment_horizontal" enum="AspectRatioContainer.AlignmentMode" default="1"> |
| 14 | Specifies the horizontal relative position of child controls. |
| 15 | </member> |
| 16 | <member name="alignment_vertical" type="int" setter="set_alignment_vertical" getter="get_alignment_vertical" enum="AspectRatioContainer.AlignmentMode" default="1"> |
| 17 | Specifies the vertical relative position of child controls. |
| 18 | </member> |
| 19 | <member name="ratio" type="float" setter="set_ratio" getter="get_ratio" default="1.0"> |
| 20 | The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the [member stretch_mode]. |
| 21 | </member> |
| 22 | <member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="AspectRatioContainer.StretchMode" default="2"> |
| 23 | The stretch mode used to align child controls. |
| 24 | </member> |
| 25 | </members> |
| 26 | <constants> |
| 27 | <constant name="STRETCH_WIDTH_CONTROLS_HEIGHT" value="0" enum="StretchMode"> |
| 28 | The height of child controls is automatically adjusted based on the width of the container. |
| 29 | </constant> |
| 30 | <constant name="STRETCH_HEIGHT_CONTROLS_WIDTH" value="1" enum="StretchMode"> |
| 31 | The width of child controls is automatically adjusted based on the height of the container. |
| 32 | </constant> |
| 33 | <constant name="STRETCH_FIT" value="2" enum="StretchMode"> |
| 34 | The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio. |
| 35 | </constant> |
| 36 | <constant name="STRETCH_COVER" value="3" enum="StretchMode"> |
| 37 | 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. |
| 38 | When the bounding rectangle of child controls exceed the container's size and [member Control.clip_contents] is enabled, this allows to show only the container's area restricted by its own bounding rectangle. |
| 39 | </constant> |
| 40 | <constant name="ALIGNMENT_BEGIN" value="0" enum="AlignmentMode"> |
| 41 | Aligns child controls with the beginning (left or top) of the container. |
| 42 | </constant> |
| 43 | <constant name="ALIGNMENT_CENTER" value="1" enum="AlignmentMode"> |
| 44 | Aligns child controls with the center of the container. |
| 45 | </constant> |
| 46 | <constant name="ALIGNMENT_END" value="2" enum="AlignmentMode"> |
| 47 | Aligns child controls with the end (right or bottom) of the container. |
| 48 | </constant> |
| 49 | </constants> |
| 50 | </class> |