BaseButton.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="BaseButton" inherits="Control" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. Base class for different kinds of buttons.
  5. </brief_description>
  6. <description>
  7. BaseButton is the abstract base class for buttons, so it shouldn't be used directly (it doesn't display anything). Other types of buttons inherit from it.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="_pressed" qualifiers="virtual">
  15. <return type="void">
  16. </return>
  17. <description>
  18. Called when button is pressed.
  19. </description>
  20. </method>
  21. <method name="_toggled" qualifiers="virtual">
  22. <return type="void">
  23. </return>
  24. <argument index="0" name="pressed" type="bool">
  25. </argument>
  26. <description>
  27. Called when button is toggled (only if toggle_mode is active).
  28. </description>
  29. </method>
  30. <method name="get_action_mode" qualifiers="const">
  31. <return type="int" enum="BaseButton.ActionMode">
  32. </return>
  33. <description>
  34. Return the current mode of action (see [method set_action_mode]) (one of the ACTION_MODE_* constants).
  35. </description>
  36. </method>
  37. <method name="get_button_group" qualifiers="const">
  38. <return type="ButtonGroup">
  39. </return>
  40. <description>
  41. </description>
  42. </method>
  43. <method name="get_draw_mode" qualifiers="const">
  44. <return type="int" enum="BaseButton.DrawMode">
  45. </return>
  46. <description>
  47. Return the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the button is defined by the DRAW_* enum.
  48. </description>
  49. </method>
  50. <method name="get_enabled_focus_mode" qualifiers="const">
  51. <return type="int" enum="Control.FocusMode">
  52. </return>
  53. <description>
  54. Returns focus access mode used when switching between enabled/disabled (see [method Control.set_focus_mode] and [method set_disabled]).
  55. </description>
  56. </method>
  57. <method name="get_shortcut" qualifiers="const">
  58. <return type="ShortCut">
  59. </return>
  60. <description>
  61. </description>
  62. </method>
  63. <method name="is_disabled" qualifiers="const">
  64. <return type="bool">
  65. </return>
  66. <description>
  67. Return whether the button is in disabled state (see [method set_disabled]).
  68. </description>
  69. </method>
  70. <method name="is_hovered" qualifiers="const">
  71. <return type="bool">
  72. </return>
  73. <description>
  74. Return true if mouse entered the button before it exit.
  75. </description>
  76. </method>
  77. <method name="is_pressed" qualifiers="const">
  78. <return type="bool">
  79. </return>
  80. <description>
  81. If toggle_mode is active, return whether the button is toggled. If toggle_mode is not active, return whether the button is pressed down.
  82. </description>
  83. </method>
  84. <method name="is_toggle_mode" qualifiers="const">
  85. <return type="bool">
  86. </return>
  87. <description>
  88. Return the toggle_mode property (see [method set_toggle_mode]).
  89. </description>
  90. </method>
  91. <method name="set_action_mode">
  92. <return type="void">
  93. </return>
  94. <argument index="0" name="mode" type="int" enum="BaseButton.ActionMode">
  95. </argument>
  96. <description>
  97. Set the current mode of action, determining when the button is considered clicked (see the ACTION_MODE_* constants).
  98. </description>
  99. </method>
  100. <method name="set_button_group">
  101. <return type="void">
  102. </return>
  103. <argument index="0" name="button_group" type="ButtonGroup">
  104. </argument>
  105. <description>
  106. </description>
  107. </method>
  108. <method name="set_disabled">
  109. <return type="void">
  110. </return>
  111. <argument index="0" name="disabled" type="bool">
  112. </argument>
  113. <description>
  114. Set the button into disabled state. When a button is disabled, it can't be clicked or toggled.
  115. </description>
  116. </method>
  117. <method name="set_enabled_focus_mode">
  118. <return type="void">
  119. </return>
  120. <argument index="0" name="mode" type="int" enum="Control.FocusMode">
  121. </argument>
  122. <description>
  123. Sets the focus access mode to use when switching between enabled/disabled (see [method Control.set_focus_mode] and [method set_disabled]).
  124. </description>
  125. </method>
  126. <method name="set_pressed">
  127. <return type="void">
  128. </return>
  129. <argument index="0" name="pressed" type="bool">
  130. </argument>
  131. <description>
  132. Set the button to pressed state (only if toggle_mode is active).
  133. </description>
  134. </method>
  135. <method name="set_shortcut">
  136. <return type="void">
  137. </return>
  138. <argument index="0" name="shortcut" type="ShortCut">
  139. </argument>
  140. <description>
  141. </description>
  142. </method>
  143. <method name="set_toggle_mode">
  144. <return type="void">
  145. </return>
  146. <argument index="0" name="enabled" type="bool">
  147. </argument>
  148. <description>
  149. Set the button toggle_mode property. Toggle mode makes the button flip state between pressed and unpressed each time its area is clicked.
  150. </description>
  151. </method>
  152. </methods>
  153. <members>
  154. <member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="BaseButton.ActionMode">
  155. Determines when the button is considered clicked, one of the ACTION_MODE_* constants.
  156. </member>
  157. <member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
  158. If [code]true[/code] the button is in disabled state and can't be clicked or toggled.
  159. </member>
  160. <member name="enabled_focus_mode" type="int" setter="set_enabled_focus_mode" getter="get_enabled_focus_mode" enum="Control.FocusMode">
  161. Focus access mode to use when switching between enabled/disabled (see [method Control.set_focus_mode] and [member disabled]).
  162. </member>
  163. <member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
  164. [ButtonGroup] associated to the button.
  165. </member>
  166. <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
  167. If [code]true[/code] the button's state is pressed. Means the button is pressed down or toggled (if toggle_mode is active).
  168. </member>
  169. <member name="shortcut" type="ShortCut" setter="set_shortcut" getter="get_shortcut">
  170. [Shortcut] associated to the button.
  171. </member>
  172. <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode">
  173. If [code]true[/code] the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.
  174. </member>
  175. </members>
  176. <signals>
  177. <signal name="button_down">
  178. <description>
  179. Emitted when the button starts being held down.
  180. </description>
  181. </signal>
  182. <signal name="button_up">
  183. <description>
  184. Emitted when the button stops being held down.
  185. </description>
  186. </signal>
  187. <signal name="pressed">
  188. <description>
  189. This signal is emitted every time the button is toggled or pressed (i.e. activated, so on [code]button_down[/code] if "Click on press" is active and on [code]button_up[/code] otherwise).
  190. </description>
  191. </signal>
  192. <signal name="toggled">
  193. <argument index="0" name="pressed" type="bool">
  194. </argument>
  195. <description>
  196. This signal is emitted when the button was just toggled between pressed and normal states (only if toggle_mode is active). The new state is contained in the [i]pressed[/i] argument.
  197. </description>
  198. </signal>
  199. </signals>
  200. <constants>
  201. <constant name="DRAW_NORMAL" value="0">
  202. The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons.
  203. </constant>
  204. <constant name="DRAW_PRESSED" value="1">
  205. The state of buttons are pressed.
  206. </constant>
  207. <constant name="DRAW_HOVER" value="2">
  208. The state of buttons are hovered.
  209. </constant>
  210. <constant name="DRAW_DISABLED" value="3">
  211. The state of buttons are disabled.
  212. </constant>
  213. <constant name="ACTION_MODE_BUTTON_PRESS" value="0">
  214. Require just a press to consider the button clicked.
  215. </constant>
  216. <constant name="ACTION_MODE_BUTTON_RELEASE" value="1">
  217. Require a press and a subsequent release before considering the button clicked.
  218. </constant>
  219. </constants>
  220. </class>