]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/metrics.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/private/metrics.h
3 // Purpose: various helper functions to retrieve system metrics
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_PRIVATE_METRICS_H_
12 #define _WX_MSW_PRIVATE_METRICS_H_
17 // return NONCLIENTMETRICS as retrieved by SystemParametersInfo()
19 // currently this is not cached as the values may change when system settings
20 // do and we don't react to this to invalidate the cache but it could be done
23 // MT-safety: this function is only meant to be called from the main thread
24 inline const NONCLIENTMETRICS
& GetNonClientMetrics()
26 static WinStruct
<NONCLIENTMETRICS
> nm
;
27 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, 0, &nm
, 0) )
30 // a new field has been added to NONCLIENTMETRICS under Vista, so
31 // the call to SystemParametersInfo() fails if we use the struct
32 // size incorporating this new value on an older system -- retry
34 nm
.cbSize
-= sizeof(int);
35 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, 0, &nm
, 0) )
36 #endif // WINVER >= 0x0600
38 // maybe we should initialize the struct with some defaults?
39 wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)"));
46 } // namespace wxMSWImpl
48 #endif // _WX_MSW_PRIVATE_METRICS_H_