StyleBoxFlat.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="StyleBoxFlat" inherits="StyleBox" version="4.0">
  3. <brief_description>
  4. Customizable [StyleBox] with a given set of parameters (no texture required).
  5. </brief_description>
  6. <description>
  7. This [StyleBox] can be used to achieve all kinds of looks without the need of a texture. The following properties are customizable:
  8. - Color
  9. - Border width (individual width for each border)
  10. - Rounded corners (individual radius for each corner)
  11. - Shadow (with blur and offset)
  12. Setting corner radius to high values is allowed. As soon as corners overlap, the stylebox will switch to a relative system. Example:
  13. [codeblock]
  14. height = 30
  15. corner_radius_top_left = 50
  16. corner_radius_bottom_left = 100
  17. [/codeblock]
  18. The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will [b]never[/b] be more than the height. Result:
  19. [codeblock]
  20. corner_radius_top_left: 10
  21. corner_radius_bottom_left: 20
  22. [/codeblock]
  23. </description>
  24. <tutorials>
  25. </tutorials>
  26. <methods>
  27. <method name="get_border_width" qualifiers="const">
  28. <return type="int" />
  29. <argument index="0" name="margin" type="int" enum="Side" />
  30. <description>
  31. Returns the specified [enum Side]'s border width.
  32. </description>
  33. </method>
  34. <method name="get_border_width_min" qualifiers="const">
  35. <return type="int" />
  36. <description>
  37. Returns the smallest border width out of all four borders.
  38. </description>
  39. </method>
  40. <method name="get_corner_radius" qualifiers="const">
  41. <return type="int" />
  42. <argument index="0" name="corner" type="int" enum="Corner" />
  43. <description>
  44. Returns the given [code]corner[/code]'s radius. See [enum Corner] for possible values.
  45. </description>
  46. </method>
  47. <method name="get_expand_margin" qualifiers="const">
  48. <return type="float" />
  49. <argument index="0" name="margin" type="int" enum="Side" />
  50. <description>
  51. Returns the size of the specified [enum Side]'s expand margin.
  52. </description>
  53. </method>
  54. <method name="set_border_width">
  55. <return type="void" />
  56. <argument index="0" name="margin" type="int" enum="Side" />
  57. <argument index="1" name="width" type="int" />
  58. <description>
  59. Sets the specified [enum Side]'s border width to [code]width[/code] pixels.
  60. </description>
  61. </method>
  62. <method name="set_border_width_all">
  63. <return type="void" />
  64. <argument index="0" name="width" type="int" />
  65. <description>
  66. Sets the border width to [code]width[/code] pixels for all sides.
  67. </description>
  68. </method>
  69. <method name="set_corner_radius">
  70. <return type="void" />
  71. <argument index="0" name="corner" type="int" enum="Corner" />
  72. <argument index="1" name="radius" type="int" />
  73. <description>
  74. Sets the corner radius to [code]radius[/code] pixels for the given [code]corner[/code]. See [enum Corner] for possible values.
  75. </description>
  76. </method>
  77. <method name="set_corner_radius_all">
  78. <return type="void" />
  79. <argument index="0" name="radius" type="int" />
  80. <description>
  81. Sets the corner radius to [code]radius[/code] pixels for all corners.
  82. </description>
  83. </method>
  84. <method name="set_corner_radius_individual">
  85. <return type="void" />
  86. <argument index="0" name="radius_top_left" type="int" />
  87. <argument index="1" name="radius_top_right" type="int" />
  88. <argument index="2" name="radius_bottom_right" type="int" />
  89. <argument index="3" name="radius_bottom_left" type="int" />
  90. <description>
  91. Sets the corner radius for each corner to [code]radius_top_left[/code], [code]radius_top_right[/code], [code]radius_bottom_right[/code], and [code]radius_bottom_left[/code] pixels.
  92. </description>
  93. </method>
  94. <method name="set_expand_margin">
  95. <return type="void" />
  96. <argument index="0" name="margin" type="int" enum="Side" />
  97. <argument index="1" name="size" type="float" />
  98. <description>
  99. Sets the expand margin to [code]size[/code] pixels for the specified [enum Side].
  100. </description>
  101. </method>
  102. <method name="set_expand_margin_all">
  103. <return type="void" />
  104. <argument index="0" name="size" type="float" />
  105. <description>
  106. Sets the expand margin to [code]size[/code] pixels for all margins.
  107. </description>
  108. </method>
  109. <method name="set_expand_margin_individual">
  110. <return type="void" />
  111. <argument index="0" name="size_left" type="float" />
  112. <argument index="1" name="size_top" type="float" />
  113. <argument index="2" name="size_right" type="float" />
  114. <argument index="3" name="size_bottom" type="float" />
  115. <description>
  116. Sets the expand margin for each margin to [code]size_left[/code], [code]size_top[/code], [code]size_right[/code], and [code]size_bottom[/code] pixels.
  117. </description>
  118. </method>
  119. </methods>
  120. <members>
  121. <member name="anti_aliasing" type="bool" setter="set_anti_aliased" getter="is_anti_aliased" default="true">
  122. Antialiasing draws a small ring around the edges, which fades to transparency. As a result, edges look much smoother. This is only noticeable when using rounded corners.
  123. [b]Note:[/b] When using beveled corners with 45-degree angles ([member corner_detail] = 1), it is recommended to set [member anti_aliasing] to [code]false[/code] to ensure crisp visuals and avoid possible visual glitches.
  124. </member>
  125. <member name="anti_aliasing_size" type="float" setter="set_aa_size" getter="get_aa_size" default="0.625">
  126. This changes the size of the faded ring. Higher values can be used to achieve a "blurry" effect.
  127. </member>
  128. <member name="bg_color" type="Color" setter="set_bg_color" getter="get_bg_color" default="Color(0.6, 0.6, 0.6, 1)">
  129. The background color of the stylebox.
  130. </member>
  131. <member name="border_blend" type="bool" setter="set_border_blend" getter="get_border_blend" default="false">
  132. If [code]true[/code], the border will fade into the background color.
  133. </member>
  134. <member name="border_color" type="Color" setter="set_border_color" getter="get_border_color" default="Color(0.8, 0.8, 0.8, 1)">
  135. Sets the color of the border.
  136. </member>
  137. <member name="border_width_bottom" type="int" setter="set_border_width" getter="get_border_width" default="0">
  138. Border width for the bottom border.
  139. </member>
  140. <member name="border_width_left" type="int" setter="set_border_width" getter="get_border_width" default="0">
  141. Border width for the left border.
  142. </member>
  143. <member name="border_width_right" type="int" setter="set_border_width" getter="get_border_width" default="0">
  144. Border width for the right border.
  145. </member>
  146. <member name="border_width_top" type="int" setter="set_border_width" getter="get_border_width" default="0">
  147. Border width for the top border.
  148. </member>
  149. <member name="corner_detail" type="int" setter="set_corner_detail" getter="get_corner_detail" default="8">
  150. This sets the number of vertices used for each corner. Higher values result in rounder corners but take more processing power to compute. When choosing a value, you should take the corner radius ([method set_corner_radius_all]) into account.
  151. For corner radii less than 10, [code]4[/code] or [code]5[/code] should be enough. For corner radii less than 30, values between [code]8[/code] and [code]12[/code] should be enough.
  152. A corner detail of [code]1[/code] will result in chamfered corners instead of rounded corners, which is useful for some artistic effects.
  153. </member>
  154. <member name="corner_radius_bottom_left" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  155. The bottom-left corner's radius. If [code]0[/code], the corner is not rounded.
  156. </member>
  157. <member name="corner_radius_bottom_right" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  158. The bottom-right corner's radius. If [code]0[/code], the corner is not rounded.
  159. </member>
  160. <member name="corner_radius_top_left" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  161. The top-left corner's radius. If [code]0[/code], the corner is not rounded.
  162. </member>
  163. <member name="corner_radius_top_right" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  164. The top-right corner's radius. If [code]0[/code], the corner is not rounded.
  165. </member>
  166. <member name="draw_center" type="bool" setter="set_draw_center" getter="is_draw_center_enabled" default="true">
  167. Toggles drawing of the inner part of the stylebox.
  168. </member>
  169. <member name="expand_margin_bottom" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  170. Expands the stylebox outside of the control rect on the bottom edge. Useful in combination with [member border_width_bottom] to draw a border outside the control rect.
  171. </member>
  172. <member name="expand_margin_left" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  173. Expands the stylebox outside of the control rect on the left edge. Useful in combination with [member border_width_left] to draw a border outside the control rect.
  174. </member>
  175. <member name="expand_margin_right" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  176. Expands the stylebox outside of the control rect on the right edge. Useful in combination with [member border_width_right] to draw a border outside the control rect.
  177. </member>
  178. <member name="expand_margin_top" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  179. Expands the stylebox outside of the control rect on the top edge. Useful in combination with [member border_width_top] to draw a border outside the control rect.
  180. </member>
  181. <member name="shadow_color" type="Color" setter="set_shadow_color" getter="get_shadow_color" default="Color(0, 0, 0, 0.6)">
  182. The color of the shadow. This has no effect if [member shadow_size] is lower than 1.
  183. </member>
  184. <member name="shadow_offset" type="Vector2" setter="set_shadow_offset" getter="get_shadow_offset" default="Vector2(0, 0)">
  185. The shadow offset in pixels. Adjusts the position of the shadow relatively to the stylebox.
  186. </member>
  187. <member name="shadow_size" type="int" setter="set_shadow_size" getter="get_shadow_size" default="0">
  188. The shadow size in pixels.
  189. </member>
  190. </members>
  191. </class>