Merge branch 'dpi-misc' of https://github.com/MaartenBent/wxWidgets
Miscellaneous DPI Improvements. See https://github.com/wxWidgets/wxWidgets/pull/2025
This commit is contained in:
commit
58456523b5
@ -22,13 +22,14 @@ namespace wxMSWImpl
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Temporarily change the DPI Awareness context to System
|
||||
// Temporarily change the DPI Awareness context to GDIScaled or System
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class AutoSystemDpiAware
|
||||
{
|
||||
#define WXDPI_AWARENESS_CONTEXT_UNAWARE ((WXDPI_AWARENESS_CONTEXT)-1)
|
||||
#define WXDPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((WXDPI_AWARENESS_CONTEXT)-2)
|
||||
#define WXDPI_AWARENESS_CONTEXT_UNAWARE ((WXDPI_AWARENESS_CONTEXT)-1)
|
||||
#define WXDPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((WXDPI_AWARENESS_CONTEXT)-2)
|
||||
#define WXDPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((WXDPI_AWARENESS_CONTEXT)-5)
|
||||
typedef WXDPI_AWARENESS_CONTEXT
|
||||
(WINAPI *SetThreadDpiAwarenessContext_t)(WXDPI_AWARENESS_CONTEXT);
|
||||
|
||||
@ -46,7 +47,12 @@ public:
|
||||
if ( m_pfnSetThreadDpiAwarenessContext )
|
||||
{
|
||||
m_prevContext = m_pfnSetThreadDpiAwarenessContext(
|
||||
WXDPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
WXDPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED);
|
||||
if ( !m_prevContext )
|
||||
{
|
||||
m_prevContext = m_pfnSetThreadDpiAwarenessContext(
|
||||
WXDPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public:
|
||||
|
||||
virtual wxSize GetSize() const wxOVERRIDE
|
||||
{
|
||||
return wxSize(60,20);
|
||||
return GetView()->FromDIP(wxSize(60, 20));
|
||||
}
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE
|
||||
|
@ -429,17 +429,6 @@ void wxListCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI)
|
||||
{
|
||||
wxListCtrlBase::MSWUpdateFontOnDPIChange(newDPI);
|
||||
|
||||
for ( int i = 0; i < GetItemCount(); i++ )
|
||||
{
|
||||
wxMSWListItemData *data = MSWGetItemData(i);
|
||||
if ( data && data->attr && data->attr->HasFont() )
|
||||
{
|
||||
wxFont f = data->attr->GetFont();
|
||||
f.WXAdjustToPPI(newDPI);
|
||||
SetItemFont(i, f);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_headerCustomDraw && m_headerCustomDraw->m_attr.HasFont() )
|
||||
{
|
||||
wxItemAttr item(m_headerCustomDraw->m_attr);
|
||||
@ -1014,13 +1003,6 @@ bool wxListCtrl::SetItem(wxListItem& info)
|
||||
data->attr->AssignFrom(attrNew);
|
||||
else
|
||||
data->attr = new wxItemAttr(attrNew);
|
||||
|
||||
if ( data->attr->HasFont() )
|
||||
{
|
||||
wxFont f = data->attr->GetFont();
|
||||
f.WXAdjustToPPI(GetDPI());
|
||||
data->attr->SetFont(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3182,6 +3164,7 @@ static WXLPARAM HandleItemPrepaint(wxListCtrl *listctrl,
|
||||
if ( attr->HasFont() )
|
||||
{
|
||||
wxFont font = attr->GetFont();
|
||||
font.WXAdjustToPPI(listctrl->GetDPI());
|
||||
if ( font.GetEncoding() != wxFONTENCODING_SYSTEM )
|
||||
{
|
||||
// the standard control ignores the font encoding/charset, at least
|
||||
|
Loading…
Reference in New Issue
Block a user