]> git.saurik.com Git - wxWidgets.git/commitdiff
Determine wxButton size correctly in wxMSW.
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Jan 2010 11:51:00 +0000 (11:51 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Jan 2010 11:51:00 +0000 (11:51 +0000)
Instead of using default size for default GUI font, use the default font
for this dialog's current font.

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

src/msw/button.cpp

index 67494356d6945d474ca012e5e00d19d34b62f29c..ad3f9a452fa01f4e93db1e53e9594647ce17ebd8 100644 (file)
@@ -457,7 +457,10 @@ wxSize wxMSWButton::ComputeBestSize(wxControl *btn)
     // creating the button
     if ( !btn->HasFlag(wxBU_EXACTFIT) )
     {
-        wxSize sizeDef = wxButton::GetDefaultSize();
+        // The size of a standard button in the dialog units is 50x14, use it.
+        // Note that we intentionally don't use GetDefaultSize() here, because
+        // it's inexact -- dialog units depend on this dialog's font.
+        wxSize sizeDef = btn->ConvertDialogToPixels(wxSize(50, 14));
         if ( sizeBtn.x < sizeDef.x )
             sizeBtn.x = sizeDef.x;
         if ( sizeBtn.y < sizeDef.y )