Use enum for wxMouseEvent::m_wheelAxis instead of int.
This variable can take only 2 values, use symbolic names for them instead of difficult to understand 0 and 1. See ##14105. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1448,6 +1448,12 @@ private:
|
|||||||
wxEVT_RIGHT_DCLICK
|
wxEVT_RIGHT_DCLICK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
enum wxMouseWheelAxis
|
||||||
|
{
|
||||||
|
wxMOUSE_WHEEL_VERTICAL,
|
||||||
|
wxMOUSE_WHEEL_HORIZONTAL
|
||||||
|
};
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
|
class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
|
||||||
public wxMouseState
|
public wxMouseState
|
||||||
{
|
{
|
||||||
@@ -1535,10 +1541,10 @@ public:
|
|||||||
// should occur for each delta.
|
// should occur for each delta.
|
||||||
int GetWheelDelta() const { return m_wheelDelta; }
|
int GetWheelDelta() const { return m_wheelDelta; }
|
||||||
|
|
||||||
// Gets the axis the wheel operation concerns, 0 being the y axis as on
|
// Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL
|
||||||
// most mouse wheels, 1 is the x axis for things like MightyMouse scrolls
|
// (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling
|
||||||
// or horizontal trackpad scrolling
|
// using e.g. a trackpad).
|
||||||
int GetWheelAxis() const { return m_wheelAxis; }
|
wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; }
|
||||||
|
|
||||||
// Returns the configured number of lines (or whatever) to be scrolled per
|
// Returns the configured number of lines (or whatever) to be scrolled per
|
||||||
// wheel action. Defaults to one.
|
// wheel action. Defaults to one.
|
||||||
@@ -1560,7 +1566,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
int m_clickCount;
|
int m_clickCount;
|
||||||
|
|
||||||
int m_wheelAxis;
|
wxMouseWheelAxis m_wheelAxis;
|
||||||
int m_wheelRotation;
|
int m_wheelRotation;
|
||||||
int m_wheelDelta;
|
int m_wheelDelta;
|
||||||
int m_linesPerAction;
|
int m_linesPerAction;
|
||||||
|
@@ -2187,6 +2187,16 @@ public:
|
|||||||
wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Possible axis values for mouse wheel scroll events.
|
||||||
|
|
||||||
|
@since 2.9.4
|
||||||
|
*/
|
||||||
|
enum wxMouseWheelAxis
|
||||||
|
{
|
||||||
|
wxMOUSE_WHEEL_VERTICAL, ///< Vertical scroll event.
|
||||||
|
wxMOUSE_WHEEL_HORIZONTAL ///< Horizontal scroll event.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2440,12 +2450,16 @@ public:
|
|||||||
int GetWheelRotation() const;
|
int GetWheelRotation() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the axis the wheel operation concerns; @c 0 is the Y axis as on
|
Gets the axis the wheel operation concerns.
|
||||||
most mouse wheels, @c 1 is the X axis.
|
|
||||||
|
|
||||||
Note that only some models of mouse have horizontal wheel axis.
|
Usually the mouse wheel is used to scroll vertically so @c
|
||||||
|
wxMOUSE_WHEEL_VERTICAL is returned but some mice (and most trackpads)
|
||||||
|
also allow to use the wheel to scroll horizontally in which case
|
||||||
|
@c wxMOUSE_WHEEL_HORIZONTAL is returned.
|
||||||
|
|
||||||
|
Notice that before wxWidgets 2.9.4 this method returned @c int.
|
||||||
*/
|
*/
|
||||||
int GetWheelAxis() const;
|
wxMouseWheelAxis GetWheelAxis() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if the event was a mouse button event (not necessarily a button
|
Returns @true if the event was a mouse button event (not necessarily a button
|
||||||
|
@@ -554,10 +554,10 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType)
|
|||||||
|
|
||||||
m_clickCount = -1;
|
m_clickCount = -1;
|
||||||
|
|
||||||
|
m_wheelAxis = wxMOUSE_WHEEL_VERTICAL;
|
||||||
m_wheelRotation = 0;
|
m_wheelRotation = 0;
|
||||||
m_wheelDelta = 0;
|
m_wheelDelta = 0;
|
||||||
m_linesPerAction = 0;
|
m_linesPerAction = 0;
|
||||||
m_wheelAxis = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMouseEvent::Assign(const wxMouseEvent& event)
|
void wxMouseEvent::Assign(const wxMouseEvent& event)
|
||||||
|
@@ -547,7 +547,7 @@ WXDLLEXPORT void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEve
|
|||||||
wxevent.m_wheelDelta = 1;
|
wxevent.m_wheelDelta = 1;
|
||||||
wxevent.m_linesPerAction = 1;
|
wxevent.m_linesPerAction = 1;
|
||||||
if ( axis == kEventMouseWheelAxisX )
|
if ( axis == kEventMouseWheelAxisX )
|
||||||
wxevent.m_wheelAxis = 1;
|
wxevent.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
|
@@ -633,7 +633,7 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
|||||||
|
|
||||||
if ( fabs(deltaX) > fabs(deltaY) )
|
if ( fabs(deltaX) > fabs(deltaY) )
|
||||||
{
|
{
|
||||||
wxevent.m_wheelAxis = 1;
|
wxevent.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
|
||||||
wxevent.m_wheelRotation = (int)deltaX;
|
wxevent.m_wheelRotation = (int)deltaX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user