- int z = LOWORD(lParam);
- MSWOnJoyZMove(wxJOYSTICK2, z, wParam);
- break;
- }
- case WM_DESTROY:
- {
- if (MSWOnDestroy())
- return 0;
- else return MSWDefWindowProc(message, wParam, lParam );
- break;
- }
- case WM_SYSCOMMAND:
- {
- return MSWOnSysCommand(wParam, lParam);
- break;
- }
- case WM_COMMAND:
- {
-#ifdef __WIN32__
- WORD id = LOWORD(wParam);
- HWND hwnd = (HWND)lParam;
- WORD cmd = HIWORD(wParam);
-#else
- WORD id = (WORD)wParam;
- HWND hwnd = (HWND)LOWORD(lParam) ;
- WORD cmd = HIWORD(lParam);
-#endif
- if (!MSWOnCommand(id, cmd, (WXHWND) hwnd))
- return MSWDefWindowProc(message, wParam, lParam );
- break;
- }
-#if defined(__WIN95__)
- 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);
-#if 0
- // 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();
-#endif
- 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));
-#endif
- }
- case WM_DROPFILES:
- {
- MSWOnDropFiles(wParam);
- break;
- }
- case WM_INITDIALOG:
- {
- return 0; // MSWOnInitDialog((WXHWND)(HWND)wParam);
- break;
- }
- case WM_QUERYENDSESSION:
- {
- // Same as WM_CLOSE, but inverted results. Thx Microsoft :-)
- // return MSWOnClose();
-
- return MSWOnQueryEndSession(lParam);
- break;
- }
- case WM_ENDSESSION:
- {
- // Same as WM_CLOSE, but inverted results. Thx Microsoft :-)
- MSWOnEndSession((wParam != 0), lParam);
- return 0L;
- break;
- }
- case WM_CLOSE:
- {
- if (MSWOnClose())
- return 0L;
- else
- return 1L;
- break;
- }
-
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO *info = (MINMAXINFO *)lParam;
- if (m_minSizeX != -1)
- info->ptMinTrackSize.x = (int)m_minSizeX;
- if (m_minSizeY != -1)
- info->ptMinTrackSize.y = (int)m_minSizeY;
- if (m_maxSizeX != -1)
- info->ptMaxTrackSize.x = (int)m_maxSizeX;
- if (m_maxSizeY != -1)
- info->ptMaxTrackSize.y = (int)m_maxSizeY;
- return MSWDefWindowProc(message, wParam, lParam );
- break;
- }
-
- case WM_GETDLGCODE:
- return MSWGetDlgCode();
-
- default:
- return MSWDefWindowProc(message, wParam, lParam );
- }
- return 0; // Success: we processed this command.
-}
-
-// Dialog window proc
-LONG APIENTRY _EXPORT
-wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
-
-wxList *wxWinHandleList = NULL;
-wxWindow *wxFindWinFromHandle(WXHWND hWnd)
-{
- wxNode *node = wxWinHandleList->Find((long)hWnd);
- if (!node)
- return NULL;
- return (wxWindow *)node->Data();
-}
-
-void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
-{
- // adding NULL hWnd is (first) surely a result of an error and
- // (secondly) breaks menu command processing
- wxCHECK_RET( hWnd != (HWND) NULL, "attempt to add a NULL hWnd to window list" );
-
- if ( !wxWinHandleList->Find((long)hWnd) )
- wxWinHandleList->Append((long)hWnd, win);
-}
-
-void wxRemoveHandleAssociation(wxWindow *win)
-{
- wxWinHandleList->DeleteObject(win);
-}
-
-// Default destroyer - override if you destroy it in some other way
-// (e.g. with MDI child windows)
-void wxWindow::MSWDestroyWindow()
-{
-}
-
-void wxWindow::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
- int x, int y, int width, int height,
- WXDWORD style, const char *dialog_template, WXDWORD extendedStyle)
-{
- bool is_dialog = (dialog_template != NULL);
- int x1 = CW_USEDEFAULT;
- int y1 = 0;
- int width1 = CW_USEDEFAULT;
- int height1 = 100;
-
- // Find parent's size, if it exists, to set up a possible default
- // panel size the size of the parent window
- RECT parent_rect;
- if (parent)
- {
- // Was GetWindowRect: JACS 5/5/95
- ::GetClientRect((HWND) parent->GetHWND(), &parent_rect);
-
- width1 = parent_rect.right - parent_rect.left;
- height1 = parent_rect.bottom - parent_rect.top;
- }
-
- if (x > -1) x1 = x;
- if (y > -1) y1 = y;
- if (width > -1) width1 = width;
- if (height > -1) height1 = height;
-
- HWND hParent = NULL;
- if (parent)
- hParent = (HWND) parent->GetHWND();
-
- wxWndHook = this;
-
- if (is_dialog)
- {
- // MakeProcInstance doesn't seem to be needed in C7. Is it needed for
- // other compilers???
- // VZ: it's always needed for Win16 and never for Win32
-#ifdef __WIN32__
- m_hWnd = (WXHWND) ::CreateDialog(wxGetInstance(), dialog_template, hParent,
- (DLGPROC)wxDlgProc);
-#else
- // N.B.: if we _don't_ use this form,
- // then with VC++ 1.5, it crashes horribly.
-#if 1
- m_hWnd = (WXHWND) ::CreateDialog(wxGetInstance(), dialog_template, hParent,
- (DLGPROC)wxDlgProc);
-#else
- // Crashes when we use this.
- DLGPROC dlgproc = (DLGPROC)MakeProcInstance((DLGPROC)wxWndProc, wxGetInstance());
-
- m_hWnd = (WXHWND) ::CreateDialog(wxGetInstance(), dialog_template, hParent,
- (DLGPROC)dlgproc);
-#endif
-#endif
-
- if (m_hWnd == 0)
- MessageBox(NULL, "Can't find dummy dialog template!\nCheck resource include path for finding wx.rc.",
- "wxWindows Error", MB_ICONEXCLAMATION | MB_OK);
- else MoveWindow((HWND) m_hWnd, x1, y1, width1, height1, FALSE);
- }
- else
- {
- int controlId = 0;
- if (style & WS_CHILD)
- controlId = id;
- if (!title)
- title = "";
-
- m_hWnd = (WXHWND)CreateWindowEx(extendedStyle, wclass,
- title,
- style,
- x1, y1,
- width1, height1,
- hParent, (HMENU)controlId, wxGetInstance(),
- NULL);
-
- if ( !m_hWnd ) {
- wxLogError("Can't create window of class %s!\n"
- "Possible Windows 3.x compatibility problem?", wclass);