]> git.saurik.com Git - wxWidgets.git/commitdiff
generate mouse events for all static controls, not just wxStaticLine (patch 1276413...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 30 Aug 2005 13:54:29 +0000 (13:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 30 Aug 2005 13:54:29 +0000 (13:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/msw/statbmp.h
src/msw/statbmp.cpp
src/msw/statline.cpp
src/msw/stattext.cpp
src/msw/window.cpp

index 1b3212f7cd88c3866dc34d108862b874edc3826f..924b80da01408b1622d5b800510d785737bfa230 100644 (file)
@@ -46,6 +46,7 @@ wxMSW:
 - Added wxDynamicLibrary::GetSymbolAorW().
 - Fixed default size of wxStaticText controls with border being too small.
 - Fixed bugs with wxStatusBar positioning (with or withour sizers) (Jamie Gadd)
+- Mouse events are now generated for all static controls (Jamie Gadd)
 
 wxGTK:
 
index ae0ed7219e932868acb0a78c8d629f801026ece7..1e5dd35fcedbde574e792e76f125506c96f3a307 100644 (file)
@@ -73,9 +73,6 @@ 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 61d7b01e76992ed7721305be9c01336335066c55..0aaaa141153e6a7f04ab9d77e3cbce961cff8a37 100644 (file)
@@ -188,7 +188,9 @@ WXDWORD wxStaticBitmap::MSWGetStyle(long style, WXDWORD *exstyle) const
 
     // we use SS_CENTERIMAGE to prevent the control from resizing the bitmap to
     // fit to its size -- this is unexpected and doesn't happen in other ports
-    msStyle |= SS_CENTERIMAGE;
+    //
+    // and SS_NOTIFY is necessary to receive mouse events
+    msStyle |= SS_CENTERIMAGE | SS_NOTIFY;
 
     return msStyle;
 }
@@ -268,28 +270,5 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
     ::InvalidateRect(GetHwndOf(GetParent()), &rect, TRUE);
 }
 
-WXLRESULT wxStaticBitmap::MSWWindowProc(WXUINT nMsg,
-                                   WXWPARAM wParam,
-                                   WXLPARAM lParam)
-{
-#ifndef __WXWINCE__
-    static int s_useHTClient = -1;
-    if (s_useHTClient == -1)
-        s_useHTClient = wxSystemOptions::GetOptionInt(wxT("msw.staticbitmap.htclient"));
-    if (s_useHTClient == 1)
-    {
-        // Ensure that static items get messages. Some controls don't like this
-        // message to be intercepted (e.g. RichEdit), hence the tests.
-        // Also, this code breaks some other processing such as enter/leave tracking
-        // so it's off by default.
-        
-        if ( nMsg == WM_NCHITTEST )
-            return (long)HTCLIENT;
-    }
-#endif
-
-    return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
-}
-
 #endif // wxUSE_STATBMP
 
index b96b03985eeb18960b4465fde0d7719ebf3f1acd..9f8dc7f91c1596f09e0b8ce730ed46460e2ff15a 100644 (file)
 #if wxUSE_STATLINE
 
 #include "wx/msw/private.h"
-#include "wx/log.h"
-
-#ifndef SS_SUNKEN
-    #define SS_SUNKEN 0x00001000L
-#endif
-
-#ifndef SS_NOTIFY
-    #define SS_NOTIFY 0x00000100L
-#endif
 
 // ============================================================================
 // implementation
index 7eaa18b562f7638180c40fcb94065205469913c9..36ee6273759e165deaa41c5950709a2e2c85c4d4 100644 (file)
@@ -123,6 +123,9 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
     else
         msStyle |= SS_LEFT;
 
+    // this style is necessary to receive mouse events
+    msStyle |= SS_NOTIFY;
+
     return msStyle;
 }
 
index 894af154e316dfb4713ed6fb881422bb5cca84a5..64bf883fc57404a29a6b6bc3308e33c6f11806ec 100644 (file)
@@ -165,8 +165,10 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd);
 // get the text metrics for the current font
 static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win);
 
+#ifdef __WXWINCE__
 // find the window for the mouse event at the specified position
-static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y); //TW:REQ:Univ
+static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y);
+#endif // __WXWINCE__
 
 // wrapper around BringWindowToTop() API
 static inline void wxBringWindowToTop(HWND hwnd)
@@ -2503,8 +2505,10 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
                 int x = GET_X_LPARAM(lParam),
                     y = GET_Y_LPARAM(lParam);
 
+#ifdef __WXWINCE__
                 // redirect the event to a static control if necessary by
-                // finding one under mouse
+                // finding one under mouse because under CE the static controls
+                // don't generate mouse events (even with SS_NOTIFY)
                 wxWindowMSW *win;
                 if ( GetCapture() == this )
                 {
@@ -2520,6 +2524,9 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
                     wxCHECK_MSG( win, 0,
                                  _T("FindWindowForMouseEvent() returned NULL") );
                 }
+#else // !__WXWINCE__
+                wxWindowMSW *win = this;
+#endif // __WXWINCE__/!__WXWINCE__
 
                 processed = win->HandleMouseEvent(message, x, y, wParam);
 
@@ -4468,6 +4475,7 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event,
 #endif // wxUSE_MOUSEEVENT_HACK
 }
 
+#ifdef __WXWINCE__
 // Windows doesn't send the mouse events to the static controls (which are
 // transparent in the sense that their WM_NCHITTEST handler returns
 // HTTRANSPARENT) at all but we want all controls to receive the mouse events
@@ -4478,7 +4486,7 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event,
 // Notice that this is not done for the mouse move events because this could
 // (would?) be too slow, but only for clicks which means that the static texts
 // still don't get move, enter nor leave events.
-static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y) //TW:REQ:Univ
+static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y)
 {
     wxCHECK_MSG( x && y, win, _T("NULL pointer in FindWindowForMouseEvent") );
 
@@ -4531,6 +4539,7 @@ static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y) //
 
     return win;
 }
+#endif // __WXWINCE__
 
 bool wxWindowMSW::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags)
 {