X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d381e983ebdc0e3e9b1980c3a3420940476a0e1e..659863d8a73d02626f4060bb1099fe7bfd80d22a:/src/msw/bmpbuttn.cpp diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 8f0acde1a9..e20d012df2 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -23,10 +23,10 @@ #ifndef WX_PRECOMP #include "wx/log.h" #include "wx/dcmemory.h" + #include "wx/image.h" #endif #include "wx/msw/private.h" -#include "wx/image.h" #include "wx/msw/uxtheme.h" @@ -184,7 +184,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, SubclassWin(m_hWnd); SetPosition(pos); - SetBestSize(size); + SetInitialSize(size); return true; } @@ -408,8 +408,7 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) } // draw the bitmap - wxClientDC dst; - dst.SetHDC((WXHDC) hDC, false); + wxDCTemp dst((WXHDC)hDC); dst.DrawBitmap(*bitmap, x1, y1, true); return true; @@ -583,11 +582,6 @@ wxBitmapButton::DrawButtonDisable( WXHDC dc, ::PatBlt( (HDC) dc, left, top, right, bottom, PATTERNPAINT); } -void wxBitmapButton::SetDefault() -{ - wxButton::SetDefault(); -} - wxSize wxBitmapButton::DoGetBestSize() const { if ( m_bmpNormal.Ok() ) @@ -619,8 +613,10 @@ wxSize wxBitmapButton::DoGetBestSize() const // them and it just makes them appear larger than needed if ( !HasFlag(wxBORDER_NONE) ) { - marginH = margins.cxLeftWidth + margins.cxRightWidth; - marginV = margins.cyTopHeight + margins.cyBottomHeight; + // we need 2 extra pixels for the focus rectangle, without them + // it's overwritten by the bitmap itself + marginH = margins.cxLeftWidth + margins.cxRightWidth + 2; + marginV = margins.cyTopHeight + margins.cyBottomHeight + 2; } } else