MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / lstControlsClick

Method lstControlsClick

src/Menu/OptionsControlsState.cpp:197–233  ·  view source on GitHub ↗

* Select a control for changing. * @param action Pointer to an action. */

Source from the content-addressed store, hash-verified

195 * @param action Pointer to an action.
196 */
197void 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.

Callers

nothing calls this directly

Calls 5

getDetailsMethod · 0.80
setCellColorMethod · 0.80
getSelectedRowMethod · 0.80
setCellTextMethod · 0.80
asKeyMethod · 0.80

Tested by

no test coverage detected