void ScrollBar::handleScrollFieldAction(ActionEventDetails* const e) { if(getEnabled()) { UInt32 AxisIndex(0); if(getOrientation() == ScrollBar::HORIZONTAL_ORIENTATION ) AxisIndex = 0; else AxisIndex = 1; Pnt2f ComponentMousePosition(DrawingSurfaceToComponent(getParentWindow()->getParentDrawingSurface()->getMousePosition(), this)); //Is Mouse Major axis on the min or max side of the scroll bar if(ComponentMousePosition[AxisIndex] < getScrollBar()->getPosition()[AxisIndex]) { //Move the Bounded range model one block in the Min direction scrollBlock(-1); } else if(ComponentMousePosition[AxisIndex] > (getScrollBar()->getPosition()[AxisIndex] + getScrollBar()->getSize()[AxisIndex])) { //Move the Bounded range model one block in the Max direction scrollBlock(1); } } }
void ScrollBar::mouseWheelMoved(const MouseWheelEventUnrecPtr e) { if(getEnabled()) { if(e->getScrollType() == MouseWheelEvent::BLOCK_SCROLL) { scrollBlock(-e->getScrollAmount()); } else if(e->getScrollType() == MouseWheelEvent::UNIT_SCROLL) { scrollUnit(-e->getUnitsToScroll()); } } ComponentContainer::mouseWheelMoved(e); }