| 314 | } |
| 315 | |
| 316 | void |
| 317 | onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam) |
| 318 | { |
| 319 | PNHMessageWindow data; |
| 320 | SCROLLINFO si; |
| 321 | int yInc; |
| 322 | |
| 323 | /* get window data */ |
| 324 | data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA); |
| 325 | |
| 326 | ZeroMemory(&si, sizeof(si)); |
| 327 | si.cbSize = sizeof(si); |
| 328 | si.fMask = SIF_PAGE | SIF_POS; |
| 329 | GetScrollInfo(hWnd, SB_VERT, &si); |
| 330 | |
| 331 | switch (LOWORD(wParam)) { |
| 332 | // User clicked the shaft above the scroll box. |
| 333 | |
| 334 | case SB_PAGEUP: |
| 335 | yInc = -(int) si.nPage; |
| 336 | break; |
| 337 | |
| 338 | // User clicked the shaft below the scroll box. |
| 339 | |
| 340 | case SB_PAGEDOWN: |
| 341 | yInc = si.nPage; |
| 342 | break; |
| 343 | |
| 344 | // User clicked the top arrow. |
| 345 | |
| 346 | case SB_LINEUP: |
| 347 | yInc = -1; |
| 348 | break; |
| 349 | |
| 350 | // User clicked the bottom arrow. |
| 351 | |
| 352 | case SB_LINEDOWN: |
| 353 | yInc = 1; |
| 354 | break; |
| 355 | |
| 356 | // User dragged the scroll box. |
| 357 | |
| 358 | case SB_THUMBTRACK: |
| 359 | yInc = HIWORD(wParam) - data->yPos; |
| 360 | break; |
| 361 | |
| 362 | default: |
| 363 | yInc = 0; |
| 364 | } |
| 365 | |
| 366 | // If applying the vertical scrolling increment does not |
| 367 | // take the scrolling position out of the scrolling range, |
| 368 | // increment the scrolling position, adjust the position |
| 369 | // of the scroll box, and update the window. UpdateWindow |
| 370 | // sends the WM_PAINT message. |
| 371 | |
| 372 | if (yInc = max(MSG_VISIBLE_LINES - data->yPos, |
| 373 | min(yInc, data->yMax - data->yPos))) { |