Add two functions to query items from GUI1 menus.

This commit is contained in:
Boldizsár Lipka 2013-11-01 13:36:15 +01:00
parent 038ac7efbb
commit c0fcc72ff5
2 changed files with 13 additions and 0 deletions

View File

@ -381,6 +381,16 @@ void menu::set_inner_location(SDL_Rect const &rect)
bg_register(rect);
}
const menu::item& menu::get_item(int index) const
{
return items_[index];
}
const menu::item& menu::get_selected_item() const
{
return items_[selection()];
}
void menu::change_item(int pos1, int pos2,const std::string& str)
{
if(pos1 < 0 || pos1 >= int(item_pos_.size()) ||

View File

@ -160,6 +160,9 @@ public:
void move_selection_keeping_viewport(size_t id);
void reset_selection();
const item& get_item(int index) const;
const item& get_selected_item() const;
// allows user to change_item while running (dangerous)
void change_item(int pos1,int pos2,const std::string& str);