generate mouse events for all static controls, not just wxStaticLine (patch 1276413 by Jamie Gadd)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-08-30 13:54:29 +00:00
parent 4ce18ecb66
commit 42b1fb630d
6 changed files with 19 additions and 39 deletions

View 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:

View 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;

View 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

View File

@@ -32,15 +32,6 @@
#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

View 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;
}

View 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)
{