void selectRow (const int row, const int rowHeight, const bool dontScroll, const int lastRowSelected, const int totalItems, const bool isMouseClick) { hasUpdated = false; if (row < firstWholeIndex && ! dontScroll) { setViewPosition (getViewPositionX(), row * rowHeight); } else if (row >= lastWholeIndex && ! dontScroll) { const int rowsOnScreen = lastWholeIndex - firstWholeIndex; if (row >= lastRowSelected + rowsOnScreen && rowsOnScreen < totalItems - 1 && ! isMouseClick) { setViewPosition (getViewPositionX(), jlimit (0, jmax (0, totalItems - rowsOnScreen), row) * rowHeight); } else { setViewPosition (getViewPositionX(), jmax (0, (row + 1) * rowHeight - getMaximumVisibleHeight())); } } if (! hasUpdated) updateContents(); }
void scrollToEnsureRowIsOnscreen (const int row, const int rowHeight) { if (row < firstWholeIndex) { setViewPosition (getViewPositionX(), row * rowHeight); } else if (row >= lastWholeIndex) { setViewPosition (getViewPositionX(), jmax (0, (row + 1) * rowHeight - getMaximumVisibleHeight())); } }
void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart) { if (scrollBarThatHasMoved == horizontalScrollBar) { setViewPosition (roundToInt (newRangeStart), getViewPositionY()); } else if (scrollBarThatHasMoved == verticalScrollBar) { setViewPosition (getViewPositionX(), roundToInt (newRangeStart)); } }
void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart) { const int newRangeStartInt = roundToInt (newRangeStart); if (scrollBarThatHasMoved == &horizontalScrollBar) { setViewPosition (newRangeStartInt, getViewPositionY()); } else if (scrollBarThatHasMoved == &verticalScrollBar) { setViewPosition (getViewPositionX(), newRangeStartInt); } }