From: Julian Smart Date: Thu, 24 Feb 2005 08:26:50 +0000 (+0000) Subject: Restored mouse sensitivity for static box and static bitmap X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6aa0103384e632ea2106bf61000dc78b976064c1 Restored mouse sensitivity for static box and static bitmap git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/statbmp.h b/include/wx/msw/statbmp.h index 1e5dd35fce..ae0ed7219e 100644 --- a/include/wx/msw/statbmp.h +++ b/include/wx/msw/statbmp.h @@ -73,6 +73,9 @@ public: // implementation only from now on // ------------------------------- + // implement base class virtuals + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + protected: virtual wxBorder GetDefaultBorder() const; virtual wxSize DoGetBestSize() const; diff --git a/include/wx/msw/statbox.h b/include/wx/msw/statbox.h index 23735739d2..da34503f2c 100644 --- a/include/wx/msw/statbox.h +++ b/include/wx/msw/statbox.h @@ -39,6 +39,9 @@ public: long style = 0, const wxString& name = wxStaticBoxNameStr); + /// Implementation + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + protected: virtual wxSize DoGetBestSize() const; diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index e4b2399c4a..8ac78dc4f4 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -262,4 +262,20 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image) ::InvalidateRect(GetHwndOf(GetParent()), &rect, TRUE); } +// We need this for e.g. dialog editors. Please do not remove. +WXLRESULT wxStaticBitmap::MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#ifndef __WXWINCE__ + // Ensure that static items get messages. Some controls don't like this + // message to be intercepted (e.g. RichEdit), hence the tests. + if ( nMsg == WM_NCHITTEST ) + return (long)HTCLIENT; +#endif + + return wxWindow::MSWWindowProc(nMsg, wParam, lParam); +} + #endif // wxUSE_STATBMP + diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index eede3a9705..03b1de9c65 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -151,4 +151,30 @@ wxSize wxStaticBox::DoGetBestSize() const return wxSize(wBox, hBox); } +// Required for implementing dialog editors, please do not remove +WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + switch ( nMsg ) + { +#ifndef __WXWINCE__ + case WM_NCHITTEST: + { + int xPos = LOWORD(lParam); // horizontal position of cursor + int yPos = HIWORD(lParam); // vertical position of cursor + + ScreenToClient(&xPos, &yPos); + + // Make sure you can drag by the top of the groupbox, but let + // other (enclosed) controls get mouse events also + if ( yPos < 10 ) + return (long)HTCLIENT; + } + break; +#endif + } + + return wxControl::MSWWindowProc(nMsg, wParam, lParam); +} + #endif // wxUSE_STATBOX +