+ switch (e->what)
+ {
+ case EVT_MOUSEDOWN:
+ if ( e->message & EVT_LEFTBMASK )
+ type = (e->message & EVT_DBLCLICK) ?
+ wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN;
+ else if ( e->message & EVT_MIDDLEBMASK )
+ type = (e->message & EVT_DBLCLICK) ?
+ wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN;
+ else if ( e->message & EVT_RIGHTBMASK )
+ type = (e->message & EVT_DBLCLICK) ?
+ wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN;
+
+ if ( win->AcceptsFocus() && wxWindow::FindFocus() != win )
+ win->SetFocus();
+
+ break;
+
+ case EVT_MOUSEUP:
+ if ( e->message & EVT_LEFTBMASK )
+ type = wxEVT_LEFT_UP;
+ else if ( e->message & EVT_MIDDLEBMASK )
+ type = wxEVT_MIDDLE_UP;
+ else if ( e->message & EVT_RIGHTBMASK )
+ type = wxEVT_RIGHT_UP;
+ break;
+
+ case EVT_MOUSEMOVE:
+ if ( !gs_mouseCapture )
+ {
+ if ( win != gs_windowUnderMouse )
+ {
+ if ( gs_windowUnderMouse )
+ {
+ wxMouseEvent event2(event);
+ MGL_wmCoordGlobalToLocal(gs_windowUnderMouse->GetHandle(),
+ e->where_x, e->where_y,
+ &event2.m_x, &event2.m_y);
+
+ wxPoint orig(gs_windowUnderMouse->GetClientAreaOrigin());
+ event2.m_x -= orig.x;
+ event2.m_y -= orig.y;
+
+ event2.SetEventObject(gs_windowUnderMouse);
+ event2.SetEventType(wxEVT_LEAVE_WINDOW);
+ gs_windowUnderMouse->GetEventHandler()->ProcessEvent(event2);
+ }
+
+ wxMouseEvent event3(event);
+ event3.SetEventType(wxEVT_ENTER_WINDOW);
+ win->GetEventHandler()->ProcessEvent(event3);
+
+ gs_windowUnderMouse = win;
+ }
+ }
+ else // gs_mouseCapture
+ {
+ bool inside = (where.x >= 0 &&
+ where.y >= 0 &&
+ where.x < win->GetSize().x &&
+ where.y < win->GetSize().y);
+ if ( (inside && gs_windowUnderMouse != win) ||
+ (!inside && gs_windowUnderMouse == win) )
+ {
+ wxMouseEvent evt(inside ?
+ wxEVT_ENTER_WINDOW : wxEVT_LEAVE_WINDOW);
+ evt.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(evt);
+ gs_windowUnderMouse = inside ? win : NULL;
+ }
+ }
+
+ type = wxEVT_MOTION;
+ break;
+
+ default:
+ break;
+ }
+
+ if ( type == wxEVT_NULL )
+ {
+ return FALSE;
+ }
+ else
+ {
+ event.SetEventType(type);
+ return win->GetEventHandler()->ProcessEvent(event);
+ }