]> git.saurik.com Git - wxWidgets.git/commitdiff
don't set virtual size of the window to (0, 0) if scrollbars are removed from it
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Mar 2005 22:27:28 +0000 (22:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Mar 2005 22:27:28 +0000 (22:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/scrlwing.cpp
src/gtk/scrolwin.cpp
src/gtk1/scrolwin.cpp

index 4578f661933037ec4b1cac8dc855217d3ffb19ac..7add087eda7d460a22bb9d4d2f4e39e12f81d13c 100644 (file)
@@ -365,7 +365,11 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX,
 
     // The above should arguably be deprecated, this however we still need.
 
-    m_targetWindow->SetVirtualSize( w, h );
+    // take care not to set 0 virtual size, 0 means that we don't have any
+    // scrollbars and hence we should use the real size instead of the virtual
+    // one which is indicated by using wxDefaultCoord
+    m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord,
+                                    h ? h : wxDefaultCoord);
 
     if (do_refresh && !noRefresh)
         m_targetWindow->Refresh(true, GetScrollRect());
index 484aa181832fc513bb625e99d5bcbffc7621ddd0..5a31109d610f8b6c35de42d2aa24668bc3e58dca 100644 (file)
@@ -407,7 +407,10 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY,
     // a sizer might override this manual scrollbar setting in old code.
     // m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY );
 
-    m_targetWindow->SetVirtualSize( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY );
+    int w = noUnitsX * pixelsPerUnitX;
+    int h = noUnitsY * pixelsPerUnitY;
+    m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord,
+                                    h ? h : wxDefaultCoord);
 
     if (!noRefresh)
     {
index 484aa181832fc513bb625e99d5bcbffc7621ddd0..5a31109d610f8b6c35de42d2aa24668bc3e58dca 100644 (file)
@@ -407,7 +407,10 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY,
     // a sizer might override this manual scrollbar setting in old code.
     // m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY );
 
-    m_targetWindow->SetVirtualSize( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY );
+    int w = noUnitsX * pixelsPerUnitX;
+    int h = noUnitsY * pixelsPerUnitY;
+    m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord,
+                                    h ? h : wxDefaultCoord);
 
     if (!noRefresh)
     {