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

Method mousePress

src/Interface/TextButton.cpp:268–296  ·  view source on GitHub ↗

* Sets the button as the pressed button if it's part of a group. * @param action Pointer to an action. * @param state State that the action handlers belong to. */

Source from the content-addressed store, hash-verified

266 * @param state State that the action handlers belong to.
267 */
268void TextButton::mousePress(Action *action, State *state)
269{
270 if (action->getDetails()->button.button == SDL_BUTTON_LEFT && _group != 0)
271 {
272 TextButton *old = *_group;
273 *_group = this;
274 if (old != 0)
275 old->draw();
276 draw();
277 }
278
279 if (isButtonHandled(action->getDetails()->button.button))
280 {
281 if (soundPress != 0 && _group == 0 &&
282 action->getDetails()->button.button != SDL_BUTTON_WHEELUP && action->getDetails()->button.button != SDL_BUTTON_WHEELDOWN)
283 {
284 soundPress->play(Mix_GroupAvailable(0));
285 }
286
287 if (_comboBox)
288 {
289 _comboBox->toggle();
290 }
291
292 draw();
293 //_redraw = true;
294 }
295 InteractiveSurface::mousePress(action, state);
296}
297
298/**
299 * Sets the button as the released button.

Callers

nothing calls this directly

Calls 4

getDetailsMethod · 0.80
drawMethod · 0.45
playMethod · 0.45
toggleMethod · 0.45

Tested by

no test coverage detected