]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/statusbar.cpp
Disable some wxWebView tests that fail on the buildbot but not locally.
[wxWidgets.git] / src / msw / statusbar.cpp
index b82db9553bef168a5213b7b2b94a65b53e2f470a..48960afe2203a4a726539e1e94b9da83e8725687 100644 (file)
@@ -229,12 +229,11 @@ void wxStatusBar::MSWUpdateFieldsWidths()
     int *pWidths = new int[count];
 
     int nCurPos = 0;
-    for ( int i = 0; i < count; i++ )
+    int i;
+    for ( i = 0; i < count; i++ )
     {
         nCurPos += widthsAbs[i] + extraWidth;
         pWidths[i] = nCurPos;
-
-        DoUpdateStatusText(i);
     }
 
     // The total width of the panes passed to Windows must be equal to the
@@ -247,6 +246,12 @@ void wxStatusBar::MSWUpdateFieldsWidths()
         wxLogLastError("StatusBar_SetParts");
     }
 
+    // Now that all parts have been created, set their text.
+    for ( i = 0; i < count; i++ )
+    {
+        DoUpdateStatusText(i);
+    }
+
     delete [] pWidths;
 }
 
@@ -400,7 +405,18 @@ const wxStatusBar::MSWMetrics& wxStatusBar::MSWGetMetrics()
 
 void wxStatusBar::SetMinHeight(int height)
 {
-    SendMessage(GetHwnd(), SB_SETMINHEIGHT, height + 2*GetBorderY(), 0);
+    // It looks like we need to count the border twice to really make the
+    // controls taking exactly height pixels fully fit in the status bar:
+    // at least under Windows 7 the checkbox in the custom status bar of the
+    // statbar sample gets truncated otherwise.
+    height += 4*GetBorderY();
+
+    // We need to set the size and not the size to reflect the height because
+    // wxFrame uses our size and not the minimal size as it assumes that the
+    // size of a status bar never changes anyhow.
+    SetSize(-1, height);
+
+    SendMessage(GetHwnd(), SB_SETMINHEIGHT, height, 0);
 
     // we have to send a (dummy) WM_SIZE to redraw it now
     SendMessage(GetHwnd(), WM_SIZE, 0, 0);
@@ -470,11 +486,10 @@ wxSize wxStatusBar::DoGetBestSize() const
         width = 2*DEFAULT_FIELD_WIDTH;
     }
 
-    // calculate height
-    int height;
-    wxGetCharSize(GetHWND(), NULL, &height, GetFont());
-    height = EDIT_HEIGHT_FROM_CHAR_HEIGHT(height);
-    height += borders.vert;
+    // calculate height: by default it should be just big enough to show text
+    // (see SetMinHeight() for the explanation of 4 factor)
+    int height = GetCharHeight();
+    height += 4*borders.vert;
 
     wxSize best(width, height);
     CacheBestSize(best);