]> git.saurik.com Git - wxWidgets.git/commitdiff
Set correct toolbar width in wxMSW wxFrame.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Dec 2009 02:59:16 +0000 (02:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Dec 2009 02:59:16 +0000 (02:59 +0000)
The hack introduced in r22410 artificially set wrong size for toolbar under
MSW. This completely breaks any calculations that can be done using it (e.g.
to find the space available for the stretchable part of the toolbar) and is
completely and utterly unexpected.

Revert it, toolbar flicker must be dealt in another way if it is still a
problem.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/frame.cpp

index db4b37bd17d687b3c18b2988a5aabec631d9db91..b7348f020e6bfeeebfd891fef3ab89a17b47cdb2 100644 (file)
@@ -697,49 +697,23 @@ void wxFrame::PositionToolBar()
                 tx = 0;
         }
 
-        int desiredW = tw;
-        int desiredH = th;
+        int desiredW,
+            desiredH;
 
         if ( toolbar->IsVertical() )
         {
+            desiredW = tw;
             desiredH = height;
         }
         else
         {
             desiredW = width;
+            desiredH = th;
         }
 
-        // use the 'real' MSW position here, don't offset relativly to the
+        // use the 'real' MSW position here, don't offset relatively to the
         // client area origin
-
-        // Optimise such that we don't have to always resize the toolbar
-        // when the frame changes, otherwise we'll get a lot of flicker.
-        bool heightChanging wxDUMMY_INITIALIZE(true);
-        bool widthChanging wxDUMMY_INITIALIZE(true);
-
-        if ( toolbar->IsVertical() )
-        {
-            // It's OK if the current height is greater than what can be shown.
-            heightChanging = (desiredH > th) ;
-            widthChanging = (desiredW != tw) ;
-
-            // The next time around, we may not have to set the size
-            if (heightChanging)
-                desiredH = desiredH + 200;
-        }
-        else
-        {
-            // It's OK if the current width is greater than what can be shown.
-            widthChanging = (desiredW > tw) ;
-            heightChanging = (desiredH != th) ;
-
-            // The next time around, we may not have to set the size
-            if (widthChanging)
-                desiredW = desiredW + 200;
-        }
-
-        if (tx != 0 || ty != 0 || widthChanging || heightChanging)
-            toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS);
+        toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS);
 
     }
 #endif // !WINCE_WITH_COMMANDBAR