class_stylebox.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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:`StyleBoxLine<class_styleboxline>`, :ref:`StyleBoxFlat<class_styleboxflat>`, :ref:`StyleBoxTexture<class_styleboxtexture>`, :ref:`StyleBoxEmpty<class_styleboxempty>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base class for drawing stylized boxes for the UI.
  13. Member Functions
  14. ----------------
  15. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`draw<class_StyleBox_draw>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect **)** const |
  17. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Vector2<class_vector2>` | :ref:`get_center_size<class_StyleBox_get_center_size>` **(** **)** const |
  19. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`get_margin<class_StyleBox_get_margin>` **(** :ref:`int<class_int>` margin **)** const |
  21. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Vector2<class_vector2>` | :ref:`get_minimum_size<class_StyleBox_get_minimum_size>` **(** **)** const |
  23. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_StyleBox_get_offset>` **(** **)** const |
  25. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`test_mask<class_StyleBox_test_mask>` **(** :ref:`Vector2<class_vector2>` point, :ref:`Rect2<class_rect2>` rect **)** const |
  27. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  28. Member Variables
  29. ----------------
  30. .. _class_StyleBox_content_margin_bottom:
  31. - :ref:`float<class_float>` **content_margin_bottom**
  32. .. _class_StyleBox_content_margin_left:
  33. - :ref:`float<class_float>` **content_margin_left**
  34. .. _class_StyleBox_content_margin_right:
  35. - :ref:`float<class_float>` **content_margin_right**
  36. .. _class_StyleBox_content_margin_top:
  37. - :ref:`float<class_float>` **content_margin_top**
  38. Description
  39. -----------
  40. 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.
  41. Member Function Description
  42. ---------------------------
  43. .. _class_StyleBox_draw:
  44. - void **draw** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect **)** const
  45. .. _class_StyleBox_get_center_size:
  46. - :ref:`Vector2<class_vector2>` **get_center_size** **(** **)** const
  47. .. _class_StyleBox_get_margin:
  48. - :ref:`float<class_float>` **get_margin** **(** :ref:`int<class_int>` margin **)** const
  49. Return the offset of margin "margin" (see MARGIN\_\* enum).
  50. .. _class_StyleBox_get_minimum_size:
  51. - :ref:`Vector2<class_vector2>` **get_minimum_size** **(** **)** const
  52. Return the minimum size that this stylebox can be shrunk to.
  53. .. _class_StyleBox_get_offset:
  54. - :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
  55. Return the "offset" of a stylebox, this is a helper function, like writing ``Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))``.
  56. .. _class_StyleBox_test_mask:
  57. - :ref:`bool<class_bool>` **test_mask** **(** :ref:`Vector2<class_vector2>` point, :ref:`Rect2<class_rect2>` rect **)** const
  58. Test a position in a rectangle, return whether it passes the mask test.