Adjust the font size when DPI of window changes

This commit is contained in:
Vadim Zeitlin
2018-12-30 01:06:19 +01:00
committed by Maarten Bent
parent e3d3a0b7e8
commit e563d4858a
6 changed files with 48 additions and 1 deletions

View File

@@ -501,6 +501,13 @@ public:
// account as well.
static int GetNumericWeightOf(wxFontWeight weight);
// Some ports need to modify the font object when the DPI of the window it
// is used with changes, this function can be used to do it.
//
// Currently it is only used in wxMSW and is not considered to be part of
// wxWidgets public API.
virtual void WXAdjustToPPI(const wxSize& WXUNUSED(ppi)) { }
// this doesn't do anything and is kept for compatibility only
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);)

View File

@@ -120,6 +120,8 @@ public:
virtual bool IsFixedWidth() const wxOVERRIDE;
virtual void WXAdjustToPPI(const wxSize& ppi) wxOVERRIDE;
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD")
wxFont(int size,
int family,

View File

@@ -592,6 +592,11 @@ public:
void MSWUpdateOnDPIChange(const wxSize& oldDPI, const wxSize& newDPI);
protected:
// Called from MSWUpdateOnDPIChange() specifically to update the control
// font, as this may need to be done differently for some specific native
// controls. The default version updates m_font of this window.
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI);
// this allows you to implement standard control borders without
// repeating the code in different classes that are not derived from
// wxControl