]> git.saurik.com Git - wxWidgets.git/commitdiff
Restored mouse sensitivity for static box and static bitmap
authorJulian Smart <julian@anthemion.co.uk>
Thu, 24 Feb 2005 08:26:50 +0000 (08:26 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 24 Feb 2005 08:26:50 +0000 (08:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/statbmp.h
include/wx/msw/statbox.h
src/msw/statbmp.cpp
src/msw/statbox.cpp

index 1e5dd35fcedbde574e792e76f125506c96f3a307..ae0ed7219e932868acb0a78c8d629f801026ece7 100644 (file)
@@ -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;
index 23735739d2dcc007db49ea533d67a9866cc2b5d1..da34503f2c5afbfe2c42b7fae44abdd98a90e150 100644 (file)
@@ -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;
 
index e4b2399c4a27e21aeb9c6b0cb7025d4139f190be..8ac78dc4f4249bd4dc07078d82f955e9d4880e96 100644 (file)
@@ -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
+
index eede3a9705d8a0b4154d835177a994050eff76c2..03b1de9c657f5a592111536ecc64a2c0777c5f98 100644 (file)
@@ -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
+