#define BCM_SETSHIELD 0x160c
#endif
+#if wxUSE_UXTHEME
+extern wxWindowMSW *wxWindowBeingErased; // From src/msw/window.cpp
+#endif // wxUSE_UXTHEME
+
// ----------------------------------------------------------------------------
// button image data
// ----------------------------------------------------------------------------
wxODButtonImageData(wxButton *btn, const wxBitmap& bitmap)
{
SetBitmap(bitmap, wxButton::State_Normal);
+ SetBitmap(bitmap.ConvertToDisabled(), wxButton::State_Disabled);
m_dir = wxLEFT;
wxButton::State_Max),
m_hwndBtn(GetHwndOf(btn))
{
- // initialize all bitmaps to normal state
+ // initialize all bitmaps except for the disabled one to normal state
for ( int n = 0; n < wxButton::State_Max; n++ )
{
- m_iml.Add(bitmap);
+ m_iml.Add(n == wxButton::State_Disabled ? bitmap.ConvertToDisabled()
+ : bitmap);
}
m_data.himl = GetHimagelistOf(&m_iml);
);
// we must use WS_CLIPSIBLINGS with the buttons or they would draw over
- // each other in any resizeable dialog which has more than one button in
+ // each other in any resizable dialog which has more than one button in
// the bottom
msStyle |= WS_CLIPSIBLINGS;
iState
) )
{
+ // Set this button as the one whose background is being erased: this
+ // allows our WM_ERASEBKGND handler used by DrawThemeParentBackground()
+ // to correctly align the background brush with this window instead of
+ // the parent window to which WM_ERASEBKGND is sent. Notice that this
+ // doesn't work with custom user-defined EVT_ERASE_BACKGROUND handlers
+ // as they won't be aligned but unfortunately all the attempts to fix
+ // it by shifting DC origin before calling DrawThemeParentBackground()
+ // failed to work so we at least do this, even though this is far from
+ // being the perfect solution.
+ wxWindowBeingErased = button;
+
engine->DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn);
+
+ wxWindowBeingErased = NULL;
}
// draw background