Added mouse wheel support for MSW. It generates a wxMouseEvent with a
type of wxEVT_MOUSEWHEEL. wxMouseEvent has new members and accessors to transport mouse wheel rotation data. New members and accessors are documented. wxGenericScrolledWindow modified to turn mouse wheel events into scroll actions. Added wxUSE_MOUSEWHEEL to setup0.h to allow disabling the platform specific parts. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -50,6 +50,7 @@ functions that take a wxMouseEvent argument.
|
|||||||
\twocolitem{{\bf EVT\_MOTION(func)}}{Process a wxEVT\_MOTION event.}
|
\twocolitem{{\bf EVT\_MOTION(func)}}{Process a wxEVT\_MOTION event.}
|
||||||
\twocolitem{{\bf EVT\_ENTER\_WINDOW(func)}}{Process a wxEVT\_ENTER\_WINDOW event.}
|
\twocolitem{{\bf EVT\_ENTER\_WINDOW(func)}}{Process a wxEVT\_ENTER\_WINDOW event.}
|
||||||
\twocolitem{{\bf EVT\_LEAVE\_WINDOW(func)}}{Process a wxEVT\_LEAVE\_WINDOW event.}
|
\twocolitem{{\bf EVT\_LEAVE\_WINDOW(func)}}{Process a wxEVT\_LEAVE\_WINDOW event.}
|
||||||
|
\twocolitem{{\bf EVT\_MOUSEWHEEL(func)}}{Process a wxEVT\_MOUSEWHEEL event.}
|
||||||
\twocolitem{{\bf EVT\_MOUSE\_EVENTS(func)}}{Process all mouse events.}
|
\twocolitem{{\bf EVT\_MOUSE\_EVENTS(func)}}{Process all mouse events.}
|
||||||
\end{twocollist}%
|
\end{twocollist}%
|
||||||
|
|
||||||
@@ -85,12 +86,6 @@ TRUE if the middle mouse button is currently pressed down.
|
|||||||
|
|
||||||
TRUE if the right mouse button is currently pressed down.
|
TRUE if the right mouse button is currently pressed down.
|
||||||
|
|
||||||
\membersection{wxMouseEvent::m\_leftDown}
|
|
||||||
|
|
||||||
\member{bool}{m\_leftDown}
|
|
||||||
|
|
||||||
TRUE if the left mouse button is currently pressed down.
|
|
||||||
|
|
||||||
\membersection{wxMouseEvent::m\_metaDown}
|
\membersection{wxMouseEvent::m\_metaDown}
|
||||||
|
|
||||||
\member{bool}{m\_metaDown}
|
\member{bool}{m\_metaDown}
|
||||||
@@ -115,6 +110,26 @@ X-coordinate of the event.
|
|||||||
|
|
||||||
Y-coordinate of the event.
|
Y-coordinate of the event.
|
||||||
|
|
||||||
|
\membersection{wxMouseEvent::m\_wheelRotation}
|
||||||
|
|
||||||
|
\member{int}{m\_wheelRotation}
|
||||||
|
|
||||||
|
The distance the mouse wheel is rotated.
|
||||||
|
|
||||||
|
\membersection{wxMouseEvent::m\_wheelDelta}
|
||||||
|
|
||||||
|
\member{int}{m\_wheelDelta}
|
||||||
|
|
||||||
|
The wheel delta, normally 120.
|
||||||
|
|
||||||
|
\membersection{wxMouseEvent::m\_linesPerAction}
|
||||||
|
|
||||||
|
\member{int}{m\_linesPerAction}
|
||||||
|
|
||||||
|
The configured number of lines (or whatever) to be scrolled per wheel
|
||||||
|
action.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxMouseEvent::wxMouseEvent}
|
\membersection{wxMouseEvent::wxMouseEvent}
|
||||||
|
|
||||||
\func{}{wxMouseEvent}{\param{WXTYPE}{ mouseEventType = 0}, \param{int}{ id = 0}}
|
\func{}{wxMouseEvent}{\param{WXTYPE}{ mouseEventType = 0}, \param{int}{ id = 0}}
|
||||||
@@ -135,6 +150,7 @@ Constructor. Valid event types are:
|
|||||||
\item {\bf wxEVT\_RIGHT\_UP}
|
\item {\bf wxEVT\_RIGHT\_UP}
|
||||||
\item {\bf wxEVT\_RIGHT\_DCLICK}
|
\item {\bf wxEVT\_RIGHT\_DCLICK}
|
||||||
\item {\bf wxEVT\_MOTION}
|
\item {\bf wxEVT\_MOTION}
|
||||||
|
\item {\bf wxEVT\_MOUSEWHEEL}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\membersection{wxMouseEvent::AltDown}
|
\membersection{wxMouseEvent::AltDown}
|
||||||
@@ -217,6 +233,34 @@ Returns the physical mouse position in pixels.
|
|||||||
Returns the logical mouse position in pixels (i.e. translated according to the
|
Returns the logical mouse position in pixels (i.e. translated according to the
|
||||||
translation set for the DC, which usually indicates that the window has been scrolled).
|
translation set for the DC, which usually indicates that the window has been scrolled).
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMouseEvent::GetLinesPerAction}\label{wxmouseeventgetlinesperaction}
|
||||||
|
|
||||||
|
\constfunc{int}{GetLinesPerAction}{\void}
|
||||||
|
|
||||||
|
Returns the configured number of lines (or whatever) to be scrolled per
|
||||||
|
wheel action. Defaults to one.
|
||||||
|
|
||||||
|
\membersection{wxMouseEvent::GetWheelRotation}\label{wxmouseeventgetwheelrotation}
|
||||||
|
|
||||||
|
\constfunc{int}{GetWheelRotation}{\void}
|
||||||
|
|
||||||
|
Get wheel rotation, positive or negative indicates direction of
|
||||||
|
rotation. Current devices all send an event when rotation is equal to
|
||||||
|
+/-WheelDelta, but this allows for finer resolution devices to be
|
||||||
|
created in the future. Because of this you shouldn't assume that one
|
||||||
|
event is equal to 1 line or whatever, but you should be able to either
|
||||||
|
do partial line scrolling or wait until +/-WheelDelta rotation values
|
||||||
|
have been accumulated before scrolling.
|
||||||
|
|
||||||
|
\membersection{wxMouseEvent::GetWheelDelta}\label{wxmouseeventgetwheeldelta}
|
||||||
|
|
||||||
|
\constfunc{int}{GetWheelDelta}{\void}
|
||||||
|
|
||||||
|
Get wheel delta, normally 120. This is the threshold for action to be
|
||||||
|
taken, and one such action (for example, scrolling one increment)
|
||||||
|
should occur for each delta.
|
||||||
|
|
||||||
\membersection{wxMouseEvent::GetX}\label{wxmouseeventgetx}
|
\membersection{wxMouseEvent::GetX}\label{wxmouseeventgetx}
|
||||||
|
|
||||||
\constfunc{long}{GetX}{\void}
|
\constfunc{long}{GetX}{\void}
|
||||||
|
@@ -151,6 +151,7 @@ BEGIN_DECLARE_EVENT_TYPES()
|
|||||||
DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111)
|
DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111)
|
||||||
DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112)
|
DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112)
|
||||||
DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113)
|
DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113)
|
||||||
|
DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 114)
|
||||||
|
|
||||||
// Non-client mouse events
|
// Non-client mouse events
|
||||||
DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200)
|
DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200)
|
||||||
@@ -669,6 +670,25 @@ public:
|
|||||||
// Get Y position
|
// Get Y position
|
||||||
wxCoord GetY() const { return m_y; }
|
wxCoord GetY() const { return m_y; }
|
||||||
|
|
||||||
|
// Get wheel rotation, positive or negative indicates direction of
|
||||||
|
// rotation. Current devices all send an event when rotation is equal to
|
||||||
|
// +/-WheelDelta, but this allows for finer resolution devices to be
|
||||||
|
// created in the future. Because of this you shouldn't assume that one
|
||||||
|
// event is equal to 1 line or whatever, but you should be able to either
|
||||||
|
// do partial line scrolling or wait until +/-WheelDelta rotation values
|
||||||
|
// have been accumulated before scrolling.
|
||||||
|
int GetWheelRotation() const { return m_wheelRotation; }
|
||||||
|
|
||||||
|
// Get wheel delta, normally 120. This is the threshold for action to be
|
||||||
|
// taken, and one such action (for example, scrolling one increment)
|
||||||
|
// should occur for each delta.
|
||||||
|
int GetWheelDelta() const { return m_wheelDelta; }
|
||||||
|
|
||||||
|
// Returns the configured number of lines (or whatever) to be scrolled per
|
||||||
|
// wheel action. Defaults to one.
|
||||||
|
int GetLinesPerAction() const { return m_linesPerAction; }
|
||||||
|
|
||||||
|
|
||||||
void CopyObject(wxObject& obj) const;
|
void CopyObject(wxObject& obj) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -682,6 +702,10 @@ public:
|
|||||||
bool m_shiftDown;
|
bool m_shiftDown;
|
||||||
bool m_altDown;
|
bool m_altDown;
|
||||||
bool m_metaDown;
|
bool m_metaDown;
|
||||||
|
|
||||||
|
int m_wheelRotation;
|
||||||
|
int m_wheelDelta;
|
||||||
|
int m_linesPerAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cursor set event
|
// Cursor set event
|
||||||
@@ -1756,6 +1780,7 @@ typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
|
|||||||
#define EVT_RIGHT_DCLICK(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
#define EVT_RIGHT_DCLICK(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
||||||
#define EVT_LEAVE_WINDOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
#define EVT_LEAVE_WINDOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
||||||
#define EVT_ENTER_WINDOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
#define EVT_ENTER_WINDOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
||||||
|
#define EVT_MOUSEWHEEL(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
||||||
|
|
||||||
// All mouse events
|
// All mouse events
|
||||||
#define EVT_MOUSE_EVENTS(func) \
|
#define EVT_MOUSE_EVENTS(func) \
|
||||||
@@ -1770,7 +1795,8 @@ typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
|
|||||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
DECLARE_EVENT_TABLE_ENTRY( wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
||||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
DECLARE_EVENT_TABLE_ENTRY( wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
||||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
DECLARE_EVENT_TABLE_ENTRY( wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
||||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),\
|
||||||
|
DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
|
||||||
|
|
||||||
// EVT_COMMAND
|
// EVT_COMMAND
|
||||||
#define EVT_COMMAND(id, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
#define EVT_COMMAND(id, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||||
|
@@ -126,6 +126,7 @@ public:
|
|||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
|
void OnMouseWheel(wxMouseEvent& event);
|
||||||
|
|
||||||
// Calculate scroll increment
|
// Calculate scroll increment
|
||||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||||
@@ -144,6 +145,7 @@ protected:
|
|||||||
int m_yScrollLinesPerPage;
|
int m_yScrollLinesPerPage;
|
||||||
double m_scaleX;
|
double m_scaleX;
|
||||||
double m_scaleY;
|
double m_scaleY;
|
||||||
|
int m_wheelRotation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -532,6 +532,9 @@
|
|||||||
#define wxUSE_WX_RESOURCES 1
|
#define wxUSE_WX_RESOURCES 1
|
||||||
// Use .wxr resource mechanism (requires PrologIO library)
|
// Use .wxr resource mechanism (requires PrologIO library)
|
||||||
|
|
||||||
|
#define wxUSE_MOUSEWHEEL 1
|
||||||
|
// Include mouse wheel support
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// postscript support settings
|
// postscript support settings
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -327,6 +327,7 @@ public:
|
|||||||
|
|
||||||
bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
|
bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
|
||||||
bool HandleMouseMove(int x, int y, WXUINT flags);
|
bool HandleMouseMove(int x, int y, WXUINT flags);
|
||||||
|
bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = FALSE);
|
bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = FALSE);
|
||||||
bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam);
|
bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
@@ -150,6 +150,7 @@ DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK)
|
|||||||
DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK)
|
DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS)
|
DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS)
|
DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS)
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_MOUSEWHEEL)
|
||||||
|
|
||||||
// Non-client mouse events
|
// Non-client mouse events
|
||||||
DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN)
|
DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN)
|
||||||
@@ -414,6 +415,9 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType)
|
|||||||
m_middleDown = FALSE;
|
m_middleDown = FALSE;
|
||||||
m_x = 0;
|
m_x = 0;
|
||||||
m_y = 0;
|
m_y = 0;
|
||||||
|
m_wheelRotation = 0;
|
||||||
|
m_wheelDelta = 0;
|
||||||
|
m_linesPerAction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMouseEvent::CopyObject(wxObject& obj_d) const
|
void wxMouseEvent::CopyObject(wxObject& obj_d) const
|
||||||
|
@@ -68,6 +68,7 @@ BEGIN_EVENT_TABLE(wxGenericScrolledWindow, wxPanel)
|
|||||||
EVT_SIZE(wxGenericScrolledWindow::OnSize)
|
EVT_SIZE(wxGenericScrolledWindow::OnSize)
|
||||||
EVT_PAINT(wxGenericScrolledWindow::OnPaint)
|
EVT_PAINT(wxGenericScrolledWindow::OnPaint)
|
||||||
EVT_CHAR(wxGenericScrolledWindow::OnChar)
|
EVT_CHAR(wxGenericScrolledWindow::OnChar)
|
||||||
|
EVT_MOUSEWHEEL(wxGenericScrolledWindow::OnMouseWheel)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericScrolledWindow, wxPanel)
|
IMPLEMENT_DYNAMIC_CLASS(wxGenericScrolledWindow, wxPanel)
|
||||||
@@ -94,6 +95,7 @@ wxGenericScrolledWindow::wxGenericScrolledWindow()
|
|||||||
m_yScrollLinesPerPage = 0;
|
m_yScrollLinesPerPage = 0;
|
||||||
m_scaleX = 1.0;
|
m_scaleX = 1.0;
|
||||||
m_scaleY = 1.0;
|
m_scaleY = 1.0;
|
||||||
|
m_wheelRotation = 0;
|
||||||
m_targetWindow = (wxWindow*) NULL;
|
m_targetWindow = (wxWindow*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +118,7 @@ bool wxGenericScrolledWindow::Create(wxWindow *parent,
|
|||||||
m_yScrollLinesPerPage = 0;
|
m_yScrollLinesPerPage = 0;
|
||||||
m_scaleX = 1.0;
|
m_scaleX = 1.0;
|
||||||
m_scaleY = 1.0;
|
m_scaleY = 1.0;
|
||||||
|
m_wheelRotation = 0;
|
||||||
|
|
||||||
m_targetWindow = this;
|
m_targetWindow = this;
|
||||||
|
|
||||||
@@ -702,3 +705,24 @@ void wxGenericScrolledWindow::OnChar(wxKeyEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxGenericScrolledWindow::OnMouseWheel(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
int lines;
|
||||||
|
int vsx, vsy;
|
||||||
|
|
||||||
|
m_wheelRotation += event.GetWheelRotation();
|
||||||
|
lines = m_wheelRotation / event.GetWheelDelta();
|
||||||
|
m_wheelRotation -= lines * event.GetWheelDelta();
|
||||||
|
|
||||||
|
if (lines != 0) {
|
||||||
|
lines *= event.GetLinesPerAction();
|
||||||
|
GetViewStart(&vsx, &vsy);
|
||||||
|
Scroll(-1, vsy - lines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -108,6 +108,15 @@
|
|||||||
#define SIF_TRACKPOS 16
|
#define SIF_TRACKPOS 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_MOUSEWHEEL
|
||||||
|
#ifndef WM_MOUSEWHEEL
|
||||||
|
#define WM_MOUSEWHEEL 0x020A
|
||||||
|
#define WHEEL_DELTA 120
|
||||||
|
#define SPI_GETWHEELSCROLLLINES 104
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// global variables
|
// global variables
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -1910,6 +1919,12 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
wParam);
|
wParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if wxUSE_MOUSEWHEEL
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
processed = HandleMouseWheel(wParam, lParam);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
// set focus to this window
|
// set focus to this window
|
||||||
if (AcceptsFocus())
|
if (AcceptsFocus())
|
||||||
@@ -3347,6 +3362,31 @@ bool wxWindow::HandleMouseMove(int x, int y, WXUINT flags)
|
|||||||
return HandleMouseEvent(WM_MOUSEMOVE, x, y, flags);
|
return HandleMouseEvent(WM_MOUSEMOVE, x, y, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxWindow::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam)
|
||||||
|
{
|
||||||
|
#if wxUSE_MOUSEWHEEL
|
||||||
|
wxMouseEvent event(wxEVT_MOUSEWHEEL);
|
||||||
|
InitMouseEvent(event,
|
||||||
|
GET_X_LPARAM(lParam),
|
||||||
|
GET_Y_LPARAM(lParam),
|
||||||
|
LOWORD(wParam));
|
||||||
|
|
||||||
|
event.m_wheelRotation = (short)HIWORD(wParam);
|
||||||
|
event.m_wheelDelta = WHEEL_DELTA;
|
||||||
|
|
||||||
|
int linesPer;
|
||||||
|
if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &linesPer, 0))
|
||||||
|
linesPer = 1;
|
||||||
|
event.m_linesPerAction = linesPer;
|
||||||
|
|
||||||
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// keyboard handling
|
// keyboard handling
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -4098,6 +4138,7 @@ const char *wxGetMessageName(int message)
|
|||||||
case 0x0207: return "WM_MBUTTONDOWN";
|
case 0x0207: return "WM_MBUTTONDOWN";
|
||||||
case 0x0208: return "WM_MBUTTONUP";
|
case 0x0208: return "WM_MBUTTONUP";
|
||||||
case 0x0209: return "WM_MBUTTONDBLCLK";
|
case 0x0209: return "WM_MBUTTONDBLCLK";
|
||||||
|
case 0x020A: return "WM_MOUSEWHEEL";
|
||||||
case 0x0210: return "WM_PARENTNOTIFY";
|
case 0x0210: return "WM_PARENTNOTIFY";
|
||||||
case 0x0211: return "WM_ENTERMENULOOP";
|
case 0x0211: return "WM_ENTERMENULOOP";
|
||||||
case 0x0212: return "WM_EXITMENULOOP";
|
case 0x0212: return "WM_EXITMENULOOP";
|
||||||
|
Reference in New Issue
Block a user