void GameSettings::setOption(const ConfigOptionMap& configuration, const Ogre::String& option, Combobox* combobox) { ConfigOptionMap::const_iterator cfi = configuration.find(option); if (cfi != configuration.end()) { ConfigOption curOption = cfi->second; int delta = curOption.possibleValues.size() - combobox->getItemCount(); if (delta > 0) { for (int i = 0; i < delta; ++i) { combobox->addItem(new ListboxTextItem("")); } } else if (delta < 0) { for (int i = 0; i < -delta; ++i) { ListboxItem* item = combobox->getListboxItemFromIndex(combobox->getItemCount() - 1); combobox->removeItem(item); delete item; } } for (unsigned int i = 0; i < combobox->getItemCount(); ++i) { ListboxItem* item = combobox->getListboxItemFromIndex(i); item->setText(curOption.possibleValues[i]); } } }
void GameSettings::setOption(const ConfigOptionMap& configuration, const Ogre::String& option, Checkbox* checkbox) { ConfigOptionMap::const_iterator cfi = configuration.find(option); if (cfi != configuration.end()) { checkbox->setSelected(cfi->second.currentValue == "Yes"); } }
void GameSettings::setOption(const ConfigOptionMap& configuration, const Ogre::String& option, std::vector<RadioButton*> radioGroup) { ConfigOptionMap::const_iterator cfi = configuration.find(option); if (cfi != configuration.end()) { ConfigOption curOption = cfi->second; for (std::vector<RadioButton*>::const_iterator it = radioGroup.begin(); it != radioGroup.end(); ++it) { Ogre::String* value = static_cast<Ogre::String*>((*it)->getUserData()); if (value && (*value == curOption.currentValue)) { (*it)->setSelected(true); break; } } } }