summaryrefslogtreecommitdiff
path: root/scene/gui/popup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/popup.cpp')
-rw-r--r--scene/gui/popup.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 60ecd775f7..1f0daa99ba 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -226,12 +226,16 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
}
-void Popup::popup() {
+void Popup::popup(const Rect2& bounds) {
emit_signal("about_to_show");
show_modal(exclusive);
-
+ // Fit the popup into the optionally provided bounds.
+ if (!bounds.has_no_area()) {
+ set_pos(bounds.pos);
+ set_size(bounds.size);
+ }
_fix_size();
Control *focusable = find_next_valid_focus();
@@ -260,7 +264,7 @@ void Popup::_bind_methods() {
ClassDB::bind_method(D_METHOD("popup_centered","size"),&Popup::popup_centered,DEFVAL(Size2()));
ClassDB::bind_method(D_METHOD("popup_centered_ratio","ratio"),&Popup::popup_centered_ratio,DEFVAL(0.75));
ClassDB::bind_method(D_METHOD("popup_centered_minsize","minsize"),&Popup::popup_centered_minsize,DEFVAL(Size2()));
- ClassDB::bind_method(D_METHOD("popup"),&Popup::popup);
+ ClassDB::bind_method(D_METHOD("popup","bounds"),&Popup::popup,DEFVAL(Rect2()));
ClassDB::bind_method(D_METHOD("set_exclusive","enable"),&Popup::set_exclusive);
ClassDB::bind_method(D_METHOD("is_exclusive"),&Popup::is_exclusive);
ADD_SIGNAL( MethodInfo("about_to_show") );