]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/button.cpp
Clipboard usage fixes inspired by Tinderbox logs.
[wxWidgets.git] / src / os2 / button.cpp
index 5c4e70d5a0804ffe3e16b92b5a4d96048b9a8f0f..d75aa8258af152a2274f71c7900c935866cf8958 100644 (file)
@@ -23,6 +23,7 @@
     #include "wx/scrolwin.h"
 #endif
 
+#include "wx/stockitem.h"
 #include "wx/os2/private.h"
 
 #define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10)
@@ -43,7 +44,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
 bool wxButton::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
-, const wxString&                   rsLabel
+, const wxString&                   rsLbl
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
@@ -51,6 +52,9 @@ bool wxButton::Create(
 , const wxString&                   rsName
 )
 {
+    wxString rsLabel(rsLbl);
+    if (rsLabel.empty() && wxIsStockID(vId))
+        rsLabel = wxGetStockLabel(vId);
 
     wxString                        sLabel = ::wxPMTextToLabel(rsLabel);
 
@@ -137,6 +141,7 @@ wxSize wxButton::DoGetBestSize() const
     int                             nWidthButton;
     int                             nWidthChar;
     int                             nHeightChar;
+    wxFont                          vFont = (wxFont)GetFont();
 
     GetTextExtent( rsLabel
                   ,&nWidthButton
@@ -146,7 +151,7 @@ wxSize wxButton::DoGetBestSize() const
     wxGetCharSize( GetHWND()
                   ,&nWidthChar
                   ,&nHeightChar
-                  ,(wxFont*)&GetFont()
+                  ,&vFont
                  );
 
     //