Merge branch 'pm-dpi-aware-1-systemmetric' of https://github.com/MaartenBent/wxWidgets
Make GetSystemMetrics() and wxSystemParametersInfo DPI-aware in wxMSW. See https://github.com/wxWidgets/wxWidgets/pull/1407
This commit is contained in:
@@ -300,6 +300,11 @@ extern HICON wxBitmapToHICON(const wxBitmap& bmp);
|
||||
extern
|
||||
HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY);
|
||||
|
||||
extern int wxGetSystemMetrics(int nIndex, const wxWindow* win);
|
||||
|
||||
extern bool wxSystemParametersInfo(UINT uiAction, UINT uiParam,
|
||||
PVOID pvParam, UINT fWinIni,
|
||||
const wxWindow* win);
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
|
||||
|
@@ -10,6 +10,8 @@
|
||||
#ifndef _WX_MSW_PRIVATE_METRICS_H_
|
||||
#define _WX_MSW_PRIVATE_METRICS_H_
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
namespace wxMSWImpl
|
||||
{
|
||||
|
||||
@@ -20,10 +22,14 @@ namespace wxMSWImpl
|
||||
// in the future
|
||||
//
|
||||
// MT-safety: this function is only meant to be called from the main thread
|
||||
inline const NONCLIENTMETRICS& GetNonClientMetrics()
|
||||
inline const NONCLIENTMETRICS GetNonClientMetrics(const wxWindow* win)
|
||||
{
|
||||
static WinStruct<NONCLIENTMETRICS> nm;
|
||||
if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) )
|
||||
WinStruct<NONCLIENTMETRICS> nm;
|
||||
if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS,
|
||||
sizeof(NONCLIENTMETRICS),
|
||||
&nm,
|
||||
0,
|
||||
win) )
|
||||
{
|
||||
#if WINVER >= 0x0600
|
||||
// a new field has been added to NONCLIENTMETRICS under Vista, so
|
||||
@@ -31,7 +37,11 @@ inline const NONCLIENTMETRICS& GetNonClientMetrics()
|
||||
// size incorporating this new value on an older system -- retry
|
||||
// without it
|
||||
nm.cbSize -= sizeof(int);
|
||||
if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &nm, 0) )
|
||||
if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS,
|
||||
sizeof(NONCLIENTMETRICS),
|
||||
&nm,
|
||||
0,
|
||||
win) )
|
||||
#endif // WINVER >= 0x0600
|
||||
{
|
||||
// maybe we should initialize the struct with some defaults?
|
||||
|
@@ -216,7 +216,7 @@ public:
|
||||
static wxFont GetFont(wxSystemFont index);
|
||||
|
||||
// get a system-dependent metric
|
||||
static int GetMetric(wxSystemMetric index, wxWindow * win = NULL);
|
||||
static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL);
|
||||
|
||||
// get the object describing the current system appearance
|
||||
static wxSystemAppearance GetAppearance();
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
|
||||
// some metrics are toolkit-dependent and provided by wxUniv, some are
|
||||
// lowlevel
|
||||
static int GetMetric(wxSystemMetric index, wxWindow *win = NULL);
|
||||
static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL);
|
||||
#endif // __WXUNIVERSAL__
|
||||
|
||||
// Get system screen design (desktop, pda, ..) used for
|
||||
|
Reference in New Issue
Block a user