X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aa44b2611555154a92fb02c9193eed599319bea4..807a903e6807ae3e49928bda488a04bc0d832149:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 4193250a77..f58179b4c3 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -71,6 +71,10 @@ #include "wx/caret.h" #endif // wxUSE_CARET +#if wxUSE_SPINCTRL + #include "wx/spinctrl.h" +#endif // wxUSE_SPINCTRL + #include "wx/intl.h" #include "wx/log.h" @@ -867,7 +871,8 @@ WXDWORD wxWindow::MakeExtendedStyle(long style, bool eliminateBorders) exStyle |= WS_EX_DLGMODALFRAME; #if defined(__WIN95__) if ( style & wxRAISED_BORDER ) - exStyle |= WS_EX_WINDOWEDGE; + // It seems that WS_EX_WINDOWEDGE doesn't work, but WS_EX_DLGMODALFRAME does + exStyle |= WS_EX_DLGMODALFRAME; /* WS_EX_WINDOWEDGE */; if ( style & wxSTATIC_BORDER ) exStyle |= WS_EX_STATICEDGE; #endif @@ -1146,11 +1151,14 @@ void wxWindow::DoGetPosition(int *x, int *y) const ::ScreenToClient(hParentWnd, &point); } - // We may be faking the client origin. So a window that's really at (0, - // 30) may appear (to wxWin apps) to be at (0, 0). - wxPoint pt(parent->GetClientAreaOrigin()); - point.x -= pt.x; - point.y -= pt.y; + if ( parent ) + { + // We may be faking the client origin. So a window that's really at (0, + // 30) may appear (to wxWin apps) to be at (0, 0). + wxPoint pt(parent->GetClientAreaOrigin()); + point.x -= pt.x; + point.y -= pt.y; + } } if ( x ) @@ -1462,7 +1470,7 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) ::ClientToScreen(hWnd, &point); wxCurrentPopupMenu = menu; ::TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL); - wxYield(); + wxYieldIfNeeded(); wxCurrentPopupMenu = NULL; menu->SetInvokingWindow(NULL); @@ -1857,7 +1865,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) break; case WM_MOVE: - processed = HandleMove(LOWORD(lParam), HIWORD(lParam)); + processed = HandleMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; case WM_SIZE: @@ -1898,13 +1906,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) break; case WM_MOUSEMOVE: - { - short x = LOWORD(lParam); - short y = HIWORD(lParam); - - processed = HandleMouseMove(x, y, wParam); - } - break; + processed = HandleMouseMove(GET_X_LPARAM(lParam), + GET_Y_LPARAM(lParam), + wParam); + break; case WM_LBUTTONDOWN: // set focus to this window @@ -1921,12 +1926,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: - { - short x = LOWORD(lParam); - short y = HIWORD(lParam); - - processed = HandleMouseEvent(message, x, y, wParam); - } + processed = HandleMouseEvent(message, + GET_X_LPARAM(lParam), + GET_Y_LPARAM(lParam), + wParam); break; case MM_JOY1MOVE: @@ -1937,12 +1940,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) case MM_JOY2BUTTONDOWN: case MM_JOY1BUTTONUP: case MM_JOY2BUTTONUP: - { - int x = LOWORD(lParam); - int y = HIWORD(lParam); - - processed = HandleJoystickEvent(message, x, y, wParam); - } + processed = HandleJoystickEvent(message, + GET_X_LPARAM(lParam), + GET_Y_LPARAM(lParam), + wParam); break; case WM_SYSCOMMAND: @@ -2317,7 +2318,7 @@ void wxWindow::MSWDetachWindowMenu() continue; } - if ( wxStrcmp(buf, wxT("&Window")) == 0 ) + if ( wxStrcmp(buf, _("&Window")) == 0 ) { if ( !::RemoveMenu(hMenu, i, MF_BYPOSITION) ) { @@ -2359,10 +2360,14 @@ bool wxWindow::MSWCreate(int id, 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; + if ( x != -1 ) + x1 = x; + if ( y != -1 ) + y1 = y; + if ( width != -1 ) + width1 = width; + if ( height != -1 ) + height1 = height; // unfortunately, setting WS_EX_CONTROLPARENT only for some windows in the // hierarchy with several embedded panels (and not all of them) causes the @@ -3162,6 +3167,7 @@ bool wxWindow::HandleGetMinMaxInfo(void *mmInfo) } // generate an artificial resize event +/* FUNCTION IS NOW A MEMBER OF wxFrame - gt void wxWindow::SendSizeEvent() { RECT r; @@ -3177,6 +3183,7 @@ void wxWindow::SendSizeEvent() (void)::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(r.right - r.left, r.bottom - r.top)); } +*/ // --------------------------------------------------------------------------- // command messages @@ -3227,6 +3234,17 @@ bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) return GetEventHandler()->ProcessEvent(event); } +#if wxUSE_SPINCTRL + else + { + // the text ctrl which is logically part of wxSpinCtrl sends WM_COMMAND + // notifications to its parent which we want to reflect back to + // wxSpinCtrl + wxSpinCtrl *spin = wxSpinCtrl::GetSpinForTextCtrl(control); + if ( spin && spin->ProcessTextCommand(cmd, id) ) + return TRUE; + } +#endif // wxUSE_SPINCTRL return FALSE; }