summaryrefslogtreecommitdiff
path: root/scene/gui/control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r--scene/gui/control.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 582c8e5860..9f715be155 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -810,6 +810,10 @@ void Control::set_drag_preview(Control *p_control) {
get_viewport()->_gui_set_drag_preview(this, p_control);
}
+bool Control::is_drag_successful() const {
+ return is_inside_tree() && get_viewport()->gui_is_drag_successful();
+}
+
void Control::_call_gui_input(const Ref<InputEvent> &p_event) {
emit_signal(SceneStringNames::get_singleton()->gui_input, p_event); //signal should be first, so it's possible to override an event (and then accept it)
if (!is_inside_tree() || get_viewport()->is_input_handled()) {
@@ -1821,6 +1825,10 @@ Size2 Control::get_size() const {
return data.size_cache;
}
+void Control::reset_size() {
+ set_size(Size2());
+}
+
Rect2 Control::get_global_rect() const {
return Rect2(get_global_position(), get_size());
}
@@ -2841,6 +2849,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_position", "position", "keep_offsets"), &Control::set_position, DEFVAL(false));
ClassDB::bind_method(D_METHOD("_set_position", "position"), &Control::_set_position);
ClassDB::bind_method(D_METHOD("set_size", "size", "keep_offsets"), &Control::set_size, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("reset_size"), &Control::reset_size);
ClassDB::bind_method(D_METHOD("_set_size", "size"), &Control::_set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
ClassDB::bind_method(D_METHOD("set_global_position", "position", "keep_offsets"), &Control::set_global_position, DEFVAL(false));
@@ -2964,6 +2973,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target"), &Control::set_drag_forwarding);
ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview);
+ ClassDB::bind_method(D_METHOD("is_drag_successful"), &Control::is_drag_successful);
ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Control::warp_mouse);