- case WM_NOTIFY:
- {
- // for some messages (TVN_ITEMEXPANDING for example), the return
- // value of WM_NOTIFY handler is important, so don't just return 0
- // if we processed the message
- return MSWOnNotify(wParam, lParam);
- }
-#endif
- case WM_MENUSELECT:
- {
-#ifdef __WIN32__
- WORD flags = HIWORD(wParam);
- HMENU sysmenu = (HMENU)lParam;
-#else
- WORD flags = LOWORD(lParam);
- HMENU sysmenu = (HMENU)HIWORD(lParam);
-#endif
- MSWOnMenuHighlight((WORD)wParam, flags, (WXHMENU) sysmenu);
- break;
- }
- case WM_INITMENUPOPUP:
- {
- MSWOnInitMenuPopup((WXHMENU) (HMENU)wParam, (int)LOWORD(lParam), (HIWORD(lParam) != 0));
- break;
- }
- case WM_DRAWITEM:
- {
- return MSWOnDrawItem((int)wParam, (WXDRAWITEMSTRUCT *)lParam);
- break;
- }
- case WM_MEASUREITEM:
- {
- return MSWOnMeasureItem((int)wParam, (WXMEASUREITEMSTRUCT *)lParam);
- break;
- }
-
- case WM_KEYDOWN:
- {
- MSWOnKeyDown((WORD) wParam, lParam);
- // we consider these message "not interesting"
- if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
- return Default();
-
- // Avoid duplicate messages to OnChar
- if ( (wParam != VK_ESCAPE) && (wParam != VK_SPACE) &&
- (wParam != VK_RETURN) && (wParam != VK_BACK) &&
- (wParam != VK_TAB) )
- {
- MSWOnChar((WORD)wParam, lParam);
- if ( ::GetKeyState(VK_CONTROL) & 0x100 )
- return Default();
- }
- else if ( ::GetKeyState(VK_CONTROL) & 0x100 )
- MSWOnChar((WORD)wParam, lParam);
- else
- return Default();
- break;
- }
-
- case WM_KEYUP:
- {
- MSWOnKeyUp((WORD) wParam, lParam);
- break;
- }
- case WM_CHAR: // Always an ASCII character
- {
- MSWOnChar((WORD)wParam, lParam, TRUE);
- break;
- }
-
- case WM_HSCROLL:
- {
-#ifdef __WIN32__
- WORD code = LOWORD(wParam);
- WORD pos = HIWORD(wParam);
- HWND control = (HWND)lParam;
-#else
- WORD code = (WORD)wParam;
- WORD pos = LOWORD(lParam);
- HWND control = (HWND)HIWORD(lParam);
-#endif
- MSWOnHScroll(code, pos, (WXHWND) control);
- break;
- }
- case WM_VSCROLL:
- {
-#ifdef __WIN32__
- WORD code = LOWORD(wParam);
- WORD pos = HIWORD(wParam);
- HWND control = (HWND)lParam;
-#else
- WORD code = (WORD)wParam;
- WORD pos = LOWORD(lParam);
- HWND control = (HWND)HIWORD(lParam);
-#endif
- MSWOnVScroll(code, pos, (WXHWND) control);
- break;
- }
-#ifdef __WIN32__
- case WM_CTLCOLORBTN:
- {
- int nCtlColor = CTLCOLOR_BTN;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
- case WM_CTLCOLORDLG:
- {
- int nCtlColor = CTLCOLOR_DLG;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);\
- break;
- }
- case WM_CTLCOLORLISTBOX:
- {
- int nCtlColor = CTLCOLOR_LISTBOX;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
- case WM_CTLCOLORMSGBOX:
- {
- int nCtlColor = CTLCOLOR_MSGBOX;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
- case WM_CTLCOLORSCROLLBAR:
- {
- int nCtlColor = CTLCOLOR_SCROLLBAR;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
- case WM_CTLCOLORSTATIC:
- {
- int nCtlColor = CTLCOLOR_STATIC;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
- case WM_CTLCOLOREDIT:
- {
- int nCtlColor = CTLCOLOR_EDIT;
- HWND control = (HWND)lParam;
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
-#else
- case WM_CTLCOLOR:
- {
- HWND control = (HWND)LOWORD(lParam);
- int nCtlColor = (int)HIWORD(lParam);
- HDC pDC = (HDC)wParam;
- return (DWORD)MSWOnCtlColor((WXHDC) pDC, (WXHWND) control, nCtlColor,
- message, wParam, lParam);
- break;
- }
-#endif
- case WM_SYSCOLORCHANGE:
- {
- // Return value of 0 means, we processed it.
- if (MSWOnColorChange((WXHWND) hWnd, message, wParam, lParam) == 0)
- return 0;
- else
- return MSWDefWindowProc(message, wParam, lParam );
- break;
- }
- case WM_PALETTECHANGED:
- {
- return MSWOnPaletteChanged((WXHWND) (HWND) wParam);
- break;
- }
- case WM_QUERYNEWPALETTE:
- {
- return MSWOnQueryNewPalette();
- break;
- }
- case WM_ERASEBKGND:
- {
- // Prevents flicker when dragging
- if (IsIconic(hWnd)) return 1;
-
- if (!MSWOnEraseBkgnd((WXHDC) (HDC)wParam))
- return 0; // Default(); MSWDefWindowProc(message, wParam, lParam );
- else return 1;
- break;
- }
- case WM_MDIACTIVATE:
- {
-#ifdef __WIN32__
- HWND hWndActivate = GET_WM_MDIACTIVATE_HWNDACTIVATE(wParam,lParam);
- HWND hWndDeactivate = GET_WM_MDIACTIVATE_HWNDDEACT(wParam,lParam);
- BOOL activate = GET_WM_MDIACTIVATE_FACTIVATE(hWnd,wParam,lParam);
- return MSWOnMDIActivate((long) activate, (WXHWND) hWndActivate, (WXHWND) hWndDeactivate);
-#else
- return MSWOnMDIActivate((BOOL)wParam, (HWND)LOWORD(lParam),
- (HWND)HIWORD(lParam));