]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/checkbox.cpp
Added showing the default URL in DisplayContents and DisplayIndex
[wxWidgets.git] / src / msw / checkbox.cpp
index 04856bb161197294cf204ab74e170724c5e0d897..3e10a30ec20096159a2cf0f59c8b098ad115c901 100644 (file)
@@ -31,6 +31,8 @@
 #ifndef WX_PRECOMP
     #include "wx/checkbox.h"
     #include "wx/brush.h"
+    #include "wx/dcscreen.h"
+    #include "wx/settings.h"
 #endif
 
 #include "wx/msw/private.h"
@@ -142,29 +144,36 @@ bool wxCheckBox::Create(wxWindow *parent,
 
 void wxCheckBox::SetLabel(const wxString& label)
 {
-  SetWindowText(GetHwnd(), label);
+    SetWindowText(GetHwnd(), label);
 }
 
-#define CHECK_SIZE 13
-
 wxSize wxCheckBox::DoGetBestSize() const
 {
-    int wCheckbox, hCheckbox;
+    static int s_checkSize = 0;
+
+    if ( !s_checkSize )
+    {
+        wxScreenDC dc;
+        dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+
+        s_checkSize = (3*dc.GetCharHeight())/2;
+    }
 
     wxString str = wxGetWindowText(GetHWND());
 
+    int wCheckbox, hCheckbox;
     if ( !str.IsEmpty() )
     {
         GetTextExtent(str, &wCheckbox, &hCheckbox);
-        wCheckbox += CHECK_SIZE;
+        wCheckbox += s_checkSize + GetCharWidth();
 
-        if ( hCheckbox < CHECK_SIZE )
-            hCheckbox = CHECK_SIZE;
+        if ( hCheckbox < s_checkSize )
+            hCheckbox = s_checkSize;
     }
     else
     {
-        wCheckbox = CHECK_SIZE;
-        hCheckbox = CHECK_SIZE;
+        wCheckbox = s_checkSize;
+        hCheckbox = s_checkSize;
     }
 
     return wxSize(wCheckbox, hCheckbox);
@@ -184,7 +193,7 @@ bool wxCheckBox::GetValue() const
 #ifdef __WIN32__
   return (SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) == BST_CHECKED);
 #else
-  return ((0x003 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x003);
+  return ((0x001 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x001);
 #endif
 }