+ case SCROLL_LINE_UP:
+ if (State->ScrollMode == SCROLL_MODE_ICONS) {
+ if (State->CurrentSelection >= State->InitialRow1) {
+ if (State->MaxIndex > State->InitialRow1) { // avoid division by 0!
+ State->CurrentSelection = State->FirstVisible + (State->LastVisible - State->FirstVisible) *
+ (State->CurrentSelection - State->InitialRow1) /
+ (State->MaxIndex - State->InitialRow1);
+ } else {
+ State->CurrentSelection = State->FirstVisible;
+ } // if/else
+ } // if in second row
+ } else {
+ if (State->CurrentSelection > 0)
+ State->CurrentSelection--;
+ } // if/else
+ break;
+
+ case SCROLL_LINE_DOWN:
+ if (State->ScrollMode == SCROLL_MODE_ICONS) {
+ if (State->CurrentSelection <= State->FinalRow0) {
+ if (State->LastVisible > State->FirstVisible) { // avoid division by 0!
+ State->CurrentSelection = State->InitialRow1 + (State->MaxIndex - State->InitialRow1) *
+ (State->CurrentSelection - State->FirstVisible) /
+ (State->LastVisible - State->FirstVisible);
+ } else {
+ State->CurrentSelection = State->InitialRow1;
+ } // if/else
+ } // if in first row
+ } else {
+ if (State->CurrentSelection < State->MaxIndex)
+ State->CurrentSelection++;
+ } // if/else
+ break;
+