class_margincontainer.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. :github_url: hide
  2. .. meta::
  3. :keywords: padding
  4. .. DO NOT EDIT THIS FILE!!!
  5. .. Generated automatically from Godot engine sources.
  6. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  7. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/MarginContainer.xml.
  8. .. _class_MarginContainer:
  9. MarginContainer
  10. ===============
  11. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  12. **Inherited By:** :ref:`EditorDock<class_EditorDock>`
  13. A container that keeps a margin around its child controls.
  14. .. rst-class:: classref-introduction-group
  15. Description
  16. -----------
  17. **MarginContainer** adds an adjustable margin on each side of its child controls. The margins are added around all children, not around each individual one. To control the **MarginContainer**'s margins, use the ``margin_*`` theme properties listed below.
  18. \ **Note:** The margin sizes are theme overrides, not normal properties. This is an example of how to change them in code:
  19. .. tabs::
  20. .. code-tab:: gdscript
  21. # This code sample assumes the current script is extending MarginContainer.
  22. var margin_value = 100
  23. add_theme_constant_override("margin_top", margin_value)
  24. add_theme_constant_override("margin_left", margin_value)
  25. add_theme_constant_override("margin_bottom", margin_value)
  26. add_theme_constant_override("margin_right", margin_value)
  27. .. code-tab:: csharp
  28. // This code sample assumes the current script is extending MarginContainer.
  29. int marginValue = 100;
  30. AddThemeConstantOverride("margin_top", marginValue);
  31. AddThemeConstantOverride("margin_left", marginValue);
  32. AddThemeConstantOverride("margin_bottom", marginValue);
  33. AddThemeConstantOverride("margin_right", marginValue);
  34. .. rst-class:: classref-introduction-group
  35. Tutorials
  36. ---------
  37. - :doc:`Using Containers <../tutorials/ui/gui_containers>`
  38. .. rst-class:: classref-reftable-group
  39. Theme Properties
  40. ----------------
  41. .. table::
  42. :widths: auto
  43. +-----------------------+--------------------------------------------------------------------------+-------+
  44. | :ref:`int<class_int>` | :ref:`margin_bottom<class_MarginContainer_theme_constant_margin_bottom>` | ``0`` |
  45. +-----------------------+--------------------------------------------------------------------------+-------+
  46. | :ref:`int<class_int>` | :ref:`margin_left<class_MarginContainer_theme_constant_margin_left>` | ``0`` |
  47. +-----------------------+--------------------------------------------------------------------------+-------+
  48. | :ref:`int<class_int>` | :ref:`margin_right<class_MarginContainer_theme_constant_margin_right>` | ``0`` |
  49. +-----------------------+--------------------------------------------------------------------------+-------+
  50. | :ref:`int<class_int>` | :ref:`margin_top<class_MarginContainer_theme_constant_margin_top>` | ``0`` |
  51. +-----------------------+--------------------------------------------------------------------------+-------+
  52. .. rst-class:: classref-section-separator
  53. ----
  54. .. rst-class:: classref-descriptions-group
  55. Theme Property Descriptions
  56. ---------------------------
  57. .. _class_MarginContainer_theme_constant_margin_bottom:
  58. .. rst-class:: classref-themeproperty
  59. :ref:`int<class_int>` **margin_bottom** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_bottom>`
  60. Offsets towards the inside direct children of the container by this amount of pixels from the bottom.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_MarginContainer_theme_constant_margin_left:
  64. .. rst-class:: classref-themeproperty
  65. :ref:`int<class_int>` **margin_left** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_left>`
  66. Offsets towards the inside direct children of the container by this amount of pixels from the left.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_MarginContainer_theme_constant_margin_right:
  70. .. rst-class:: classref-themeproperty
  71. :ref:`int<class_int>` **margin_right** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_right>`
  72. Offsets towards the inside direct children of the container by this amount of pixels from the right.
  73. .. rst-class:: classref-item-separator
  74. ----
  75. .. _class_MarginContainer_theme_constant_margin_top:
  76. .. rst-class:: classref-themeproperty
  77. :ref:`int<class_int>` **margin_top** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_top>`
  78. Offsets towards the inside direct children of the container by this amount of pixels from the top.
  79. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  80. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  81. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  82. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  83. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  84. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  85. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  86. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  87. .. |void| replace:: :abbr:`void (No return value.)`