diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 44d84b4038d..af6bbb6dc50 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -895,6 +895,10 @@ Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. Also controls whether the control can receive the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what each does. + + Enables whether input should propagate when you close the control as modal. + If [code]false[/code], stops event handling at the viewport input event handling. The viewport first hides the modal and after marks the input as handled. + Enables whether rendering of [CanvasItem] based children should be clipped to this control's rectangle. If [code]true[/code], parts of a child which would be visibly outside of this control's rectangle will not be rendered. diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index f2b89e19366..6c38b164551 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2613,7 +2613,7 @@ void Control::set_pass_on_modal_close_click(bool p_pass_on) { data.pass_on_modal_close_click = p_pass_on; } -bool Control::pass_on_modal_close_click() const { +bool Control::get_pass_on_modal_close_click() const { return data.pass_on_modal_close_click; } @@ -2941,6 +2941,9 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mouse_filter", "filter"), &Control::set_mouse_filter); ClassDB::bind_method(D_METHOD("get_mouse_filter"), &Control::get_mouse_filter); + ClassDB::bind_method(D_METHOD("set_pass_on_modal_close_click", "enabled"), &Control::set_pass_on_modal_close_click); + ClassDB::bind_method(D_METHOD("get_pass_on_modal_close_click"), &Control::get_pass_on_modal_close_click); + ClassDB::bind_method(D_METHOD("set_clip_contents", "enable"), &Control::set_clip_contents); ClassDB::bind_method(D_METHOD("is_clipping_contents"), &Control::is_clipping_contents); @@ -3013,6 +3016,9 @@ void Control::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertical split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape"); + ADD_GROUP("Input", "input_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "input_pass_on_modal_close_click"), "set_pass_on_modal_close_click", "get_pass_on_modal_close_click"); + ADD_GROUP("Size Flags", "size_flags_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_h_size_flags", "get_h_size_flags"); ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_vertical", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_v_size_flags", "get_v_size_flags"); diff --git a/scene/gui/control.h b/scene/gui/control.h index 3d47e7ce5ee..3a04c14a9e1 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -416,7 +416,7 @@ public: MouseFilter get_mouse_filter() const; void set_pass_on_modal_close_click(bool p_pass_on); - bool pass_on_modal_close_click() const; + bool get_pass_on_modal_close_click() const; /* SKINNING */ diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 4abf019c1c7..07ee5253b46 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1951,7 +1951,7 @@ void Viewport::_gui_input_event(Ref p_event) { top->_modal_stack_remove(); top->hide(); - if (!top->pass_on_modal_close_click()) { + if (!top->get_pass_on_modal_close_click()) { is_handled = true; } } else {