diff options
-rw-r--r-- | doc/classes/ColorPickerButton.xml | 4 | ||||
-rw-r--r-- | doc/classes/MenuButton.xml | 2 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 18 | ||||
-rw-r--r-- | scene/gui/color_picker.h | 4 | ||||
-rw-r--r-- | scene/gui/menu_button.cpp | 17 | ||||
-rw-r--r-- | scene/gui/menu_button.h | 2 |
6 files changed, 15 insertions, 32 deletions
diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 185460eef2..87d00b7600 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -11,14 +11,14 @@ <demos> </demos> <methods> - <method name="get_picker"> + <method name="get_picker" qualifiers="const"> <return type="ColorPicker"> </return> <description> Returns the [code]ColorPicker[/code] that this [code]ColorPickerButton[/code] toggles. </description> </method> - <method name="get_popup"> + <method name="get_popup" qualifiers="const"> <return type="PopupPanel"> </return> <description> diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml index c41c86d693..22231cfdf3 100644 --- a/doc/classes/MenuButton.xml +++ b/doc/classes/MenuButton.xml @@ -11,7 +11,7 @@ <demos> </demos> <methods> - <method name="get_popup"> + <method name="get_popup" qualifiers="const"> <return type="PopupMenu"> </return> <description> diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index cb6283507e..446676e80d 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -39,33 +39,32 @@ void ColorPicker::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { - //sample->set_texture(get_icon("color_sample")); + btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); bt_add_preset->set_icon(get_icon("add_preset")); _update_controls(); } break; - case NOTIFICATION_ENTER_TREE: { + btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); bt_add_preset->set_icon(get_icon("add_preset")); _update_color(); } break; - case NOTIFICATION_PARENTED: { + for (int i = 0; i < 4; i++) set_margin((Margin)i, get_constant("margin")); } break; - case NOTIFICATION_VISIBILITY_CHANGED: { Popup *p = Object::cast_to<Popup>(get_parent()); if (p) p->set_size(Size2(get_combined_minimum_size().width + get_constant("margin") * 2, get_combined_minimum_size().height + get_constant("margin") * 2)); } break; - case MainLoop::NOTIFICATION_WM_QUIT_REQUEST: { + if (screen != NULL) { if (screen->is_visible()) { screen->hide(); @@ -523,7 +522,6 @@ ColorPicker::ColorPicker() : add_child(hb_edit); w_edit = memnew(Control); - //w_edit->set_ignore_mouse(false); w_edit->set_custom_minimum_size(Size2(get_constant("h_width"), 0)); w_edit->set_h_size_flags(SIZE_FILL); w_edit->set_v_size_flags(SIZE_EXPAND_FILL); @@ -589,7 +587,6 @@ ColorPicker::ColorPicker() : c_text->set_h_size_flags(SIZE_EXPAND_FILL); _update_controls(); - //_update_color(); updating = false; set_pick_color(Color(1, 1, 1)); @@ -599,7 +596,6 @@ ColorPicker::ColorPicker() : preset = memnew(TextureRect); bbc->add_child(preset); - //preset->set_ignore_mouse(false); preset->connect("gui_input", this, "_preset_input"); preset->connect("draw", this, "_update_presets"); @@ -660,11 +656,13 @@ bool ColorPickerButton::is_editing_alpha() const { return picker->is_editing_alpha(); } -ColorPicker *ColorPickerButton::get_picker() { +ColorPicker *ColorPickerButton::get_picker() const { + return picker; } -PopupPanel *ColorPickerButton::get_popup() { +PopupPanel *ColorPickerButton::get_popup() const { + return popup; } diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index c02cdc8608..2bae279ed5 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -129,8 +129,8 @@ public: void set_edit_alpha(bool p_show); bool is_editing_alpha() const; - ColorPicker *get_picker(); - PopupPanel *get_popup(); + ColorPicker *get_picker() const; + PopupPanel *get_popup() const; ColorPickerButton(); }; diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 1d18c6504c..c235797bef 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -63,25 +63,10 @@ void MenuButton::pressed() { void MenuButton::_gui_input(Ref<InputEvent> p_event) { - /*if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==BUTTON_LEFT) { - clicked=p_event->is_pressed(); - } - if (clicked && p_event.type==InputEvent::MOUSE_MOTION && popup->is_visible_in_tree()) { - - Point2 gt = Point2(p_event.mouse_motion.x,p_event.mouse_motion.y); - gt = get_global_transform().xform(gt); - Point2 lt = popup->get_transform().affine_inverse().xform(gt); - if (popup->has_point(lt)) { - //print_line("HAS POINT!!!"); - popup->call_deferred("grab_click_focus"); - } - - }*/ - BaseButton::_gui_input(p_event); } -PopupMenu *MenuButton::get_popup() { +PopupMenu *MenuButton::get_popup() const { return popup; } diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h index 08a8a43f55..1bd9b155b2 100644 --- a/scene/gui/menu_button.h +++ b/scene/gui/menu_button.h @@ -54,7 +54,7 @@ protected: static void _bind_methods(); public: - PopupMenu *get_popup(); + PopupMenu *get_popup() const; void set_disable_shortcuts(bool p_disabled); MenuButton(); |