diff --git a/common/widgets/split_button.cpp b/common/widgets/split_button.cpp index 6916a0edff..db3518a9c0 100644 --- a/common/widgets/split_button.cpp +++ b/common/widgets/split_button.cpp @@ -93,11 +93,11 @@ void SPLIT_BUTTON::SetWidthPadding( int aPadding ) } -void SPLIT_BUTTON::SetBitmap( const wxBitmap& aBmp ) +void SPLIT_BUTTON::SetBitmap( const wxBitmapBundle& aBmp ) { m_bitmap = aBmp; - SetMinSize( wxSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() ) ); + SetMinSize( m_bitmap.GetPreferredBitmapSizeFor( this ) ); } @@ -284,16 +284,17 @@ void SPLIT_BUTTON::OnPaint( wxPaintEvent& WXUNUSED( aEvent ) ) if( m_bitmap.IsOk() ) { - wxMemoryDC mdc( m_bitmap ); + wxBitmap bmp = m_bitmap.GetBitmapFor( this ); + wxMemoryDC mdc( bmp ); - r1.x = ( width - m_bitmap.GetWidth() ) / 2; + r1.x = ( width - bmp.GetWidth() ) / 2; if( r1.x < 0 ) r1.x = 0; - r1.y += ( size.GetHeight() - m_bitmap.GetHeight() ) / 2; + r1.y += ( size.GetHeight() - bmp.GetHeight() ) / 2; - dc.Blit( wxPoint( r1.x, r1.y ), m_bitmap.GetSize(), &mdc, wxPoint( 0, 0 ), wxCOPY, true ); + dc.Blit( wxPoint( r1.x, r1.y ), bmp.GetSize(), &mdc, wxPoint( 0, 0 ), wxCOPY, true ); } else { diff --git a/include/widgets/split_button.h b/include/widgets/split_button.h index 564e1f0a5f..fbe913a65a 100644 --- a/include/widgets/split_button.h +++ b/include/widgets/split_button.h @@ -25,7 +25,7 @@ #ifndef __SPLIT_BUTTON_H__ #define __SPLIT_BUTTON_H__ -#include +#include #include class wxButton; @@ -40,7 +40,7 @@ public: ~SPLIT_BUTTON(); wxMenu* GetSplitButtonMenu(); - void SetBitmap( const wxBitmap& aBmp ); + void SetBitmap( const wxBitmapBundle& aBmp ); void SetMinSize( const wxSize& aSize ) override; void SetWidthPadding( int aPadding ); void SetLabel( const wxString& aLabel ) override; @@ -65,7 +65,7 @@ private: bool m_bLButtonDown = false; wxString m_label; wxMenu* m_pMenu = nullptr; - wxBitmap m_bitmap; + wxBitmapBundle m_bitmap; wxSize m_unadjustedMinSize; };