class_popup.rst 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Popup.xml.
  6. .. _class_Popup:
  7. Popup
  8. =====
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`PopupDialog<class_PopupDialog>`, :ref:`PopupMenu<class_PopupMenu>`, :ref:`PopupPanel<class_PopupPanel>`, :ref:`WindowDialog<class_WindowDialog>`
  11. Base container control for popups and dialogs.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Popup is a base :ref:`Control<class_Control>` used to show dialogs and popups. It's a subwindow and modal by default (see :ref:`Control<class_Control>`) and has helpers for custom popup behavior. All popup methods ensure correct placement within the viewport.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`popup_exclusive<class_Popup_property_popup_exclusive>` | ``false`` |
  23. +-------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | visible | ``false`` (overrides :ref:`CanvasItem<class_CanvasItem_property_visible>`) |
  25. +-------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------+
  26. .. rst-class:: classref-reftable-group
  27. Methods
  28. -------
  29. .. table::
  30. :widths: auto
  31. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`popup<class_Popup_method_popup>` **(** :ref:`Rect2<class_Rect2>` bounds=Rect2( 0, 0, 0, 0 ) **)** |
  33. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`popup_centered<class_Popup_method_popup_centered>` **(** :ref:`Vector2<class_Vector2>` size=Vector2( 0, 0 ) **)** |
  35. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`popup_centered_clamped<class_Popup_method_popup_centered_clamped>` **(** :ref:`Vector2<class_Vector2>` size=Vector2( 0, 0 ), :ref:`float<class_float>` fallback_ratio=0.75 **)** |
  37. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`popup_centered_minsize<class_Popup_method_popup_centered_minsize>` **(** :ref:`Vector2<class_Vector2>` minsize=Vector2( 0, 0 ) **)** |
  39. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`popup_centered_ratio<class_Popup_method_popup_centered_ratio>` **(** :ref:`float<class_float>` ratio=0.75 **)** |
  41. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_as_minsize<class_Popup_method_set_as_minsize>` **(** **)** |
  43. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. .. rst-class:: classref-section-separator
  45. ----
  46. .. rst-class:: classref-descriptions-group
  47. Signals
  48. -------
  49. .. _class_Popup_signal_about_to_show:
  50. .. rst-class:: classref-signal
  51. **about_to_show** **(** **)**
  52. Emitted when a popup is about to be shown. This is often used in :ref:`PopupMenu<class_PopupMenu>` to clear the list of options then create a new one according to the current context.
  53. .. rst-class:: classref-item-separator
  54. ----
  55. .. _class_Popup_signal_popup_hide:
  56. .. rst-class:: classref-signal
  57. **popup_hide** **(** **)**
  58. Emitted when a popup is hidden.
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Constants
  63. ---------
  64. .. _class_Popup_constant_NOTIFICATION_POST_POPUP:
  65. .. rst-class:: classref-constant
  66. **NOTIFICATION_POST_POPUP** = ``80``
  67. Notification sent right after the popup is shown.
  68. .. _class_Popup_constant_NOTIFICATION_POPUP_HIDE:
  69. .. rst-class:: classref-constant
  70. **NOTIFICATION_POPUP_HIDE** = ``81``
  71. Notification sent right after the popup is hidden.
  72. .. rst-class:: classref-section-separator
  73. ----
  74. .. rst-class:: classref-descriptions-group
  75. Property Descriptions
  76. ---------------------
  77. .. _class_Popup_property_popup_exclusive:
  78. .. rst-class:: classref-property
  79. :ref:`bool<class_bool>` **popup_exclusive** = ``false``
  80. .. rst-class:: classref-property-setget
  81. - void **set_exclusive** **(** :ref:`bool<class_bool>` value **)**
  82. - :ref:`bool<class_bool>` **is_exclusive** **(** **)**
  83. If ``true``, the popup will not be hidden when a click event occurs outside of it, or when it receives the ``ui_cancel`` action event.
  84. \ **Note:** 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 :ref:`WindowDialog.get_close_button<class_WindowDialog_method_get_close_button>` or :ref:`ConfirmationDialog.get_cancel<class_ConfirmationDialog_method_get_cancel>` and hide the buttons in question by setting their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property to ``false``.
  85. .. rst-class:: classref-section-separator
  86. ----
  87. .. rst-class:: classref-descriptions-group
  88. Method Descriptions
  89. -------------------
  90. .. _class_Popup_method_popup:
  91. .. rst-class:: classref-method
  92. void **popup** **(** :ref:`Rect2<class_Rect2>` bounds=Rect2( 0, 0, 0, 0 ) **)**
  93. Popup (show the control in modal form).
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_Popup_method_popup_centered:
  97. .. rst-class:: classref-method
  98. void **popup_centered** **(** :ref:`Vector2<class_Vector2>` size=Vector2( 0, 0 ) **)**
  99. 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 ``size``.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _class_Popup_method_popup_centered_clamped:
  103. .. rst-class:: classref-method
  104. void **popup_centered_clamped** **(** :ref:`Vector2<class_Vector2>` size=Vector2( 0, 0 ), :ref:`float<class_float>` fallback_ratio=0.75 **)**
  105. Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, clamping the size to ``size``, then ensuring the popup is no larger than the viewport size multiplied by ``fallback_ratio``.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_Popup_method_popup_centered_minsize:
  109. .. rst-class:: classref-method
  110. void **popup_centered_minsize** **(** :ref:`Vector2<class_Vector2>` minsize=Vector2( 0, 0 ) **)**
  111. 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 ``minsize``.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_Popup_method_popup_centered_ratio:
  115. .. rst-class:: classref-method
  116. void **popup_centered_ratio** **(** :ref:`float<class_float>` ratio=0.75 **)**
  117. 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.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_Popup_method_set_as_minsize:
  121. .. rst-class:: classref-method
  122. void **set_as_minsize** **(** **)**
  123. Shrink popup to keep to the minimum size of content.
  124. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  125. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  126. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  127. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`