class_stylebox.rst 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the StyleBox.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_StyleBox:
  5. StyleBox
  6. ========
  7. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Inherited By:** :ref:`StyleBoxEmpty<class_StyleBoxEmpty>`, :ref:`StyleBoxFlat<class_StyleBoxFlat>`, :ref:`StyleBoxLine<class_StyleBoxLine>`, :ref:`StyleBoxTexture<class_StyleBoxTexture>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base class for drawing stylized boxes for the UI.
  13. Properties
  14. ----------
  15. +---------------------------+--------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`content_margin_bottom<class_StyleBox_content_margin_bottom>` |
  17. +---------------------------+--------------------------------------------------------------------+
  18. | :ref:`float<class_float>` | :ref:`content_margin_left<class_StyleBox_content_margin_left>` |
  19. +---------------------------+--------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`content_margin_right<class_StyleBox_content_margin_right>` |
  21. +---------------------------+--------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`content_margin_top<class_StyleBox_content_margin_top>` |
  23. +---------------------------+--------------------------------------------------------------------+
  24. Methods
  25. -------
  26. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`draw<class_StyleBox_draw>` **(** :ref:`RID<class_RID>` canvas_item, :ref:`Rect2<class_Rect2>` rect **)** const |
  28. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Vector2<class_Vector2>` | :ref:`get_center_size<class_StyleBox_get_center_size>` **(** **)** const |
  30. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`float<class_float>` | :ref:`get_margin<class_StyleBox_get_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** const |
  32. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Vector2<class_Vector2>` | :ref:`get_minimum_size<class_StyleBox_get_minimum_size>` **(** **)** const |
  34. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Vector2<class_Vector2>` | :ref:`get_offset<class_StyleBox_get_offset>` **(** **)** const |
  36. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`test_mask<class_StyleBox_test_mask>` **(** :ref:`Vector2<class_Vector2>` point, :ref:`Rect2<class_Rect2>` rect **)** const |
  38. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  39. Description
  40. -----------
  41. StyleBox is :ref:`Resource<class_Resource>` that provides an abstract base class for drawing stylized boxes for the UI. StyleBoxes are used for drawing the styles of buttons, line edit backgrounds, tree backgrounds, etc. and also for testing a transparency mask for pointer signals. If mask test fails on a StyleBox assigned as mask to a control, clicks and motion signals will go through it to the one below.
  42. Property Descriptions
  43. ---------------------
  44. .. _class_StyleBox_content_margin_bottom:
  45. - :ref:`float<class_float>` **content_margin_bottom**
  46. +----------+---------------------------+
  47. | *Setter* | set_default_margin(value) |
  48. +----------+---------------------------+
  49. | *Getter* | get_default_margin() |
  50. +----------+---------------------------+
  51. .. _class_StyleBox_content_margin_left:
  52. - :ref:`float<class_float>` **content_margin_left**
  53. +----------+---------------------------+
  54. | *Setter* | set_default_margin(value) |
  55. +----------+---------------------------+
  56. | *Getter* | get_default_margin() |
  57. +----------+---------------------------+
  58. .. _class_StyleBox_content_margin_right:
  59. - :ref:`float<class_float>` **content_margin_right**
  60. +----------+---------------------------+
  61. | *Setter* | set_default_margin(value) |
  62. +----------+---------------------------+
  63. | *Getter* | get_default_margin() |
  64. +----------+---------------------------+
  65. .. _class_StyleBox_content_margin_top:
  66. - :ref:`float<class_float>` **content_margin_top**
  67. +----------+---------------------------+
  68. | *Setter* | set_default_margin(value) |
  69. +----------+---------------------------+
  70. | *Getter* | get_default_margin() |
  71. +----------+---------------------------+
  72. Method Descriptions
  73. -------------------
  74. .. _class_StyleBox_draw:
  75. - void **draw** **(** :ref:`RID<class_RID>` canvas_item, :ref:`Rect2<class_Rect2>` rect **)** const
  76. .. _class_StyleBox_get_center_size:
  77. - :ref:`Vector2<class_Vector2>` **get_center_size** **(** **)** const
  78. .. _class_StyleBox_get_margin:
  79. - :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** const
  80. Return the offset of margin "margin" (see MARGIN\_\* enum).
  81. .. _class_StyleBox_get_minimum_size:
  82. - :ref:`Vector2<class_Vector2>` **get_minimum_size** **(** **)** const
  83. Return the minimum size that this stylebox can be shrunk to.
  84. .. _class_StyleBox_get_offset:
  85. - :ref:`Vector2<class_Vector2>` **get_offset** **(** **)** const
  86. Return the "offset" of a stylebox, this is a helper function, like writing ``Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))``.
  87. .. _class_StyleBox_test_mask:
  88. - :ref:`bool<class_bool>` **test_mask** **(** :ref:`Vector2<class_Vector2>` point, :ref:`Rect2<class_Rect2>` rect **)** const
  89. Test a position in a rectangle, return whether it passes the mask test.