Allow to get a list of visible embedded `Window`s
This commit is contained in:
parent
90f90cbcb0
commit
de27df5da3
|
@ -52,6 +52,13 @@
|
|||
Returns an individual bit on the rendering layer mask.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_embedded_subwindows" qualifiers="const">
|
||||
<return type="Window[]" />
|
||||
<description>
|
||||
Returns a list of the visible embedded [Window]s inside the viewport.
|
||||
[b]Note:[/b] [Window]s inside other viewports will not be listed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_final_transform" qualifiers="const">
|
||||
<return type="Transform2D" />
|
||||
<description>
|
||||
|
|
|
@ -2439,6 +2439,7 @@ Window *Viewport::get_base_window() const {
|
|||
|
||||
return w;
|
||||
}
|
||||
|
||||
void Viewport::_gui_remove_focus_for_window(Node *p_window) {
|
||||
if (get_base_window() == p_window) {
|
||||
gui_release_focus();
|
||||
|
@ -3656,6 +3657,15 @@ bool Viewport::is_embedding_subwindows() const {
|
|||
return gui.embed_subwindows_hint;
|
||||
}
|
||||
|
||||
TypedArray<Window> Viewport::get_embedded_subwindows() const {
|
||||
TypedArray<Window> windows;
|
||||
for (int i = 0; i < gui.sub_windows.size(); i++) {
|
||||
windows.append(gui.sub_windows[i].window);
|
||||
}
|
||||
|
||||
return windows;
|
||||
}
|
||||
|
||||
void Viewport::subwindow_set_popup_safe_rect(Window *p_window, const Rect2i &p_rect) {
|
||||
int index = _sub_window_find(p_window);
|
||||
ERR_FAIL_COND(index == -1);
|
||||
|
@ -4384,6 +4394,7 @@ void Viewport::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("set_embedding_subwindows", "enable"), &Viewport::set_embedding_subwindows);
|
||||
ClassDB::bind_method(D_METHOD("is_embedding_subwindows"), &Viewport::is_embedding_subwindows);
|
||||
ClassDB::bind_method(D_METHOD("get_embedded_subwindows"), &Viewport::get_embedded_subwindows);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_canvas_cull_mask", "mask"), &Viewport::set_canvas_cull_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_canvas_cull_mask"), &Viewport::get_canvas_cull_mask);
|
||||
|
|
|
@ -653,6 +653,7 @@ public:
|
|||
|
||||
void set_embedding_subwindows(bool p_embed);
|
||||
bool is_embedding_subwindows() const;
|
||||
TypedArray<Window> get_embedded_subwindows() const;
|
||||
void subwindow_set_popup_safe_rect(Window *p_window, const Rect2i &p_rect);
|
||||
Rect2i subwindow_get_popup_safe_rect(Window *p_window) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue