Popup.xml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Popup" inherits="Control" version="3.4">
  3. <brief_description>
  4. Base container control for popups and dialogs.
  5. </brief_description>
  6. <description>
  7. Popup is a base [Control] used to show dialogs and popups. It's a subwindow and modal by default (see [Control]) and has helpers for custom popup behavior. All popup methods ensure correct placement within the viewport.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="popup">
  13. <return type="void">
  14. </return>
  15. <argument index="0" name="bounds" type="Rect2" default="Rect2( 0, 0, 0, 0 )">
  16. </argument>
  17. <description>
  18. Popup (show the control in modal form).
  19. </description>
  20. </method>
  21. <method name="popup_centered">
  22. <return type="void">
  23. </return>
  24. <argument index="0" name="size" type="Vector2" default="Vector2( 0, 0 )">
  25. </argument>
  26. <description>
  27. Popup (show the control in modal form) in the center of the screen relative to its current canvas transform, at the current size, or at a size determined by [code]size[/code].
  28. </description>
  29. </method>
  30. <method name="popup_centered_clamped">
  31. <return type="void">
  32. </return>
  33. <argument index="0" name="size" type="Vector2" default="Vector2( 0, 0 )">
  34. </argument>
  35. <argument index="1" name="fallback_ratio" type="float" default="0.75">
  36. </argument>
  37. <description>
  38. Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, clamping the size to [code]size[/code], then ensuring the popup is no larger than the viewport size multiplied by [code]fallback_ratio[/code].
  39. </description>
  40. </method>
  41. <method name="popup_centered_minsize">
  42. <return type="void">
  43. </return>
  44. <argument index="0" name="minsize" type="Vector2" default="Vector2( 0, 0 )">
  45. </argument>
  46. <description>
  47. Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, ensuring the size is never smaller than [code]minsize[/code].
  48. </description>
  49. </method>
  50. <method name="popup_centered_ratio">
  51. <return type="void">
  52. </return>
  53. <argument index="0" name="ratio" type="float" default="0.75">
  54. </argument>
  55. <description>
  56. Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, scaled at a ratio of size of the screen.
  57. </description>
  58. </method>
  59. <method name="set_as_minsize">
  60. <return type="void">
  61. </return>
  62. <description>
  63. Shrink popup to keep to the minimum size of content.
  64. </description>
  65. </method>
  66. </methods>
  67. <members>
  68. <member name="popup_exclusive" type="bool" setter="set_exclusive" getter="is_exclusive" default="false">
  69. If [code]true[/code], the popup will not be hidden when a click event occurs outside of it, or when it receives the [code]ui_cancel[/code] action event.
  70. [b]Note:[/b] Enabling this property doesn't affect the Close or Cancel buttons' behavior in dialogs that inherit from this class. As a workaround, you can use [method WindowDialog.get_close_button] or [method ConfirmationDialog.get_cancel] and hide the buttons in question by setting their [member CanvasItem.visible] property to [code]false[/code].
  71. </member>
  72. <member name="visible" type="bool" setter="set_visible" getter="is_visible" override="true" default="false" />
  73. </members>
  74. <signals>
  75. <signal name="about_to_show">
  76. <description>
  77. Emitted when a popup is about to be shown. This is often used in [PopupMenu] to clear the list of options then create a new one according to the current context.
  78. </description>
  79. </signal>
  80. <signal name="popup_hide">
  81. <description>
  82. Emitted when a popup is hidden.
  83. </description>
  84. </signal>
  85. </signals>
  86. <constants>
  87. <constant name="NOTIFICATION_POST_POPUP" value="80">
  88. Notification sent right after the popup is shown.
  89. </constant>
  90. <constant name="NOTIFICATION_POPUP_HIDE" value="81">
  91. Notification sent right after the popup is hidden.
  92. </constant>
  93. </constants>
  94. </class>