/** * Decreases the selected alien count; * by one on left-click, to 0 on right-click. * @param action Pointer to an action. */ void ManageAlienContainmentState::lstItemsLeftArrowClick(Action *action) { if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) decreaseByValue(INT_MAX); if (action->getDetails()->button.button == SDL_BUTTON_LEFT) { decreaseByValue(1); _timerInc->setInterval(250); _timerDec->setInterval(250); } }
/** * Handles the mouse-wheels on the arrow-buttons. * @param action Pointer to an action. */ void ManageAlienContainmentState::lstItemsMousePress(Action *action) { _sel = _lstAliens->getSelectedRow(); if (action->getDetails()->button.button == SDL_BUTTON_WHEELUP) { _timerInc->stop(); _timerDec->stop(); if (_allowChangeListValuesByMouseWheel && action->getAbsoluteXMouse() >= _lstAliens->getArrowsLeftEdge() && action->getAbsoluteXMouse() <= _lstAliens->getArrowsRightEdge()) { increaseByValue(_changeValueByMouseWheel); } } else if (action->getDetails()->button.button == SDL_BUTTON_WHEELDOWN) { _timerInc->stop(); _timerDec->stop(); if (_allowChangeListValuesByMouseWheel && action->getAbsoluteXMouse() >= _lstAliens->getArrowsLeftEdge() && action->getAbsoluteXMouse() <= _lstAliens->getArrowsRightEdge()) { decreaseByValue(_changeValueByMouseWheel); } } }
/** * Handles the mouse-wheels on the arrow buttons. * @param action Pointer to an action. */ void ManageAlienContainmentState::lstItemsMouseWheel(Action *action) { _sel = _lstAliens->getSelectedRow(); const SDL_Event &ev(*action->getDetails()); if (ev.type == SDL_MOUSEWHEEL) { _timerInc->stop(); _timerDec->stop(); if (action->getAbsoluteXMouse() >= _lstAliens->getArrowsLeftEdge() && action->getAbsoluteXMouse() <= _lstAliens->getArrowsRightEdge()) { if (ev.wheel.y < 0) increaseByValue(Options::changeValueByMouseWheel); else decreaseByValue(Options::changeValueByMouseWheel); } } }
/** * Decreases the quantity of the selected alien to exterminate by one. */ void ManageAlienContainmentState::decrease() { _timerInc->setInterval(50); _timerDec->setInterval(50); decreaseByValue(1); }