Fix infobar height in Windows HiDPI situations

This commit is contained in:
Jon Evans 2023-05-20 21:57:08 -04:00
parent c1d7fcf587
commit 902913c7dd
1 changed files with 13 additions and 1 deletions

View File

@ -31,6 +31,10 @@
#include <wx/bmpbuttn.h>
#include <eda_base_frame.h>
#ifdef __WXMSW__
#include <gal/dpi_scaling.h>
#endif
wxDEFINE_EVENT( KIEVT_SHOW_INFOBAR, wxCommandEvent );
wxDEFINE_EVENT( KIEVT_DISMISS_INFOBAR, wxCommandEvent );
@ -74,13 +78,21 @@ WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr, wxWindowID aWinid
int sx, sy;
GetSize( &sx, &sy );
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 );
#ifdef __WXMSW__
DPI_SCALING dpi( nullptr, aParent );
iconSize.x *= dpi.GetContentScaleFactor();
sx *= dpi.GetContentScaleFactor();
sy *= dpi.GetContentScaleFactor();
#endif
SetSize( sx, sy );
sizer->SetItemMinSize( (size_t) 0, iconSize.x, sy );
// Forcefully remove all existing buttons added by the wx constructors.