]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/settings.cpp
Refresh wxDisplay when a monitor is added to or removed from the system.
[wxWidgets.git] / src / os2 / settings.cpp
index 8370e46b16ba2a52f4882733b9c2ecdf93052ac0..484be7380c92ca6da48ffa3aea589eacd0d557bf 100644 (file)
@@ -70,8 +70,7 @@ void wxSystemSettingsModule::OnExit()
 {
     sm_optionNames.Clear();
     sm_optionValues.Clear();
-    delete gs_fontDefault;
-    gs_fontDefault = NULL;
+    wxDELETE(gs_fontDefault);
 }
 
 wxColour wxSystemSettingsNative::GetColour(
@@ -173,6 +172,7 @@ wxColour wxSystemSettingsNative::GetColour(
             break;
 
         case wxSYS_COLOUR_HIGHLIGHTTEXT:
+        case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT:
             vSysClr = SYSCLR_HILITEFOREGROUND;
             break;
 
@@ -207,26 +207,6 @@ wxColour wxSystemSettingsNative::GetColour(
 // fonts
 // ----------------------------------------------------------------------------
 
-wxFont wxCreateFontFromStockObject(int WXUNUSED(index))
-{
-    wxFont font;
-
-    FONTMETRICS metrics;
-    HPS hPS = ::WinGetScreenPS(HWND_DESKTOP);
-    if (::GpiQueryFontMetrics(hPS, sizeof(FONTMETRICS), &metrics))
-    {
-        wxNativeFontInfo info;
-        info.fm = metrics;
-        font.Create(info);
-    }
-    else // GetStockObject() failed
-    {
-        wxFAIL_MSG( _T("stock font not found") );
-    }
-
-    return font;
-}
-
 wxFont wxSystemSettingsNative::GetFont(
   wxSystemFont                      index
 )
@@ -238,7 +218,40 @@ wxFont wxSystemSettingsNative::GetFont(
             return *gs_fontDefault;
     }
 
-    wxFont font = wxCreateFontFromStockObject(index);
+    wxFont font;
+    // FIXME: The mapping could be improved and also OS/2 system fonts
+    // should be taken into account e.g. by using PrfQueryProfileString
+    // to look for PM_System_Fonts in HINI_USERPROFILE.
+    // FIXME2: Creating a font from the native font info does not
+    // seem to work properly.
+    switch (index)
+    {
+        case wxSYS_SYSTEM_FIXED_FONT:
+        case wxSYS_OEM_FIXED_FONT:
+        case wxSYS_ANSI_FIXED_FONT:
+                font.Create(  10,
+                              wxFONTFAMILY_TELETYPE,
+                              wxFONTSTYLE_NORMAL,
+                              wxFONTWEIGHT_NORMAL   );
+                break;
+        case wxSYS_ANSI_VAR_FONT:
+                font.Create(  10,
+                              wxFONTFAMILY_MODERN,
+                              wxFONTSTYLE_NORMAL,
+                              wxFONTWEIGHT_NORMAL   );
+                break;
+        case wxSYS_SYSTEM_FONT:
+        case wxSYS_DEFAULT_GUI_FONT:
+                font.Create(  10,
+                              wxFONTFAMILY_SWISS,
+                              wxFONTSTYLE_NORMAL,
+                              wxFONTWEIGHT_NORMAL   );
+                break;
+        default:
+                wxFAIL_MSG( wxT("stock font not found") );
+                return GetFont(wxSYS_ANSI_VAR_FONT);
+    }
+
 
     if ( isDefaultRequested )
     {