StyleBoxFlat.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="StyleBoxFlat" inherits="StyleBox" version="3.4">
  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. </return>
  30. <argument index="0" name="margin" type="int" enum="Margin">
  31. </argument>
  32. <description>
  33. Returns the given [code]margin[/code]'s border width. See [enum Margin] for possible values.
  34. </description>
  35. </method>
  36. <method name="get_border_width_min" qualifiers="const">
  37. <return type="int">
  38. </return>
  39. <description>
  40. Returns the smallest border width out of all four borders.
  41. </description>
  42. </method>
  43. <method name="get_corner_radius" qualifiers="const">
  44. <return type="int">
  45. </return>
  46. <argument index="0" name="corner" type="int" enum="Corner">
  47. </argument>
  48. <description>
  49. Returns the given [code]corner[/code]'s radius. See [enum Corner] for possible values.
  50. </description>
  51. </method>
  52. <method name="get_expand_margin" qualifiers="const">
  53. <return type="float">
  54. </return>
  55. <argument index="0" name="margin" type="int" enum="Margin">
  56. </argument>
  57. <description>
  58. Returns the size of the given [code]margin[/code]'s expand margin. See [enum Margin] for possible values.
  59. </description>
  60. </method>
  61. <method name="set_border_width">
  62. <return type="void">
  63. </return>
  64. <argument index="0" name="margin" type="int" enum="Margin">
  65. </argument>
  66. <argument index="1" name="width" type="int">
  67. </argument>
  68. <description>
  69. Sets the border width to [code]width[/code] pixels for the given [code]margin[/code]. See [enum Margin] for possible values.
  70. </description>
  71. </method>
  72. <method name="set_border_width_all">
  73. <return type="void">
  74. </return>
  75. <argument index="0" name="width" type="int">
  76. </argument>
  77. <description>
  78. Sets the border width to [code]width[/code] pixels for all margins.
  79. </description>
  80. </method>
  81. <method name="set_corner_radius">
  82. <return type="void">
  83. </return>
  84. <argument index="0" name="corner" type="int" enum="Corner">
  85. </argument>
  86. <argument index="1" name="radius" type="int">
  87. </argument>
  88. <description>
  89. Sets the corner radius to [code]radius[/code] pixels for the given [code]corner[/code]. See [enum Corner] for possible values.
  90. </description>
  91. </method>
  92. <method name="set_corner_radius_all">
  93. <return type="void">
  94. </return>
  95. <argument index="0" name="radius" type="int">
  96. </argument>
  97. <description>
  98. Sets the corner radius to [code]radius[/code] pixels for all corners.
  99. </description>
  100. </method>
  101. <method name="set_corner_radius_individual">
  102. <return type="void">
  103. </return>
  104. <argument index="0" name="radius_top_left" type="int">
  105. </argument>
  106. <argument index="1" name="radius_top_right" type="int">
  107. </argument>
  108. <argument index="2" name="radius_bottom_right" type="int">
  109. </argument>
  110. <argument index="3" name="radius_bottom_left" type="int">
  111. </argument>
  112. <description>
  113. 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.
  114. </description>
  115. </method>
  116. <method name="set_expand_margin">
  117. <return type="void">
  118. </return>
  119. <argument index="0" name="margin" type="int" enum="Margin">
  120. </argument>
  121. <argument index="1" name="size" type="float">
  122. </argument>
  123. <description>
  124. Sets the expand margin to [code]size[/code] pixels for the given [code]margin[/code]. See [enum Margin] for possible values.
  125. </description>
  126. </method>
  127. <method name="set_expand_margin_all">
  128. <return type="void">
  129. </return>
  130. <argument index="0" name="size" type="float">
  131. </argument>
  132. <description>
  133. Sets the expand margin to [code]size[/code] pixels for all margins.
  134. </description>
  135. </method>
  136. <method name="set_expand_margin_individual">
  137. <return type="void">
  138. </return>
  139. <argument index="0" name="size_left" type="float">
  140. </argument>
  141. <argument index="1" name="size_top" type="float">
  142. </argument>
  143. <argument index="2" name="size_right" type="float">
  144. </argument>
  145. <argument index="3" name="size_bottom" type="float">
  146. </argument>
  147. <description>
  148. 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.
  149. </description>
  150. </method>
  151. </methods>
  152. <members>
  153. <member name="anti_aliasing" type="bool" setter="set_anti_aliased" getter="is_anti_aliased" default="true">
  154. 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.
  155. </member>
  156. <member name="anti_aliasing_size" type="int" setter="set_aa_size" getter="get_aa_size" default="1">
  157. This changes the size of the faded ring. Higher values can be used to achieve a "blurry" effect.
  158. </member>
  159. <member name="bg_color" type="Color" setter="set_bg_color" getter="get_bg_color" default="Color( 0.6, 0.6, 0.6, 1 )">
  160. The background color of the stylebox.
  161. </member>
  162. <member name="border_blend" type="bool" setter="set_border_blend" getter="get_border_blend" default="false">
  163. If [code]true[/code], the border will fade into the background color.
  164. </member>
  165. <member name="border_color" type="Color" setter="set_border_color" getter="get_border_color" default="Color( 0.8, 0.8, 0.8, 1 )">
  166. Sets the color of the border.
  167. </member>
  168. <member name="border_width_bottom" type="int" setter="set_border_width" getter="get_border_width" default="0">
  169. Border width for the bottom border.
  170. </member>
  171. <member name="border_width_left" type="int" setter="set_border_width" getter="get_border_width" default="0">
  172. Border width for the left border.
  173. </member>
  174. <member name="border_width_right" type="int" setter="set_border_width" getter="get_border_width" default="0">
  175. Border width for the right border.
  176. </member>
  177. <member name="border_width_top" type="int" setter="set_border_width" getter="get_border_width" default="0">
  178. Border width for the top border.
  179. </member>
  180. <member name="corner_detail" type="int" setter="set_corner_detail" getter="get_corner_detail" default="8">
  181. 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.
  182. 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.
  183. A corner detail of [code]1[/code] will result in chamfered corners instead of rounded corners, which is useful for some artistic effects.
  184. </member>
  185. <member name="corner_radius_bottom_left" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  186. The bottom-left corner's radius. If [code]0[/code], the corner is not rounded.
  187. </member>
  188. <member name="corner_radius_bottom_right" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  189. The bottom-right corner's radius. If [code]0[/code], the corner is not rounded.
  190. </member>
  191. <member name="corner_radius_top_left" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  192. The top-left corner's radius. If [code]0[/code], the corner is not rounded.
  193. </member>
  194. <member name="corner_radius_top_right" type="int" setter="set_corner_radius" getter="get_corner_radius" default="0">
  195. The top-right corner's radius. If [code]0[/code], the corner is not rounded.
  196. </member>
  197. <member name="draw_center" type="bool" setter="set_draw_center" getter="is_draw_center_enabled" default="true">
  198. Toggles drawing of the inner part of the stylebox.
  199. </member>
  200. <member name="expand_margin_bottom" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  201. 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.
  202. </member>
  203. <member name="expand_margin_left" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  204. 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.
  205. </member>
  206. <member name="expand_margin_right" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  207. 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.
  208. </member>
  209. <member name="expand_margin_top" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
  210. 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.
  211. </member>
  212. <member name="shadow_color" type="Color" setter="set_shadow_color" getter="get_shadow_color" default="Color( 0, 0, 0, 0.6 )">
  213. The color of the shadow. This has no effect if [member shadow_size] is lower than 1.
  214. </member>
  215. <member name="shadow_offset" type="Vector2" setter="set_shadow_offset" getter="get_shadow_offset" default="Vector2( 0, 0 )">
  216. The shadow offset in pixels. Adjusts the position of the shadow relatively to the stylebox.
  217. </member>
  218. <member name="shadow_size" type="int" setter="set_shadow_size" getter="get_shadow_size" default="0">
  219. The shadow size in pixels.
  220. </member>
  221. </members>
  222. <constants>
  223. </constants>
  224. </class>