X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/837e57436a89516a5fa9f478f401e06bd872c17c..bdc72a22686ac141e9bc4559a1171d017fdcb094:/src/msw/bmpbuttn.cpp diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 4cad610d43..5f95f45a58 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -21,7 +21,7 @@ #endif #ifndef WX_PRECOMP -#include "wx/bmpbuttn.h" + #include "wx/bmpbuttn.h" #endif #include "wx/msw/private.h" @@ -75,8 +75,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit m_hWnd = (WXHWND)CreateWindowEx ( 0, - _T("BUTTON"), - _T(""), + wxT("BUTTON"), + wxT(""), WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW , 0, 0, 0, 0, GetWinHwnd(parent), @@ -155,7 +155,20 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) y1 ++; } - ::BitBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), memDC, 0, 0, SRCCOPY); + wxMask *mask = bitmap->GetMask(); + if ( mask ) + { + ::MaskBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), // dst + memDC, 0, 0, // src + (HBITMAP)mask->GetMaskBitmap(), 0, 0, // mask + MAKEROP4(SRCPAINT, SRCCOPY)); + } + else + { + ::BitBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), // dst + memDC, 0, 0, // src + SRCCOPY); + } if ( (state & ODS_DISABLED) && (GetWindowStyleFlag() & wxBU_AUTODRAW) ) DrawButtonDisable( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, TRUE ) ; @@ -232,7 +245,8 @@ void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, int right, int botto DeleteObject(brushFace); } -#define FOCUS_MARGIN 6 +// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN +#define FOCUS_MARGIN 3 void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ) { @@ -269,3 +283,7 @@ void wxBitmapButton::DrawButtonDisable( WXHDC dc, int left, int top, int right, ::SelectObject( (HDC) dc, old ) ; } +void wxBitmapButton::SetDefault() +{ + wxButton::SetDefault(); +}