diff --git a/src/editor/palette/location_palette.cpp b/src/editor/palette/location_palette.cpp index 8fd87dd9ddf1..fdbbd3015e06 100644 --- a/src/editor/palette/location_palette.cpp +++ b/src/editor/palette/location_palette.cpp @@ -181,9 +181,25 @@ sdl_handler_vector location_palette::handler_members() for (gui::widget& b : buttons_) { h.push_back(&b); } + if (button_add_) { h.push_back(button_add_.get()); } + if (button_delete_) { h.push_back(button_delete_.get()); } + if (button_goto_) { h.push_back(button_goto_.get()); } return h; } +void location_palette::hide(bool hidden) { + widget::hide(hidden); + if (!hidden) { + help_handle_ = gui_.video().set_help_string(get_help_string()); + } + else { + gui_.video().clear_help_string(help_handle_); + } + for (auto& w : handler_members()) { + static_cast(*w).hide(hidden); + } +} + bool location_palette::scroll_up() { int decrement = 1; @@ -343,15 +359,6 @@ void location_palette::draw_contents() update_rect(location()); } -void location_palette::hide(bool hidden) { - widget::hide(hidden); - if (!hidden) - help_handle_ = gui_.video().set_help_string(get_help_string()); - else gui_.video().clear_help_string(help_handle_); - for (gui::widget& w : buttons_) { - w.hide(hidden); - } -} std::vector location_palette::action_pressed() const { std::vector res; diff --git a/src/editor/palette/location_palette.hpp b/src/editor/palette/location_palette.hpp index e2ba82ac35ed..2e35a6498758 100644 --- a/src/editor/palette/location_palette.hpp +++ b/src/editor/palette/location_palette.hpp @@ -74,6 +74,8 @@ class location_palette : public common_palette { virtual std::vector action_pressed() const override; void add_item(const std::string& id); ~location_palette(); + void hide(bool hidden) override; + private: /** Scroll the editor-palette to the top. */ @@ -88,8 +90,6 @@ class location_palette : public common_palette { int num_items(); /** Return the maximum number of items shown at the same time. */ int num_visible_items(); - - void hide(bool hidden) override; protected: editor_display &gui_;