use focused bitmap as fallback for the hover one
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -40,7 +40,11 @@ to be set.}
|
|||||||
\twocolitem{\windowstyle{focus}}{Bitmap shown when the button has keyboard
|
\twocolitem{\windowstyle{focus}}{Bitmap shown when the button has keyboard
|
||||||
focus but is not pressed.}
|
focus but is not pressed.}
|
||||||
\twocolitem{\windowstyle{hover}}{Bitmap shown when the mouse is over the
|
\twocolitem{\windowstyle{hover}}{Bitmap shown when the mouse is over the
|
||||||
button (but it is not pressed).}
|
button (but it is not pressed). Notice that if hover bitmap is not specified
|
||||||
|
but the current platform UI uses hover images for the buttons (such as Windows
|
||||||
|
XP or GTK+), then the focus bitmap is used for hover state as well. This makes
|
||||||
|
it possible to set focus bitmap only to get reasonably good behaviour on all
|
||||||
|
platforms.}
|
||||||
\end{twocollist}
|
\end{twocollist}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -51,7 +51,9 @@ public:
|
|||||||
virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
|
virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// reimplement some base class virtuals
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
virtual void OnSetBitmap();
|
||||||
|
|
||||||
// invalidate m_brushDisabled when system colours change
|
// invalidate m_brushDisabled when system colours change
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
|
#include "wx/msw/uxtheme.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// macros
|
// macros
|
||||||
@@ -204,6 +205,26 @@ void wxBitmapButton::OnMouseEnterOrLeave(wxMouseEvent& event)
|
|||||||
event.Skip();
|
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
|
// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN
|
||||||
#define FOCUS_MARGIN 3
|
#define FOCUS_MARGIN 3
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user