* Select a control for changing. * @param action Pointer to an action. */
| 195 | * @param action Pointer to an action. |
| 196 | */ |
| 197 | void OptionsControlsState::lstControlsClick(Action *action) |
| 198 | { |
| 199 | if (action->getDetails()->button.button != SDL_BUTTON_LEFT && action->getDetails()->button.button != SDL_BUTTON_RIGHT) |
| 200 | { |
| 201 | return; |
| 202 | } |
| 203 | if (_selected != -1) |
| 204 | { |
| 205 | int selected = _selected; |
| 206 | _lstControls->setCellColor(_selected, 0, _colorNormal); |
| 207 | _lstControls->setCellColor(_selected, 1, _colorNormal); |
| 208 | _selected = -1; |
| 209 | _selKey = 0; |
| 210 | if (selected == _lstControls->getSelectedRow()) |
| 211 | return; |
| 212 | } |
| 213 | _selected = _lstControls->getSelectedRow(); |
| 214 | _selKey = getControl(_selected); |
| 215 | if (!_selKey) |
| 216 | { |
| 217 | _selected = -1; |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | if (action->getDetails()->button.button == SDL_BUTTON_LEFT) |
| 222 | { |
| 223 | _lstControls->setCellColor(_selected, 0, _colorSel); |
| 224 | _lstControls->setCellColor(_selected, 1, _colorSel); |
| 225 | } |
| 226 | else if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) |
| 227 | { |
| 228 | _lstControls->setCellText(_selected, 1, L""); |
| 229 | *_selKey->asKey() = SDLK_UNKNOWN; |
| 230 | _selected = -1; |
| 231 | _selKey = 0; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Change selected control. |
nothing calls this directly
no test coverage detected