From d6d0df4ba6cb7bc33ce9842a309e41fd3ac2289e Mon Sep 17 00:00:00 2001 From: RaXaR Date: Fri, 1 Dec 2017 22:58:53 +0200 Subject: [PATCH] Added get_popup() method to ColorPickerButton. This allows to check if the picker is open or not using Popup signals. Ammend: Added docs for the method. --- doc/classes/ColorPickerButton.xml | 7 +++++++ scene/gui/color_picker.cpp | 5 +++++ scene/gui/color_picker.h | 1 + 3 files changed, 13 insertions(+) diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index c538f66779f..460973e8641 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -17,6 +17,13 @@ + + + + + Returns the control's [PopupPanel] which allows you to connect to Popup Signals. This allows you to handle events when the ColorPicker is shown or hidden. + + diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index dbd7c1bbc0b..7a0593bc87d 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -664,11 +664,16 @@ ColorPicker *ColorPickerButton::get_picker() { return picker; } +PopupPanel *ColorPickerButton::get_popup() { + return popup; +} + void ColorPickerButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPickerButton::set_pick_color); ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPickerButton::get_pick_color); ClassDB::bind_method(D_METHOD("get_picker"), &ColorPickerButton::get_picker); + ClassDB::bind_method(D_METHOD("get_popup"), &ColorPickerButton::get_popup); 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); diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index 7de67a707c6..c02cdc8608e 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -130,6 +130,7 @@ public: bool is_editing_alpha() const; ColorPicker *get_picker(); + PopupPanel *get_popup(); ColorPickerButton(); };