diff --git a/common/widgets/bitmap_button.cpp b/common/widgets/bitmap_button.cpp index 7ca136e07a..46263b603d 100644 --- a/common/widgets/bitmap_button.cpp +++ b/common/widgets/bitmap_button.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2020 Ian McInerney - * Copyright (C) 2020-2022 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2023 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -95,7 +95,11 @@ void BITMAP_BUTTON::SetPadding( int aPadding ) void BITMAP_BUTTON::SetBitmap( const wxBitmapBundle& aBmp ) { m_normalBitmap = aBmp; - m_unadjustedMinSize = aBmp.GetPreferredBitmapSizeFor( this ); +#ifdef __WXMAC__ + m_unadjustedMinSize = m_normalBitmap.GetDefaultSize(); +#else + m_unadjustedMinSize = m_normalBitmap.GetPreferredBitmapSizeFor( this ); +#endif SetMinSize( wxSize( m_unadjustedMinSize.GetWidth() + ( m_padding * 2 ), m_unadjustedMinSize.GetHeight() + ( m_padding * 2 ) ) ); diff --git a/common/widgets/split_button.cpp b/common/widgets/split_button.cpp index db3518a9c0..3d8315453f 100644 --- a/common/widgets/split_button.cpp +++ b/common/widgets/split_button.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2016 Anil8735(https://stackoverflow.com/users/3659387/anil8753) * from https://stackoverflow.com/a/37274011 - * Copyright (C) 2020-2022 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2023 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -97,7 +97,11 @@ void SPLIT_BUTTON::SetBitmap( const wxBitmapBundle& aBmp ) { m_bitmap = aBmp; +#ifdef __WXMAC__ + SetMinSize( m_bitmap.GetDefaultSize() ); +#else SetMinSize( m_bitmap.GetPreferredBitmapSizeFor( this ) ); +#endif } @@ -284,17 +288,22 @@ void SPLIT_BUTTON::OnPaint( wxPaintEvent& WXUNUSED( aEvent ) ) if( m_bitmap.IsOk() ) { +#ifdef __WXMAC__ + wxSize bmpSize = m_bitmap.GetDefaultSize(); +#else + wxSize bmpSize = m_bitmap.GetPreferredBitmapSizeFor( this ); +#endif wxBitmap bmp = m_bitmap.GetBitmapFor( this ); wxMemoryDC mdc( bmp ); - r1.x = ( width - bmp.GetWidth() ) / 2; + r1.x = ( width - bmpSize.GetWidth() ) / 2; if( r1.x < 0 ) r1.x = 0; - r1.y += ( size.GetHeight() - bmp.GetHeight() ) / 2; + r1.y += ( size.GetHeight() - bmpSize.GetHeight() ) / 2; - dc.Blit( wxPoint( r1.x, r1.y ), bmp.GetSize(), &mdc, wxPoint( 0, 0 ), wxCOPY, true ); + dc.Blit( wxPoint( r1.x, r1.y ), bmpSize, &mdc, wxPoint( 0, 0 ), wxCOPY, true ); } else { diff --git a/common/widgets/std_bitmap_button.cpp b/common/widgets/std_bitmap_button.cpp index 7ddf6c797e..0251439593 100644 --- a/common/widgets/std_bitmap_button.cpp +++ b/common/widgets/std_bitmap_button.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2016 Anil8735(https://stackoverflow.com/users/3659387/anil8753) * from https://stackoverflow.com/a/37274011 - * Copyright (C) 2020-2022 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2023 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -76,7 +76,12 @@ void STD_BITMAP_BUTTON::onThemeChanged( wxSysColourChangedEvent &aEvent ) void STD_BITMAP_BUTTON::SetBitmap( const wxBitmapBundle& aBmp ) { m_bitmap = aBmp; - wxSize size = aBmp.GetPreferredBitmapSizeFor( this ); + +#ifdef __WXMAC__ + wxSize size = m_bitmap.GetDefaultSize(); +#else + wxSize size = m_bitmap.GetPreferredBitmapSizeFor( this ); +#endif SetMinSize( wxSize( size.GetWidth() + 8, size.GetHeight() + 8 ) ); } @@ -206,7 +211,11 @@ void STD_BITMAP_BUTTON::OnPaint( wxPaintEvent& WXUNUSED( aEvent ) ) if( m_bitmap.IsOk() ) { +#ifdef __WXMAC__ + wxSize bmpSize = m_bitmap.GetDefaultSize(); +#else wxSize bmpSize = m_bitmap.GetPreferredBitmapSizeFor( this ); +#endif r1.x = ( size.GetWidth() - bmpSize.GetWidth() ) / 2;