| 502 | |
| 503 | #ifndef MSG_WRAP_TEXT |
| 504 | void |
| 505 | onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam) |
| 506 | { |
| 507 | PNHMessageWindow data; |
| 508 | SCROLLINFO si; |
| 509 | int xInc; |
| 510 | |
| 511 | /* get window data */ |
| 512 | data = (PNHMessageWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); |
| 513 | |
| 514 | ZeroMemory(&si, sizeof(si)); |
| 515 | si.cbSize = sizeof(si); |
| 516 | si.fMask = SIF_PAGE; |
| 517 | GetScrollInfo(hWnd, SB_HORZ, &si); |
| 518 | |
| 519 | switch (LOWORD(wParam)) { |
| 520 | // User clicked shaft left of the scroll box. |
| 521 | |
| 522 | case SB_PAGEUP: |
| 523 | xInc = -(int) si.nPage; |
| 524 | break; |
| 525 | |
| 526 | // User clicked shaft right of the scroll box. |
| 527 | |
| 528 | case SB_PAGEDOWN: |
| 529 | xInc = si.nPage; |
| 530 | break; |
| 531 | |
| 532 | // User clicked the left arrow. |
| 533 | |
| 534 | case SB_LINEUP: |
| 535 | xInc = -1; |
| 536 | break; |
| 537 | |
| 538 | // User clicked the right arrow. |
| 539 | |
| 540 | case SB_LINEDOWN: |
| 541 | xInc = 1; |
| 542 | break; |
| 543 | |
| 544 | // User dragged the scroll box. |
| 545 | |
| 546 | case SB_THUMBTRACK: |
| 547 | xInc = HIWORD(wParam) - data->xPos; |
| 548 | break; |
| 549 | |
| 550 | default: |
| 551 | xInc = 0; |
| 552 | } |
| 553 | |
| 554 | // If applying the horizontal scrolling increment does not |
| 555 | // take the scrolling position out of the scrolling range, |
| 556 | // increment the scrolling position, adjust the position |
| 557 | // of the scroll box, and update the window. |
| 558 | |
| 559 | if (xInc = max(-data->xPos, min(xInc, data->xMax - data->xPos))) { |
| 560 | data->xPos += xInc; |
| 561 | ScrollWindowEx(hWnd, -data->xChar * xInc, 0, (CONST RECT *) NULL, |