class_margincontainer.rst 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the MarginContainer.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_MarginContainer:
  6. MarginContainer
  7. ===============
  8. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Simple margin container.
  10. Description
  11. -----------
  12. 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.
  13. **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:
  14. ::
  15. # This code sample assumes the current script is extending MarginContainer.
  16. var margin_value = 100
  17. add_constant_override("margin_top", margin_value)
  18. add_constant_override("margin_left", margin_value)
  19. add_constant_override("margin_bottom", margin_value)
  20. add_constant_override("margin_right", margin_value)
  21. Theme Properties
  22. ----------------
  23. +-----------------------+--------------------------------------------------------------------------+-------+
  24. | :ref:`int<class_int>` | :ref:`margin_bottom<class_MarginContainer_theme_constant_margin_bottom>` | ``0`` |
  25. +-----------------------+--------------------------------------------------------------------------+-------+
  26. | :ref:`int<class_int>` | :ref:`margin_left<class_MarginContainer_theme_constant_margin_left>` | ``0`` |
  27. +-----------------------+--------------------------------------------------------------------------+-------+
  28. | :ref:`int<class_int>` | :ref:`margin_right<class_MarginContainer_theme_constant_margin_right>` | ``0`` |
  29. +-----------------------+--------------------------------------------------------------------------+-------+
  30. | :ref:`int<class_int>` | :ref:`margin_top<class_MarginContainer_theme_constant_margin_top>` | ``0`` |
  31. +-----------------------+--------------------------------------------------------------------------+-------+
  32. Theme Property Descriptions
  33. ---------------------------
  34. .. _class_MarginContainer_theme_constant_margin_bottom:
  35. - :ref:`int<class_int>` **margin_bottom**
  36. +-----------+-------+
  37. | *Default* | ``0`` |
  38. +-----------+-------+
  39. All direct children of ``MarginContainer`` will have a bottom margin of ``margin_bottom`` pixels.
  40. ----
  41. .. _class_MarginContainer_theme_constant_margin_left:
  42. - :ref:`int<class_int>` **margin_left**
  43. +-----------+-------+
  44. | *Default* | ``0`` |
  45. +-----------+-------+
  46. All direct children of ``MarginContainer`` will have a left margin of ``margin_left`` pixels.
  47. ----
  48. .. _class_MarginContainer_theme_constant_margin_right:
  49. - :ref:`int<class_int>` **margin_right**
  50. +-----------+-------+
  51. | *Default* | ``0`` |
  52. +-----------+-------+
  53. All direct children of ``MarginContainer`` will have a right margin of ``margin_right`` pixels.
  54. ----
  55. .. _class_MarginContainer_theme_constant_margin_top:
  56. - :ref:`int<class_int>` **margin_top**
  57. +-----------+-------+
  58. | *Default* | ``0`` |
  59. +-----------+-------+
  60. All direct children of ``MarginContainer`` will have a top margin of ``margin_top`` pixels.
  61. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  62. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  63. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`