]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxMouseEvent::GetColumnsPerAction().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 10 Jun 2013 15:53:29 +0000 (15:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 10 Jun 2013 15:53:29 +0000 (15:53 +0000)
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

docs/changes.txt
include/wx/event.h
include/wx/msw/missing.h
interface/wx/event.h
src/common/event.cpp
src/gtk/window.cpp
src/gtk1/window.cpp
src/msw/window.cpp
src/osx/carbon/nonownedwnd.cpp
src/osx/cocoa/window.mm
src/x11/window.cpp

index 3093cd06b1ebf71bc8b4c8e0d7ef2ab67ae6c4ed..4cd8f39acb426df1f119bdfeaf7dddd7e3147b21 100644 (file)
@@ -670,6 +670,7 @@ All (GUI):
 - Add wxWindow::BeginRepositioningChildren() and EndRepositioningChildren().
 - Fix wxStyledTextCtrl::SetInsertionPointEnd() (troelsk).
 - Add wxFileDialog::GetCurrentlySelectedFilename() (Carl Godkin).
+- Add wxMouseEvent::GetColumnsPerAction() (toiffel).
 
 wxGTK:
 
index 87a1a6a304f07bfccfab7b9fa9c11ec76d60c032..38303aaae61cf1aeff5f703e9a864d432ceec7cb 100644 (file)
@@ -1747,9 +1747,13 @@ public:
     wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; }
 
     // 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; }
 
+    // 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?
     bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
 
@@ -1770,6 +1774,7 @@ public:
     int           m_wheelRotation;
     int           m_wheelDelta;
     int           m_linesPerAction;
+    int           m_columnsPerAction;
 
 protected:
     void Assign(const wxMouseEvent& evt);
index 9efb9f6ab58753ce504b9ef6486625615a3379f3..0582e12a41696120cf91705c97410cf0ad677065 100644 (file)
@@ -86,6 +86,9 @@
     #ifndef SPI_GETWHEELSCROLLLINES
         #define SPI_GETWHEELSCROLLLINES 104
     #endif
+    #ifndef SPI_GETWHEELSCROLLCHARS
+        #define SPI_GETWHEELSCROLLCHARS 108
+    #endif
 #endif // wxUSE_MOUSEWHEEL
 
 // Needed by window.cpp
index f56d4b2435595b18bebcc5198d61ec6115d60048..b9cc77bfe636742bb46cdb97def629725b5282a8 100644 (file)
@@ -2725,10 +2725,26 @@ public:
 
     /**
         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;
 
+    /**
+        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
         translation set for the DC, which usually indicates that the window has been
index c7d1d33bde6753459de6f61194dfbf8c0db89dc0..2733450352c406cee3678be9b364f69837c9df7e 100644 (file)
@@ -565,6 +565,7 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType)
     m_wheelRotation = 0;
     m_wheelDelta = 0;
     m_linesPerAction = 0;
+    m_columnsPerAction = 0;
 }
 
 void wxMouseEvent::Assign(const wxMouseEvent& event)
@@ -587,6 +588,7 @@ void wxMouseEvent::Assign(const wxMouseEvent& event)
     m_wheelRotation = event.m_wheelRotation;
     m_wheelDelta = event.m_wheelDelta;
     m_linesPerAction = event.m_linesPerAction;
+    m_columnsPerAction = event.m_columnsPerAction;
     m_wheelAxis = event.m_wheelAxis;
 }
 
index 52e2c2354171716d4b3972afe8ff7e2cf552fedf..e6d8aeba8ab5ee75587771f11ded2a00fd5385c1 100644 (file)
@@ -1649,6 +1649,7 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
 
     // FIXME: Get these values from GTK or GDK
     event.m_linesPerAction = 3;
+    event.m_columnsPerAction = 3;
     event.m_wheelDelta = 120;
 
     // Determine the scroll direction.
index da39d7a90e2b06feef4d524846df54c28a08ac7a..9dc790f7ffb81b9310fc6eeb857986ea51f02f9a 100644 (file)
@@ -1332,6 +1332,7 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
     if (event.GetEventType() == wxEVT_MOUSEWHEEL)
     {
        event.m_linesPerAction = 3;
+       event.m_columnsPerAction = 3;
        event.m_wheelDelta = 120;
        if (((GdkEventButton*)gdk_event)->button == 4)
            event.m_wheelRotation = 120;
index 6cef9564b7476a4bbdfb686a7228719ef2bb3357..08710f5f7b762eb7bb1d151a5d089f06665ee7ac 100644 (file)
@@ -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_columnsPerAction = s_columnsPerRotation;
     return HandleWindowEvent(event);
 
 #else // !wxUSE_MOUSEWHEEL
index 45344b01a6e6372f42dd5a062e1d448a93f887b5..d3216858bf52a8b24c14c95a2d2dac1bd1ecb45e 100644 (file)
@@ -542,6 +542,7 @@ WXDLLEXPORT void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEve
             wxevent.m_wheelRotation = delta;
             wxevent.m_wheelDelta = 1;
             wxevent.m_linesPerAction = 1;
+            wxevent.m_columnsPerAction = 1;
             if ( axis == kEventMouseWheelAxisX )
                 wxevent.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
         }
index e7d038a84c09654f37db213afee71c5284d7bcb3..0f48ef78883aa5780c5c5f0682d3d605df522549 100644 (file)
@@ -682,6 +682,7 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
             
             wxevent.m_wheelDelta = 10;
             wxevent.m_linesPerAction = 1;
+            wxevent.m_columnsPerAction = 1;
                 
             if ( fabs(deltaX) > fabs(deltaY) )
             {
index fcd2ee3deac78e523f0793b868a147505322616b..fccabf677d9b84aa82b70ef72ee137879498d3a8 100644 (file)
@@ -1486,6 +1486,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent,
                     button = xevent->xbutton.button;
 
                     wxevent.m_linesPerAction = 3;
+                    wxevent.m_columnsPerAction = 3;
                     wxevent.m_wheelDelta = WHEEL_DELTA;
 
                     // Button 4 means mousewheel up, 5 means down