class_gridcontainer.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/GridContainer.xml.
  6. .. _class_GridContainer:
  7. GridContainer
  8. =============
  9. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Grid container used to arrange Control-derived children in a grid like layout.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. GridContainer will arrange its Control-derived children in a grid like structure, the grid columns are specified using the :ref:`columns<class_GridContainer_property_columns>` property and the number of rows will be equal to the number of children in the container divided by the number of columns. For example, if the container has 5 children, and 2 columns, there will be 3 rows in the container.
  15. Notice that grid layout will preserve the columns and rows for every size of the container, and that empty columns will be expanded automatically.
  16. \ **Note:** GridContainer only works with child nodes inheriting from Control. It won't rearrange child nodes inheriting from Node2D.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`GUI containers <../tutorials/ui/gui_containers>`
  21. - `OS Test Demo <https://godotengine.org/asset-library/asset/677>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +----------------------------------------------+------------------------------------------------------+-----------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`columns<class_GridContainer_property_columns>` | ``1`` |
  29. +----------------------------------------------+------------------------------------------------------+-----------------------------------------------------------------------+
  30. | :ref:`MouseFilter<enum_Control_MouseFilter>` | mouse_filter | ``1`` (overrides :ref:`Control<class_Control_property_mouse_filter>`) |
  31. +----------------------------------------------+------------------------------------------------------+-----------------------------------------------------------------------+
  32. .. rst-class:: classref-reftable-group
  33. Theme Properties
  34. ----------------
  35. .. table::
  36. :widths: auto
  37. +-----------------------+--------------------------------------------------------------------+-------+
  38. | :ref:`int<class_int>` | :ref:`hseparation<class_GridContainer_theme_constant_hseparation>` | ``4`` |
  39. +-----------------------+--------------------------------------------------------------------+-------+
  40. | :ref:`int<class_int>` | :ref:`vseparation<class_GridContainer_theme_constant_vseparation>` | ``4`` |
  41. +-----------------------+--------------------------------------------------------------------+-------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Property Descriptions
  46. ---------------------
  47. .. _class_GridContainer_property_columns:
  48. .. rst-class:: classref-property
  49. :ref:`int<class_int>` **columns** = ``1``
  50. .. rst-class:: classref-property-setget
  51. - void **set_columns** **(** :ref:`int<class_int>` value **)**
  52. - :ref:`int<class_int>` **get_columns** **(** **)**
  53. The number of columns in the **GridContainer**. If modified, **GridContainer** reorders its Control-derived children to accommodate the new layout.
  54. .. rst-class:: classref-section-separator
  55. ----
  56. .. rst-class:: classref-descriptions-group
  57. Theme Property Descriptions
  58. ---------------------------
  59. .. _class_GridContainer_theme_constant_hseparation:
  60. .. rst-class:: classref-themeproperty
  61. :ref:`int<class_int>` **hseparation** = ``4``
  62. The horizontal separation of children nodes.
  63. .. rst-class:: classref-item-separator
  64. ----
  65. .. _class_GridContainer_theme_constant_vseparation:
  66. .. rst-class:: classref-themeproperty
  67. :ref:`int<class_int>` **vseparation** = ``4``
  68. The vertical separation of children nodes.
  69. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  70. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  71. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  72. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`