Commit 32c980b7 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Introducing GenericOptionProperty::selectByOption()

parent f52c44b3
......@@ -158,6 +158,12 @@ namespace campvis {
*/
void selectByIndex(int index);
/**
* Sets the selected option to \a option.
* \param option Option to set.
*/
void selectByOption(T option);
protected:
std::vector< GenericOption<T> > _options;
};
......@@ -223,6 +229,17 @@ namespace campvis {
setValue(index);
}
template<typename T>
void campvis::GenericOptionProperty<T>::selectByOption(T option) {
for (size_t i = 0; i < _options.size(); ++i) {
if (_options[i]._value == option) {
setValue(static_cast<int>(i));
return;
}
}
LERROR("Could not find specified option.");
}
}
#endif // OPTIONPROPERTY_H__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment