Restore wxButton's feature to use focus bitmap for hover state (wxMSW)
Prior to 2.9.2, if the focus bitmap was specified but current one wasn't, the focus bitmap was used for hovering as well.
This feature was entirely discarded in b4354db179
(see wxBitmapButton::DoSetBitmap) but it is still described in the documentation of wxButton's states and images. It seems it was removed unintentionally, so let's restore it.
This commit is contained in:
parent
52d6b0ae85
commit
627870be90
@ -42,7 +42,7 @@
|
||||
@li @b current: bitmap shown when the mouse is over the button (but it is
|
||||
not pressed although it may have focus). Notice that if current 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
|
||||
buttons (such as Windows 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.
|
||||
|
||||
|
@ -747,6 +747,19 @@ void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which)
|
||||
else
|
||||
{
|
||||
m_imageData->SetBitmap(bitmap, which);
|
||||
|
||||
// if the focus bitmap is specified but current 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, have "hot"
|
||||
// buttons while others don't)
|
||||
if ( which == State_Focused && !m_imageData->GetBitmap(State_Current).IsOk() )
|
||||
{
|
||||
m_imageData->SetBitmap(bitmap, State_Current);
|
||||
}
|
||||
}
|
||||
|
||||
// it should be enough to only invalidate the best size when the normal
|
||||
|
Loading…
Reference in New Issue
Block a user