|
@@ -1770,13 +1770,6 @@ void ColorPicker::_pick_finished() {
|
|
|
}
|
|
|
|
|
|
void ColorPicker::_update_menu_items() {
|
|
|
- if (!options_menu) {
|
|
|
- options_menu = memnew(PopupMenu);
|
|
|
- add_child(options_menu, false, INTERNAL_MODE_FRONT);
|
|
|
- options_menu->force_parent_owned();
|
|
|
- options_menu->connect("id_pressed", callable_mp(this, &ColorPicker::_options_menu_cbk));
|
|
|
- }
|
|
|
-
|
|
|
options_menu->clear();
|
|
|
options_menu->reset_size();
|
|
|
|
|
@@ -1802,16 +1795,6 @@ void ColorPicker::_update_menu_items() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void ColorPicker::_update_menu() {
|
|
|
- _update_menu_items();
|
|
|
- Rect2 gt = menu_btn->get_screen_rect();
|
|
|
- menu_btn->reset_size();
|
|
|
- int min_size = menu_btn->get_minimum_size().width;
|
|
|
- Vector2 popup_pos = gt.get_end() - Vector2(min_size, 0);
|
|
|
- options_menu->set_position(popup_pos);
|
|
|
- options_menu->popup();
|
|
|
-}
|
|
|
-
|
|
|
void ColorPicker::_options_menu_cbk(int p_which) {
|
|
|
if (!file_dialog) {
|
|
|
file_dialog = memnew(FileDialog);
|
|
@@ -2369,13 +2352,15 @@ ColorPicker::ColorPicker() {
|
|
|
btn_preset->connect(SceneStringName(toggled), callable_mp(this, &ColorPicker::_show_hide_preset).bind(btn_preset, preset_container));
|
|
|
palette_box->add_child(btn_preset);
|
|
|
|
|
|
- menu_btn = memnew(Button);
|
|
|
+ menu_btn = memnew(MenuButton);
|
|
|
menu_btn->set_flat(true);
|
|
|
menu_btn->set_tooltip_text(ETR("Show all options available."));
|
|
|
- menu_btn->set_focus_mode(FOCUS_NONE);
|
|
|
- menu_btn->connect(SceneStringName(pressed), callable_mp(this, &ColorPicker::_update_menu));
|
|
|
+ menu_btn->connect("about_to_popup", callable_mp(this, &ColorPicker::_update_menu_items));
|
|
|
palette_box->add_child(menu_btn);
|
|
|
|
|
|
+ options_menu = menu_btn->get_popup();
|
|
|
+ options_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ColorPicker::_options_menu_cbk));
|
|
|
+
|
|
|
palette_name = memnew(Label);
|
|
|
palette_name->hide();
|
|
|
palette_name->set_mouse_filter(MOUSE_FILTER_PASS);
|