summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-04-18 15:09:57 +0200
committerGitHub <noreply@github.com>2018-04-18 15:09:57 +0200
commit67cf812e455df9f95922fba3a2de90d33142a260 (patch)
tree04064622127ad2f234a85938401972643ea9df5e /scene
parenta2f26a96dc6a09eaba796c89f3bd17b9e73848a4 (diff)
parent3f837a623f198dc458635a9d264f21219d0fa534 (diff)
Merge pull request #18161 from flashyincceo/fixing-bug-#18128
Add popup_closed signal for ColorPickerButton
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/color_picker.cpp9
-rw-r--r--scene/gui/color_picker.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 31be18612f..6f34f3e49f 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -660,6 +660,11 @@ void ColorPickerButton::_color_changed(const Color &p_color) {
emit_signal("color_changed", p_color);
}
+void ColorPickerButton::_modal_closed() {
+
+ emit_signal("popup_closed");
+}
+
void ColorPickerButton::pressed() {
popup->set_position(get_global_position() - picker->get_combined_minimum_size());
@@ -722,8 +727,10 @@ void ColorPickerButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPickerButton::set_edit_alpha);
ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPickerButton::is_editing_alpha);
ClassDB::bind_method(D_METHOD("_color_changed"), &ColorPickerButton::_color_changed);
+ ClassDB::bind_method(D_METHOD("_modal_closed"), &ColorPickerButton::_modal_closed);
ADD_SIGNAL(MethodInfo("color_changed", PropertyInfo(Variant::COLOR, "color")));
+ ADD_SIGNAL(MethodInfo("popup_closed"));
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha");
}
@@ -735,5 +742,7 @@ ColorPickerButton::ColorPickerButton() {
popup->add_child(picker);
picker->connect("color_changed", this, "_color_changed");
+ popup->connect("modal_closed", this, "_modal_closed");
+
add_child(popup);
}
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 40ded4fff5..7d1a554ada 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -120,6 +120,8 @@ class ColorPickerButton : public Button {
ColorPicker *picker;
void _color_changed(const Color &p_color);
+ void _modal_closed();
+
virtual void pressed();
protected: