mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
48 lines
2.1 KiB
ReStructuredText
48 lines
2.1 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the MarginContainer.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_MarginContainer:
|
|
|
|
MarginContainer
|
|
===============
|
|
|
|
**Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
Simple margin container.
|
|
|
|
Description
|
|
-----------
|
|
|
|
Adds a top, left, bottom, and right margin to all :ref:`Control<class_Control>` nodes that are direct children of the container. To control the ``MarginContainer``'s margin, use the ``margin_*`` theme properties listed below.
|
|
|
|
**Note:** Be careful, :ref:`Control<class_Control>` margin values are different than the constant margin values. If you want to change the custom margin values of the ``MarginContainer`` by code, you should use the following examples:
|
|
|
|
::
|
|
|
|
# This code sample assumes the current script is extending MarginContainer.
|
|
var margin_value = 100
|
|
add_constant_override("margin_top", margin_value)
|
|
add_constant_override("margin_left", margin_value)
|
|
add_constant_override("margin_bottom", margin_value)
|
|
add_constant_override("margin_right", margin_value)
|
|
|
|
Theme Properties
|
|
----------------
|
|
|
|
+-----------------------+---------------+---+
|
|
| :ref:`int<class_int>` | margin_bottom | 0 |
|
|
+-----------------------+---------------+---+
|
|
| :ref:`int<class_int>` | margin_left | 0 |
|
|
+-----------------------+---------------+---+
|
|
| :ref:`int<class_int>` | margin_right | 0 |
|
|
+-----------------------+---------------+---+
|
|
| :ref:`int<class_int>` | margin_top | 0 |
|
|
+-----------------------+---------------+---+
|
|
|
|
.. |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.)`
|