]>
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
6 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_MSW_PRIVATE_METRICS_H_
11 #define _WX_MSW_PRIVATE_METRICS_H_
16 // return NONCLIENTMETRICS as retrieved by SystemParametersInfo()
18 // currently this is not cached as the values may change when system settings
19 // do and we don't react to this to invalidate the cache but it could be done
22 // MT-safety: this function is only meant to be called from the main thread
23 inline const NONCLIENTMETRICS
& GetNonClientMetrics()
25 static WinStruct
<NONCLIENTMETRICS
> nm
;
26 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, 0, &nm
, 0) )
29 // a new field has been added to NONCLIENTMETRICS under Vista, so
30 // the call to SystemParametersInfo() fails if we use the struct
31 // size incorporating this new value on an older system -- retry
33 nm
.cbSize
-= sizeof(int);
34 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, 0, &nm
, 0) )
35 #endif // WINVER >= 0x0600
37 // maybe we should initialize the struct with some defaults?
38 wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)"));
45 } // namespace wxMSWImpl
47 #endif // _WX_MSW_PRIVATE_METRICS_H_