- case wxSYS_HSCROLL_ARROW_X:
- return ::GetSystemMetrics(SM_CXHSCROLL);
- case wxSYS_HSCROLL_ARROW_Y:
- return ::GetSystemMetrics(SM_CYHSCROLL);
- case wxSYS_HTHUMB_X:
- return ::GetSystemMetrics(SM_CXHTHUMB);
- case wxSYS_ICON_X:
- return ::GetSystemMetrics(SM_CXICON);
- case wxSYS_ICON_Y:
- return ::GetSystemMetrics(SM_CYICON);
- case wxSYS_ICONSPACING_X:
- return ::GetSystemMetrics(SM_CXICONSPACING);
- case wxSYS_ICONSPACING_Y:
- return ::GetSystemMetrics(SM_CYICONSPACING);
- case wxSYS_WINDOWMIN_X:
- return ::GetSystemMetrics(SM_CXMIN);
- case wxSYS_WINDOWMIN_Y:
- return ::GetSystemMetrics(SM_CYMIN);
- case wxSYS_SCREEN_X:
- return ::GetSystemMetrics(SM_CXSCREEN);
- case wxSYS_SCREEN_Y:
- return ::GetSystemMetrics(SM_CYSCREEN);
-#ifdef __WIN32__
- case wxSYS_FRAMESIZE_X:
- return ::GetSystemMetrics(SM_CXSIZEFRAME);
- case wxSYS_FRAMESIZE_Y:
- return ::GetSystemMetrics(SM_CYSIZEFRAME);
- case wxSYS_SMALLICON_X:
- return ::GetSystemMetrics(SM_CXSMICON);
- case wxSYS_SMALLICON_Y:
- return ::GetSystemMetrics(SM_CYSMICON);
+ }
+ else
+ {
+ wxFAIL_MSG( _T("failed to get LOGFONT") );
+ }
+ }
+ else // GetStockObject() failed
+ {
+ wxFAIL_MSG( _T("stock font not found") );
+ }
+
+ return font;
+}
+
+wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
+{
+#ifndef __WXWINCE__
+ // this one is special: we don't get it from GetStockObject()
+ if ( index == wxSYS_ICONTITLE_FONT )
+ {
+ LOGFONT lf;
+ SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
+ return wxCreateFontFromLogFont(&lf);
+ }
+#endif // __WXWINCE__
+
+ // wxWindow ctor calls GetSystemFont(wxSYS_DEFAULT_GUI_FONT) so we're
+ // called fairly often - this is why we cache this particular font
+ bool isDefaultRequested = index == wxSYS_DEFAULT_GUI_FONT;
+ if ( isDefaultRequested && gs_fontDefault )
+ {
+ return *gs_fontDefault;
+ }
+
+ wxFont font = wxCreateFontFromStockObject(index);
+
+ if ( isDefaultRequested )
+ {
+ // if we got here it means we hadn't cached it yet - do now
+ gs_fontDefault = new wxFont(font);
+ }
+
+ return font;
+}
+
+// ----------------------------------------------------------------------------
+// system metrics/features
+// ----------------------------------------------------------------------------
+
+// TODO: some of the "metrics" clearly should be features now that we have
+// HasFeature()!
+
+// the conversion table from wxSystemMetric enum to GetSystemMetrics() param
+//
+// if the constant is not defined, put -1 in the table to indicate that it is
+// unknown
+static const int gs_metricsMap[] =
+{
+ -1, // wxSystemMetric enums start at 1, so give a dummy value for pos 0.
+#if defined(__WIN32__) && !defined(__WXWINCE__)
+ SM_CMOUSEBUTTONS,
+#else
+ -1,