2
0

Signal.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Signal" version="4.0">
  3. <brief_description>
  4. Class representing a signal defined in an object.
  5. </brief_description>
  6. <description>
  7. </description>
  8. <tutorials>
  9. </tutorials>
  10. <constructors>
  11. <constructor name="Signal">
  12. <return type="Signal" />
  13. <description>
  14. Constructs a null [Signal] with no object nor signal name bound.
  15. </description>
  16. </constructor>
  17. <constructor name="Signal">
  18. <return type="Signal" />
  19. <argument index="0" name="from" type="Signal" />
  20. <description>
  21. Constructs a [Signal] as a copy of the given [Signal].
  22. </description>
  23. </constructor>
  24. <constructor name="Signal">
  25. <return type="Signal" />
  26. <argument index="0" name="object" type="Object" />
  27. <argument index="1" name="signal" type="StringName" />
  28. <description>
  29. Creates a new [Signal] with the name [code]signal[/code] in the specified [code]object[/code].
  30. </description>
  31. </constructor>
  32. </constructors>
  33. <methods>
  34. <method name="connect">
  35. <return type="int" />
  36. <argument index="0" name="callable" type="Callable" />
  37. <argument index="1" name="flags" type="int" default="0" />
  38. <description>
  39. Connects this signal to the specified [Callable], optionally providing connection flags. You can provide additional arguments to the connected method call by using [method Callable.bind].
  40. [codeblock]
  41. for button in $Buttons.get_children():
  42. button.pressed.connect(on_pressed.bind(button))
  43. func on_pressed(button):
  44. print(button.name, " was pressed")
  45. [/codeblock]
  46. </description>
  47. </method>
  48. <method name="disconnect">
  49. <return type="void" />
  50. <argument index="0" name="callable" type="Callable" />
  51. <description>
  52. Disconnects this signal from the specified [Callable].
  53. </description>
  54. </method>
  55. <method name="emit" qualifiers="vararg const">
  56. <return type="void" />
  57. <description>
  58. Emits this signal to all connected objects.
  59. </description>
  60. </method>
  61. <method name="get_connections" qualifiers="const">
  62. <return type="Array" />
  63. <description>
  64. Returns the list of [Callable]s connected to this signal.
  65. </description>
  66. </method>
  67. <method name="get_name" qualifiers="const">
  68. <return type="StringName" />
  69. <description>
  70. Returns the name of this signal.
  71. </description>
  72. </method>
  73. <method name="get_object" qualifiers="const">
  74. <return type="Object" />
  75. <description>
  76. Returns the object emitting this signal.
  77. </description>
  78. </method>
  79. <method name="get_object_id" qualifiers="const">
  80. <return type="int" />
  81. <description>
  82. Returns the ID of the object emitting this signal (see [method Object.get_instance_id]).
  83. </description>
  84. </method>
  85. <method name="is_connected" qualifiers="const">
  86. <return type="bool" />
  87. <argument index="0" name="callable" type="Callable" />
  88. <description>
  89. Returns [code]true[/code] if the specified [Callable] is connected to this signal.
  90. </description>
  91. </method>
  92. <method name="is_null" qualifiers="const">
  93. <return type="bool" />
  94. <description>
  95. </description>
  96. </method>
  97. </methods>
  98. <operators>
  99. <operator name="operator !=">
  100. <return type="bool" />
  101. <description>
  102. </description>
  103. </operator>
  104. <operator name="operator !=">
  105. <return type="bool" />
  106. <argument index="0" name="right" type="Signal" />
  107. <description>
  108. </description>
  109. </operator>
  110. <operator name="operator ==">
  111. <return type="bool" />
  112. <description>
  113. </description>
  114. </operator>
  115. <operator name="operator ==">
  116. <return type="bool" />
  117. <argument index="0" name="right" type="Signal" />
  118. <description>
  119. </description>
  120. </operator>
  121. </operators>
  122. </class>