From 57e35c9a603b4de89c5f02ed4e8ea6e6f422f376 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Tue, 2 Jun 2020 00:05:55 +0100 Subject: [PATCH] Fix infobar bitmap size Fixes https://gitlab.com/kicad/code/kicad/issues/4514 --- common/widgets/infobar.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/common/widgets/infobar.cpp b/common/widgets/infobar.cpp index 817a5a921d..f7335cfaa7 100644 --- a/common/widgets/infobar.cpp +++ b/common/widgets/infobar.cpp @@ -20,6 +20,7 @@ #include #include +#include "wx/artprov.h" #include #include #include @@ -35,21 +36,29 @@ END_EVENT_TABLE() WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager *aMgr, wxWindowID aWinid ) : wxInfoBarGeneric( aParent, aWinid ), - m_showTime( 0 ), - m_showTimer( nullptr ), - m_auiManager( aMgr ) + m_showTime( 0 ), + m_showTimer( nullptr ), + m_auiManager( aMgr ) { m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR ); // Don't use any effects since they leave the sizer area visible under the infobar SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE ); - // On GTK, the infobar seems to start too small, so increase its height -#ifdef __WXGTK__ + // The infobar seems to start too small, so increase its height int sx, sy; GetSize( &sx, &sy ); - SetSize( sx, 1.5 * sy ); -#endif + sy = 1.5 * sy; + SetSize( sx, sy ); + + // The bitmap gets cutoff sometimes with the default size, so force it to be the same + // height as the infobar. + wxSizer* sizer = GetSizer(); + wxSize iconSize = wxArtProvider::GetSizeHint( wxART_BUTTON ); + + sizer->SetItemMinSize( (size_t) 0, iconSize.x, sy ); + + Layout(); }