Skip to content

Commit

Permalink
fix use_markup in comboboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Jan 20, 2016
1 parent 3983fef commit 3cf301e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/gui/dialogs/drop_down_list.cpp
Expand Up @@ -56,8 +56,10 @@ void tdrop_down_list::pre_show(CVideo& /*video*/, twindow& window)
tlistbox& list = find_widget<tlistbox>(&window, "list", true);
std::map<std::string, string_map> data;
t_string& label = data["label"]["label"];
t_string& use_markup = data["label"]["use_markup"];
FOREACH(const AUTO& str, items_) {
label = str;
use_markup = use_markup_ ? "true" : "false";
list.add_row(data);
}
list.select_row(selected_item_);
Expand Down
4 changes: 3 additions & 1 deletion src/gui/dialogs/drop_down_list.hpp
Expand Up @@ -23,10 +23,11 @@ namespace gui2
class tdrop_down_list : public tdialog
{
public:
tdrop_down_list(SDL_Rect button_pos, const std::vector<std::string>& items, int selected_item)
tdrop_down_list(SDL_Rect button_pos, const std::vector<std::string>& items, int selected_item, bool use_markup)
: button_pos_(button_pos)
, items_(items)
, selected_item_(selected_item)
, use_markup_(use_markup)
{
}
int selected_item() const { return selected_item_; }
Expand All @@ -37,6 +38,7 @@ class tdrop_down_list : public tdialog
SDL_Rect button_pos_;
std::vector<std::string> items_;
int selected_item_;
bool use_markup_;
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/combobox.cpp
Expand Up @@ -139,7 +139,7 @@ void tcombobox::signal_handler_left_button_click(const event::tevent event,
sound::play_UI_sound(settings::sound_button_click);

// If a button has a retval do the default handling.
tdrop_down_list droplist(this->get_rectangle(), this->values_, this->selected_);
tdrop_down_list droplist(this->get_rectangle(), this->values_, this->selected_, this->get_use_markup());

if(droplist.show(get_window()->video())) {
selected_ = droplist.selected_item();
Expand Down

0 comments on commit 3cf301e

Please sign in to comment.