]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/scrlwing.cpp
More OS/2 update to fix some owner drawn things
[wxWidgets.git] / src / generic / scrlwing.cpp
index 2e0fff375165559a7c329a730508cda115adfe1b..ae4107a1fa280217d3f7aad0c9bd3f188bd16e80 100644 (file)
@@ -342,6 +342,8 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX,
 
     m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY );
 
+    AdjustScrollbars();
+
     if (do_refresh && !noRefresh)
         m_targetWindow->Refresh(TRUE, GetRect());
 
@@ -865,11 +867,13 @@ void wxScrollHelper::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) co
 // Default OnSize resets scrollbars, if any
 void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event))
 {
-    if( m_targetWindow != m_win )
+    if ( m_targetWindow != m_win )
         m_targetWindow->SetVirtualSize( m_targetWindow->GetClientSize() );
 
     m_win->SetVirtualSize( m_win->GetClientSize() );
 
+    AdjustScrollbars();
+
 #if wxUSE_CONSTRAINTS
     if (m_win->GetAutoLayout())
         m_win->Layout();
@@ -1088,26 +1092,34 @@ void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
 
     if (lines != 0)
     {
-        lines *= event.GetLinesPerAction();
 
         wxScrollWinEvent newEvent;
 
         newEvent.SetPosition(0);
         newEvent.SetOrientation(wxVERTICAL);
         newEvent.m_eventObject = m_win;
-        if (lines > 0)
-            newEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
-        else
-            newEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
 
-        int times = abs(lines);
-        for (; times > 0; times --)
+        if (event.IsPageScroll())
+        {
+            if (lines > 0)
+                newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+            else
+                newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+
             m_win->GetEventHandler()->ProcessEvent(newEvent);
+        }
+        else
+        {
+            lines *= event.GetLinesPerAction();
+            if (lines > 0)
+                newEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+            else
+                newEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
 
-        /* Old Way */
-        // int vsx, vsy;
-        // GetViewStart(&vsx, &vsy);
-        // Scroll(-1, vsy - lines);
+            int times = abs(lines);
+            for (; times > 0; times--)
+                m_win->GetEventHandler()->ProcessEvent(newEvent);
+        }
     }
 }
 
@@ -1159,12 +1171,6 @@ bool wxGenericScrolledWindow::Layout()
     return wxPanel::Layout();
 }
 
-void wxGenericScrolledWindow::DoSetVirtualSize( int x, int y )
-{
-    wxPanel::DoSetVirtualSize( x, y );
-    AdjustScrollbars();
-}
-
 void wxGenericScrolledWindow::OnPaint(wxPaintEvent& event)
 {
     // the user code didn't really draw the window if we got here, so set this