class_stylebox.rst 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_StyleBox:
  4. StyleBox
  5. ========
  6. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`StyleBoxImageMask<class_styleboximagemask>`, :ref:`StyleBoxFlat<class_styleboxflat>`, :ref:`StyleBoxTexture<class_styleboxtexture>`, :ref:`StyleBoxEmpty<class_styleboxempty>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Base class for drawing stylized boxes for the UI.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`draw<class_StyleBox_draw>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect **)** const |
  16. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Vector2<class_vector2>` | :ref:`get_center_size<class_StyleBox_get_center_size>` **(** **)** const |
  18. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`float<class_float>` | :ref:`get_default_margin<class_StyleBox_get_default_margin>` **(** :ref:`int<class_int>` margin **)** const |
  20. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_margin<class_StyleBox_get_margin>` **(** :ref:`int<class_int>` margin **)** const |
  22. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Vector2<class_vector2>` | :ref:`get_minimum_size<class_StyleBox_get_minimum_size>` **(** **)** const |
  24. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_StyleBox_get_offset>` **(** **)** const |
  26. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_default_margin<class_StyleBox_set_default_margin>` **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` offset **)** |
  28. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`test_mask<class_StyleBox_test_mask>` **(** :ref:`Vector2<class_vector2>` point, :ref:`Rect2<class_rect2>` rect **)** const |
  30. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  31. Description
  32. -----------
  33. 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.
  34. Member Function Description
  35. ---------------------------
  36. .. _class_StyleBox_draw:
  37. - void **draw** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect **)** const
  38. .. _class_StyleBox_get_center_size:
  39. - :ref:`Vector2<class_vector2>` **get_center_size** **(** **)** const
  40. .. _class_StyleBox_get_default_margin:
  41. - :ref:`float<class_float>` **get_default_margin** **(** :ref:`int<class_int>` margin **)** const
  42. Return the default offset of the margin "margin" (see MARGIN\_\* enum) of a StyleBox, Controls that draw styleboxes with context inside need to know the margin, so the border of the stylebox is not occluded.
  43. .. _class_StyleBox_get_margin:
  44. - :ref:`float<class_float>` **get_margin** **(** :ref:`int<class_int>` margin **)** const
  45. Return the offset of margin "margin" (see MARGIN\_\* enum).
  46. .. _class_StyleBox_get_minimum_size:
  47. - :ref:`Vector2<class_vector2>` **get_minimum_size** **(** **)** const
  48. Return the minimum size that this stylebox can be shrunk to.
  49. .. _class_StyleBox_get_offset:
  50. - :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
  51. Return the "offset" of a stylebox, this is a helper function, like writing ``Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))``.
  52. .. _class_StyleBox_set_default_margin:
  53. - void **set_default_margin** **(** :ref:`int<class_int>` margin, :ref:`float<class_float>` offset **)**
  54. Set the default offset "offset" of the margin "margin" (see MARGIN\_\* enum) for a StyleBox, Controls that draw styleboxes with context inside need to know the margin, so the border of the stylebox is not occluded.
  55. .. _class_StyleBox_test_mask:
  56. - :ref:`bool<class_bool>` **test_mask** **(** :ref:`Vector2<class_vector2>` point, :ref:`Rect2<class_rect2>` rect **)** const
  57. Test a position in a rectangle, return whether it passes the mask test.