* Get parameters for drawing the value of the setting. * @param value Setting value to set params for. */
| 443 | * @param value Setting value to set params for. |
| 444 | */ |
| 445 | std::pair<StringParameter, StringParameter> IntSettingDesc::GetValueParams(int32_t value) const |
| 446 | { |
| 447 | if (this->get_value_params_cb != nullptr) { |
| 448 | return this->get_value_params_cb(*this, value); |
| 449 | } |
| 450 | |
| 451 | if (this->IsBoolSetting()) { |
| 452 | return {value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF, {}}; |
| 453 | } |
| 454 | |
| 455 | if (this->flags.Test(SettingFlag::GuiDropdown)) { |
| 456 | auto [min_val, _] = this->GetRange(); |
| 457 | return {this->str_val - min_val + value, value}; |
| 458 | } |
| 459 | |
| 460 | return {this->str_val + ((value == 0 && this->flags.Test(SettingFlag::GuiZeroIsSpecial)) ? 1 : 0), value}; |
| 461 | } |
| 462 | |
| 463 | /** |
| 464 | * Get the default value of the setting. |
no test coverage detected