SpinBox.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="SpinBox" inherits="Range" version="3.4">
  3. <brief_description>
  4. Numerical input text field.
  5. </brief_description>
  6. <description>
  7. SpinBox is a numerical input text field. It allows entering integers and floats.
  8. [b]Example:[/b]
  9. [codeblock]
  10. var spin_box = SpinBox.new()
  11. add_child(spin_box)
  12. var line_edit = spin_box.get_line_edit()
  13. line_edit.context_menu_enabled = false
  14. spin_box.align = LineEdit.ALIGN_RIGHT
  15. [/codeblock]
  16. The above code will create a [SpinBox], disable context menu on it and set the text alignment to right.
  17. See [Range] class for more options over the [SpinBox].
  18. [b]Note:[/b] [SpinBox] relies on an underlying [LineEdit] node. To theme a [SpinBox]'s background, add theme items for [LineEdit] and customize them.
  19. </description>
  20. <tutorials>
  21. </tutorials>
  22. <methods>
  23. <method name="apply">
  24. <return type="void">
  25. </return>
  26. <description>
  27. Applies the current value of this [SpinBox].
  28. </description>
  29. </method>
  30. <method name="get_line_edit">
  31. <return type="LineEdit">
  32. </return>
  33. <description>
  34. Returns the [LineEdit] instance from this [SpinBox]. You can use it to access properties and methods of [LineEdit].
  35. </description>
  36. </method>
  37. </methods>
  38. <members>
  39. <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0">
  40. Sets the text alignment of the [SpinBox].
  41. </member>
  42. <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true">
  43. If [code]true[/code], the [SpinBox] will be editable. Otherwise, it will be read only.
  44. </member>
  45. <member name="prefix" type="String" setter="set_prefix" getter="get_prefix" default="&quot;&quot;">
  46. Adds the specified [code]prefix[/code] string before the numerical value of the [SpinBox].
  47. </member>
  48. <member name="suffix" type="String" setter="set_suffix" getter="get_suffix" default="&quot;&quot;">
  49. Adds the specified [code]suffix[/code] string after the numerical value of the [SpinBox].
  50. </member>
  51. </members>
  52. <constants>
  53. </constants>
  54. <theme_items>
  55. <theme_item name="updown" type="Texture">
  56. Sets a custom [Texture] for up and down arrows of the [SpinBox].
  57. </theme_item>
  58. </theme_items>
  59. </class>