Add wxMouseEvent::GetColumnsPerAction().
This is similar to the existing GetLinesPerAction() but is for, surprise, columns. Also change the documentation to say that the value returned by both of these methods is 3 under "most platforms" as some wxOSX currently uses 1 and not 3. Closes #15239. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -670,6 +670,7 @@ All (GUI):
|
|||||||
- Add wxWindow::BeginRepositioningChildren() and EndRepositioningChildren().
|
- Add wxWindow::BeginRepositioningChildren() and EndRepositioningChildren().
|
||||||
- Fix wxStyledTextCtrl::SetInsertionPointEnd() (troelsk).
|
- Fix wxStyledTextCtrl::SetInsertionPointEnd() (troelsk).
|
||||||
- Add wxFileDialog::GetCurrentlySelectedFilename() (Carl Godkin).
|
- Add wxFileDialog::GetCurrentlySelectedFilename() (Carl Godkin).
|
||||||
|
- Add wxMouseEvent::GetColumnsPerAction() (toiffel).
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -1747,9 +1747,13 @@ public:
|
|||||||
wxMouseWheelAxis 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 three.
|
||||||
int GetLinesPerAction() const { return m_linesPerAction; }
|
int GetLinesPerAction() const { return m_linesPerAction; }
|
||||||
|
|
||||||
|
// Returns the configured number of columns (or whatever) to be scrolled per
|
||||||
|
// wheel action. Defaults to three.
|
||||||
|
int GetColumnsPerAction() const { return m_columnsPerAction; }
|
||||||
|
|
||||||
// Is the system set to do page scrolling?
|
// Is the system set to do page scrolling?
|
||||||
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
|
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
|
||||||
|
|
||||||
@@ -1770,6 +1774,7 @@ public:
|
|||||||
int m_wheelRotation;
|
int m_wheelRotation;
|
||||||
int m_wheelDelta;
|
int m_wheelDelta;
|
||||||
int m_linesPerAction;
|
int m_linesPerAction;
|
||||||
|
int m_columnsPerAction;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Assign(const wxMouseEvent& evt);
|
void Assign(const wxMouseEvent& evt);
|
||||||
|
@@ -86,6 +86,9 @@
|
|||||||
#ifndef SPI_GETWHEELSCROLLLINES
|
#ifndef SPI_GETWHEELSCROLLLINES
|
||||||
#define SPI_GETWHEELSCROLLLINES 104
|
#define SPI_GETWHEELSCROLLLINES 104
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SPI_GETWHEELSCROLLCHARS
|
||||||
|
#define SPI_GETWHEELSCROLLCHARS 108
|
||||||
|
#endif
|
||||||
#endif // wxUSE_MOUSEWHEEL
|
#endif // wxUSE_MOUSEWHEEL
|
||||||
|
|
||||||
// Needed by window.cpp
|
// Needed by window.cpp
|
||||||
|
@@ -2725,10 +2725,26 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
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 three.
|
wheel action.
|
||||||
|
|
||||||
|
Default value under most platforms is three.
|
||||||
|
|
||||||
|
@see GetColumnsPerAction()
|
||||||
*/
|
*/
|
||||||
int GetLinesPerAction() const;
|
int GetLinesPerAction() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the configured number of columns (or whatever) to be scrolled per
|
||||||
|
wheel action.
|
||||||
|
|
||||||
|
Default value under most platforms is three.
|
||||||
|
|
||||||
|
@see GetLinesPerAction()
|
||||||
|
|
||||||
|
@since 2.9.5
|
||||||
|
*/
|
||||||
|
int GetColumnsPerAction() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
translation set for the DC, which usually indicates that the window has been
|
||||||
|
@@ -565,6 +565,7 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType)
|
|||||||
m_wheelRotation = 0;
|
m_wheelRotation = 0;
|
||||||
m_wheelDelta = 0;
|
m_wheelDelta = 0;
|
||||||
m_linesPerAction = 0;
|
m_linesPerAction = 0;
|
||||||
|
m_columnsPerAction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMouseEvent::Assign(const wxMouseEvent& event)
|
void wxMouseEvent::Assign(const wxMouseEvent& event)
|
||||||
@@ -587,6 +588,7 @@ void wxMouseEvent::Assign(const wxMouseEvent& event)
|
|||||||
m_wheelRotation = event.m_wheelRotation;
|
m_wheelRotation = event.m_wheelRotation;
|
||||||
m_wheelDelta = event.m_wheelDelta;
|
m_wheelDelta = event.m_wheelDelta;
|
||||||
m_linesPerAction = event.m_linesPerAction;
|
m_linesPerAction = event.m_linesPerAction;
|
||||||
|
m_columnsPerAction = event.m_columnsPerAction;
|
||||||
m_wheelAxis = event.m_wheelAxis;
|
m_wheelAxis = event.m_wheelAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1649,6 +1649,7 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
|
|||||||
|
|
||||||
// FIXME: Get these values from GTK or GDK
|
// FIXME: Get these values from GTK or GDK
|
||||||
event.m_linesPerAction = 3;
|
event.m_linesPerAction = 3;
|
||||||
|
event.m_columnsPerAction = 3;
|
||||||
event.m_wheelDelta = 120;
|
event.m_wheelDelta = 120;
|
||||||
|
|
||||||
// Determine the scroll direction.
|
// Determine the scroll direction.
|
||||||
|
@@ -1332,6 +1332,7 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
|
|||||||
if (event.GetEventType() == wxEVT_MOUSEWHEEL)
|
if (event.GetEventType() == wxEVT_MOUSEWHEEL)
|
||||||
{
|
{
|
||||||
event.m_linesPerAction = 3;
|
event.m_linesPerAction = 3;
|
||||||
|
event.m_columnsPerAction = 3;
|
||||||
event.m_wheelDelta = 120;
|
event.m_wheelDelta = 120;
|
||||||
if (((GdkEventButton*)gdk_event)->button == 4)
|
if (((GdkEventButton*)gdk_event)->button == 4)
|
||||||
event.m_wheelRotation = 120;
|
event.m_wheelRotation = 120;
|
||||||
|
@@ -5607,7 +5607,20 @@ wxWindowMSW::HandleMouseWheel(wxMouseWheelAxis axis,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int s_columnsPerRotation = -1;
|
||||||
|
if ( s_columnsPerRotation == -1 )
|
||||||
|
{
|
||||||
|
if ( !::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0,
|
||||||
|
&s_columnsPerRotation, 0))
|
||||||
|
{
|
||||||
|
// this setting is not supported on Windows 2000/XP, so use the value of 1
|
||||||
|
// http://msdn.microsoft.com/en-us/library/ms997498.aspx
|
||||||
|
s_columnsPerRotation = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event.m_linesPerAction = s_linesPerRotation;
|
event.m_linesPerAction = s_linesPerRotation;
|
||||||
|
event.m_columnsPerAction = s_columnsPerRotation;
|
||||||
return HandleWindowEvent(event);
|
return HandleWindowEvent(event);
|
||||||
|
|
||||||
#else // !wxUSE_MOUSEWHEEL
|
#else // !wxUSE_MOUSEWHEEL
|
||||||
|
@@ -542,6 +542,7 @@ WXDLLEXPORT void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEve
|
|||||||
wxevent.m_wheelRotation = delta;
|
wxevent.m_wheelRotation = delta;
|
||||||
wxevent.m_wheelDelta = 1;
|
wxevent.m_wheelDelta = 1;
|
||||||
wxevent.m_linesPerAction = 1;
|
wxevent.m_linesPerAction = 1;
|
||||||
|
wxevent.m_columnsPerAction = 1;
|
||||||
if ( axis == kEventMouseWheelAxisX )
|
if ( axis == kEventMouseWheelAxisX )
|
||||||
wxevent.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
|
wxevent.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
|
||||||
}
|
}
|
||||||
|
@@ -682,6 +682,7 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
|||||||
|
|
||||||
wxevent.m_wheelDelta = 10;
|
wxevent.m_wheelDelta = 10;
|
||||||
wxevent.m_linesPerAction = 1;
|
wxevent.m_linesPerAction = 1;
|
||||||
|
wxevent.m_columnsPerAction = 1;
|
||||||
|
|
||||||
if ( fabs(deltaX) > fabs(deltaY) )
|
if ( fabs(deltaX) > fabs(deltaY) )
|
||||||
{
|
{
|
||||||
|
@@ -1486,6 +1486,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent,
|
|||||||
button = xevent->xbutton.button;
|
button = xevent->xbutton.button;
|
||||||
|
|
||||||
wxevent.m_linesPerAction = 3;
|
wxevent.m_linesPerAction = 3;
|
||||||
|
wxevent.m_columnsPerAction = 3;
|
||||||
wxevent.m_wheelDelta = WHEEL_DELTA;
|
wxevent.m_wheelDelta = WHEEL_DELTA;
|
||||||
|
|
||||||
// Button 4 means mousewheel up, 5 means down
|
// Button 4 means mousewheel up, 5 means down
|
||||||
|
Reference in New Issue
Block a user