X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fdc16adf72fbd051d1f4ffdbc8d35d00b3e2837..98af9c738332c9a24475ad19efbfabe2b152c429:/src/msw/bmpbuttn.cpp diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 0ff7de5424..3ca9fe2050 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -26,6 +26,7 @@ #include "wx/msw/private.h" #include "wx/image.h" +#include "wx/msw/uxtheme.h" // ---------------------------------------------------------------------------- // macros @@ -204,6 +205,26 @@ void wxBitmapButton::OnMouseEnterOrLeave(wxMouseEvent& event) event.Skip(); } +void wxBitmapButton::OnSetBitmap() +{ + // if the focus bitmap is specified but hover one isn't, use the focus + // bitmap for hovering as well if this is consistent with the current + // Windows version look and feel + // + // rationale: this is compatible with the old wxGTK behaviour and also + // makes it much easier to do "the right thing" for all platforms (some of + // them, such as Windows XP, have "hot" buttons while others don't) + if ( !m_bmpHover.Ok() && + m_bmpFocus.Ok() && + wxUxThemeEngine::GetIfActive() ) + { + m_bmpHover = m_bmpFocus; + } + + // this will redraw us + wxBitmapButtonBase::OnSetBitmap(); +} + // VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN #define FOCUS_MARGIN 3