cleanup of TrackMouseEvent() code (use a single #ifdef instead of 3 different ones to test for the same thing)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-02-20 15:07:19 +00:00
parent 8067659371
commit 4e5c6c33c5

View File

@@ -118,9 +118,13 @@
#include "wx/msw/missing.h" #include "wx/msw/missing.h"
#if defined(__WXWINCE__) #if defined(__WXWINCE__)
#include "wx/msw/wince/missing.h" #include "wx/msw/wince/missing.h"
#endif #endif
#if defined(TME_LEAVE) && defined(WM_MOUSELEAVE)
#define HAVE_TRACKMOUSEEVENT
#endif // everything needed for TrackMouseEvent()
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// global variables // global variables
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1246,7 +1250,7 @@ bool wxWindowMSW::IsMouseInWindow() const
void wxWindowMSW::OnInternalIdle() void wxWindowMSW::OnInternalIdle()
{ {
#ifdef __WXWINCE__ #ifndef HAVE_TRACKMOUSEEVENT
// Check if we need to send a LEAVE event // Check if we need to send a LEAVE event
if ( m_mouseInWindow ) if ( m_mouseInWindow )
{ {
@@ -1257,7 +1261,7 @@ void wxWindowMSW::OnInternalIdle()
GenerateMouseLeave(); GenerateMouseLeave();
} }
} }
#endif // !__WXWINCE__ #endif // !HAVE_TRACKMOUSEEVENT
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this))
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
@@ -2360,23 +2364,20 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
wParam); wParam);
break; break;
#ifdef WM_MOUSELEAVE #ifdef HAVE_TRACKMOUSEEVENT
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
// filter out excess WM_MOUSELEAVE events sent after PopupMenu() (on XP at least)
if ( m_mouseInWindow )
{ {
// filter out excess WM_MOUSELEAVE events sent after PopupMenu() (on XP at least) GenerateMouseLeave();
if ( m_mouseInWindow )
{
GenerateMouseLeave();
}
// always pass processed back as false, this allows the window
// manager to process the message too. This is needed to
// ensure windows XP themes work properly as the mouse moves
// over widgets like buttons.
processed = false;
} }
// always pass processed back as false, this allows the window
// manager to process the message too. This is needed to
// ensure windows XP themes work properly as the mouse moves
// over widgets like buttons. So don't set processed to true here.
break; break;
#endif // WM_MOUSELEAVE #endif // HAVE_TRACKMOUSEEVENT
#if wxUSE_MOUSEWHEEL #if wxUSE_MOUSEWHEEL
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:
@@ -4418,17 +4419,18 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags)
{ {
// Generate an ENTER event // Generate an ENTER event
m_mouseInWindow = true; m_mouseInWindow = true;
#ifndef __WXWINCE__
TRACKMOUSEEVENT trackinfo;
trackinfo.cbSize = sizeof(trackinfo); #ifdef HAVE_TRACKMOUSEEVENT
WinStruct<TRACKMOUSEEVENT> trackinfo;
trackinfo.dwFlags = TME_LEAVE; trackinfo.dwFlags = TME_LEAVE;
trackinfo.hwndTrack = GetHwnd(); trackinfo.hwndTrack = GetHwnd();
//Use the commctrl.h _TrackMouseEvent, which will call the
// appropriate TrackMouseEvent or emulate it ( win95 ) // Use the commctrl.h _TrackMouseEvent(), which will call the real
// else we need _WIN32_WINNT >= 0x0400 // TrackMouseEvent() if available or emulate it
_TrackMouseEvent(&trackinfo); _TrackMouseEvent(&trackinfo);
#endif // __WXWINCE__ #endif // HAVE_TRACKMOUSEEVENT
wxMouseEvent event(wxEVT_ENTER_WINDOW); wxMouseEvent event(wxEVT_ENTER_WINDOW);
InitMouseEvent(event, x, y, flags); InitMouseEvent(event, x, y, flags);