summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-02-24 11:21:23 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-02-25 09:33:27 +0200
commit74ff5921d68ca09942d8988d5a78849b46d8583b (patch)
tree364847d2d52f728f6ed18de56d306fcbf53ad07d /doc/classes
parent80baa1386a5a19ed8ea50082617d2ae9112678fc (diff)
Improve popup window handling.
Add window FLAG_POPUP and a platform specific routines to control popup auto-hiding and event forwarding.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/DisplayServer.xml31
-rw-r--r--doc/classes/Popup.xml6
-rw-r--r--doc/classes/Window.xml6
3 files changed, 37 insertions, 6 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index be8811d629..5a67170086 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -544,6 +544,12 @@
<description>
</description>
</method>
+ <method name="window_get_active_popup" qualifiers="const">
+ <return type="int" />
+ <description>
+ Returns ID of the active popup window, or [constant INVALID_WINDOW_ID] if there is none.
+ </description>
+ </method>
<method name="window_get_attached_instance_id" qualifiers="const">
<return type="int" />
<argument index="0" name="window_id" type="int" default="0" />
@@ -592,6 +598,13 @@
[b]Note:[/b] This method is implemented on Android, Linux, macOS and Windows.
</description>
</method>
+ <method name="window_get_popup_safe_rect" qualifiers="const">
+ <return type="Rect2i" />
+ <argument index="0" name="window" type="int" />
+ <description>
+ Returns the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system.
+ </description>
+ </method>
<method name="window_get_position" qualifiers="const">
<return type="Vector2i" />
<argument index="0" name="window_id" type="int" default="0" />
@@ -749,6 +762,14 @@
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
</method>
+ <method name="window_set_popup_safe_rect">
+ <return type="void" />
+ <argument index="0" name="window" type="int" />
+ <argument index="1" name="rect" type="Rect2i" />
+ <description>
+ Sets the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system. Clicking this area will not auto-close this popup.
+ </description>
+ </method>
<method name="window_set_position">
<return type="void" />
<argument index="0" name="position" type="Vector2i" />
@@ -930,16 +951,24 @@
Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode.
</constant>
<constant name="WINDOW_FLAG_RESIZE_DISABLED" value="0" enum="WindowFlags">
+ Window can't be resizing by dragging its resize grip. It's still possible to resize the window using [method window_set_size]. This flag is ignored for full screen windows.
</constant>
<constant name="WINDOW_FLAG_BORDERLESS" value="1" enum="WindowFlags">
+ Window do not have native title bar and other decorations. This flag is ignored for full-screen windows.
</constant>
<constant name="WINDOW_FLAG_ALWAYS_ON_TOP" value="2" enum="WindowFlags">
+ Window is floating above other regular windows. This flag is ignored for full-screen windows.
</constant>
<constant name="WINDOW_FLAG_TRANSPARENT" value="3" enum="WindowFlags">
+ Window is will be destroyed with its transient parent and displayed on top of non-exclusive full-screen parent window. Transient windows can't enter full-screen mode.
</constant>
<constant name="WINDOW_FLAG_NO_FOCUS" value="4" enum="WindowFlags">
+ Window can't be focused. No-focus window will ignore all input, except mouse clicks.
+ </constant>
+ <constant name="WINDOW_FLAG_POPUP" value="5" enum="WindowFlags">
+ Window is part of menu or [OptionButton] dropdown. This flag can't be changed when window is visible. An active popup window will exclusivly receive all input, without stealing focus from its parent. Popup windows are automatically closed when uses click outside it, or when an application is switched. Popup window must have [constant WINDOW_FLAG_TRANSPARENT] set.
</constant>
- <constant name="WINDOW_FLAG_MAX" value="5" enum="WindowFlags">
+ <constant name="WINDOW_FLAG_MAX" value="6" enum="WindowFlags">
</constant>
<constant name="WINDOW_EVENT_MOUSE_ENTER" value="0" enum="WindowEvent">
</constant>
diff --git a/doc/classes/Popup.xml b/doc/classes/Popup.xml
index 06efadb071..3fcf0a9b8f 100644
--- a/doc/classes/Popup.xml
+++ b/doc/classes/Popup.xml
@@ -4,15 +4,13 @@
Popup is a base window container for popup-like subwindows.
</brief_description>
<description>
- Popup is a base window container for popup-like subwindows. It's a modal by default (see [member close_on_parent_focus]) and has helpers for custom popup behavior.
+ Popup is a base window container for popup-like subwindows. It's a modal by default (see [member popup_window]) and has helpers for custom popup behavior.
</description>
<tutorials>
</tutorials>
<members>
<member name="borderless" type="bool" setter="set_flag" getter="get_flag" overrides="Window" default="true" />
- <member name="close_on_parent_focus" type="bool" setter="set_close_on_parent_focus" getter="get_close_on_parent_focus" default="true">
- If true, the [Popup] will close when its parent [Window] is focused.
- </member>
+ <member name="popup_window" type="bool" setter="set_flag" getter="get_flag" overrides="Window" default="true" />
<member name="transient" type="bool" setter="set_transient" getter="is_transient" overrides="Window" default="true" />
<member name="unresizable" type="bool" setter="set_flag" getter="get_flag" overrides="Window" default="true" />
<member name="visible" type="bool" setter="set_visible" getter="is_visible" overrides="Window" default="false" />
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index 912d3cb16c..aa888a596a 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -306,6 +306,8 @@
Set's the window's current mode.
[b]Note:[/b] Fullscreen mode is not exclusive fullscreen on Windows and Linux.
</member>
+ <member name="popup_window" type="bool" setter="set_flag" getter="get_flag" default="false">
+ </member>
<member name="position" type="Vector2i" setter="set_position" getter="get_position" default="Vector2i(0, 0)">
The window's position in pixels.
</member>
@@ -416,7 +418,9 @@
</constant>
<constant name="FLAG_NO_FOCUS" value="4" enum="Flags">
</constant>
- <constant name="FLAG_MAX" value="5" enum="Flags">
+ <constant name="FLAG_POPUP" value="5" enum="Flags">
+ </constant>
+ <constant name="FLAG_MAX" value="6" enum="Flags">
</constant>
<constant name="CONTENT_SCALE_MODE_DISABLED" value="0" enum="ContentScaleMode">
</constant>