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
This commit is contained in:
Julian Smart
2005-02-24 08:26:50 +00:00
parent fc46781591
commit 6aa0103384
4 changed files with 48 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ public:
// implementation only from now on // implementation only from now on
// ------------------------------- // -------------------------------
// implement base class virtuals
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected: protected:
virtual wxBorder GetDefaultBorder() const; virtual wxBorder GetDefaultBorder() const;
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;

View File

@@ -39,6 +39,9 @@ public:
long style = 0, long style = 0,
const wxString& name = wxStaticBoxNameStr); const wxString& name = wxStaticBoxNameStr);
/// Implementation
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;

View File

@@ -262,4 +262,20 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
::InvalidateRect(GetHwndOf(GetParent()), &rect, TRUE); ::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 #endif // wxUSE_STATBMP

View File

@@ -151,4 +151,30 @@ wxSize wxStaticBox::DoGetBestSize() const
return wxSize(wBox, hBox); 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 #endif // wxUSE_STATBOX