-----------------------------------------------------------------------------*/ List window Proc */
| 1650 | /*-----------------------------------------------------------------------------*/ |
| 1651 | /* List window Proc */ |
| 1652 | LRESULT CALLBACK |
| 1653 | NHMenuListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 1654 | { |
| 1655 | HWND hWndParent = GetParent(hWnd); |
| 1656 | BOOL bUpdateFocusItem; |
| 1657 | |
| 1658 | /* we will redraw focused item whenever horizontal scrolling occurs |
| 1659 | since "Count: XXX" indicator is garbled by scrolling */ |
| 1660 | bUpdateFocusItem = FALSE; |
| 1661 | |
| 1662 | switch (message) { |
| 1663 | case WM_KEYDOWN: |
| 1664 | if (wParam == VK_LEFT || wParam == VK_RIGHT) |
| 1665 | bUpdateFocusItem = TRUE; |
| 1666 | break; |
| 1667 | |
| 1668 | case WM_CHAR: /* filter keyboard input for the control */ |
| 1669 | if (wParam > 0 && wParam < 256 |
| 1670 | && onListChar(GetParent(hWnd), hWnd, (char) wParam) == -2) { |
| 1671 | return 0; |
| 1672 | } else { |
| 1673 | return 1; |
| 1674 | } |
| 1675 | break; |
| 1676 | |
| 1677 | case WM_SIZE: |
| 1678 | case WM_HSCROLL: |
| 1679 | bUpdateFocusItem = TRUE; |
| 1680 | break; |
| 1681 | |
| 1682 | case WM_SETFOCUS: |
| 1683 | if (GetParent(hWnd) != GetNHApp()->hPopupWnd) { |
| 1684 | SetFocus(GetNHApp()->hMainWnd); |
| 1685 | } |
| 1686 | return FALSE; |
| 1687 | |
| 1688 | case WM_MSNH_COMMAND: |
| 1689 | if (wParam == MSNH_MSG_RANDOM_INPUT) { |
| 1690 | char c = randomkey(); |
| 1691 | if (c == '\n') |
| 1692 | PostMessage(hWndParent, WM_COMMAND, MAKELONG(IDOK, 0), 0); |
| 1693 | else if (c == '\033') |
| 1694 | PostMessage(hWndParent, WM_COMMAND, MAKELONG(IDCANCEL, 0), 0); |
| 1695 | else |
| 1696 | PostMessage(hWnd, WM_CHAR, c, 0); |
| 1697 | return 0; |
| 1698 | } |
| 1699 | break; |
| 1700 | |
| 1701 | } |
| 1702 | |
| 1703 | /* update focused item */ |
| 1704 | if (bUpdateFocusItem) { |
| 1705 | int i; |
| 1706 | RECT rt; |
| 1707 | |
| 1708 | /* invalidate the focus rectangle */ |
| 1709 | i = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED); |
nothing calls this directly
no test coverage detected