Skip to content

Commit

Permalink
fix location palette buttons showing in other palettes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Jun 18, 2016
1 parent d3f71ce commit 5870074
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
25 changes: 16 additions & 9 deletions src/editor/palette/location_palette.cpp
Expand Up @@ -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<gui::widget&>(*w).hide(hidden);
}
}

bool location_palette::scroll_up()
{
int decrement = 1;
Expand Down Expand Up @@ -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<std::string> location_palette::action_pressed() const
{
std::vector<std::string> res;
Expand Down
4 changes: 2 additions & 2 deletions src/editor/palette/location_palette.hpp
Expand Up @@ -74,6 +74,8 @@ class location_palette : public common_palette {
virtual std::vector<std::string> 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. */
Expand All @@ -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_;
Expand Down

0 comments on commit 5870074

Please sign in to comment.