/** * Increases the selected alien count; * by one on left-click, to max on right-click. * @param action Pointer to an action. */ void ManageAlienContainmentState::lstItemsRightArrowClick(Action *action) { if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) increaseByValue(INT_MAX); if (action->getDetails()->button.button == SDL_BUTTON_LEFT) { increaseByValue(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); } } }
/** * Increases the quantity of the selected alien to exterminate by one. */ void ManageAlienContainmentState::increase() { _timerDec->setInterval(50); _timerInc->setInterval(50); increaseByValue(1); }