]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/settings.cpp
fixing osx_carbon
[wxWidgets.git] / src / os2 / settings.cpp
index 6d29e973e844e03e621bf38e101daa0ad9e24f20..484be7380c92ca6da48ffa3aea589eacd0d557bf 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        settings.cpp
+// Name:        src/os2/settings.cpp
 // Purpose:     wxSettings
 // Author:      David Webster
 // Modified by:
 // Purpose:     wxSettings
 // Author:      David Webster
 // Modified by:
 #include "wx/wxprec.h"
 
 #ifndef WX_PRECOMP
 #include "wx/wxprec.h"
 
 #ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/defs.h"
-#include "wx/pen.h"
-#include "wx/brush.h"
-#include "wx/gdicmn.h"
+    #include <stdio.h>
+    #include "wx/pen.h"
+    #include "wx/brush.h"
+    #include "wx/gdicmn.h"
+    #include "wx/window.h"
+    #include "wx/settings.h"
+    #include "wx/module.h"
 #endif
 
 #endif
 
-#include "wx/module.h"
-#include "wx/settings.h"
-#include "wx/window.h"
+#include "wx/fontutil.h"
+
 #include "wx/os2/private.h"
 
 // the module which is used to clean up wxSystemSettings data (this is a
 #include "wx/os2/private.h"
 
 // the module which is used to clean up wxSystemSettings data (this is a
@@ -62,14 +63,14 @@ wxArrayString wxSystemSettingsModule::sm_optionValues;
 
 bool wxSystemSettingsModule::OnInit()
 {
 
 bool wxSystemSettingsModule::OnInit()
 {
-    return TRUE;
+    return true;
 }
 
 void wxSystemSettingsModule::OnExit()
 {
     sm_optionNames.Clear();
     sm_optionValues.Clear();
 }
 
 void wxSystemSettingsModule::OnExit()
 {
     sm_optionNames.Clear();
     sm_optionValues.Clear();
-    delete gs_fontDefault;
+    wxDELETE(gs_fontDefault);
 }
 
 wxColour wxSystemSettingsNative::GetColour(
 }
 
 wxColour wxSystemSettingsNative::GetColour(
@@ -171,6 +172,7 @@ wxColour wxSystemSettingsNative::GetColour(
             break;
 
         case wxSYS_COLOUR_HIGHLIGHTTEXT:
             break;
 
         case wxSYS_COLOUR_HIGHLIGHTTEXT:
+        case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT:
             vSysClr = SYSCLR_HILITEFOREGROUND;
             break;
 
             vSysClr = SYSCLR_HILITEFOREGROUND;
             break;
 
@@ -201,39 +203,63 @@ wxColour wxSystemSettingsNative::GetColour(
     return(vCol);
 } // end of wxSystemSettingsNative::GetColour
 
     return(vCol);
 } // end of wxSystemSettingsNative::GetColour
 
+// ----------------------------------------------------------------------------
+// fonts
+// ----------------------------------------------------------------------------
+
 wxFont wxSystemSettingsNative::GetFont(
   wxSystemFont                      index
 )
 {
 wxFont wxSystemSettingsNative::GetFont(
   wxSystemFont                      index
 )
 {
-    // TODO
+    const bool isDefaultRequested = index == wxSYS_DEFAULT_GUI_FONT;
+    if ( isDefaultRequested )
+    {
+        if ( gs_fontDefault )
+            return *gs_fontDefault;
+    }
+
+    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)
     {
     switch (index)
     {
-        case wxSYS_DEVICE_DEFAULT_FONT:
-        {
-            break;
-        }
-        case wxSYS_DEFAULT_PALETTE:
-        {
-            break;
-        }
         case wxSYS_SYSTEM_FIXED_FONT:
         case wxSYS_SYSTEM_FIXED_FONT:
-        {
-            break;
-        }
+        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_SYSTEM_FONT:
-        {
-            break;
-        }
-        default:
         case wxSYS_DEFAULT_GUI_FONT:
         case wxSYS_DEFAULT_GUI_FONT:
-        {
-            break;
-        }
+                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 )
+    {
+        // if we got here it means we hadn't cached it yet - do now
+        gs_fontDefault = new wxFont(font);
     }
     }
-    if(wxSWISS_FONT)
-         return *wxSWISS_FONT;
 
 
-    return wxNullFont;
+    return font;
 }
 
 // Get a system metric, e.g. scrollbar size
 }
 
 // Get a system metric, e.g. scrollbar size
@@ -287,6 +313,9 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index,
         // TODO case wxSYS_PENWINDOWS_PRESENT:
         // TODO case wxSYS_SHOW_SOUNDS:
         // TODO case wxSYS_SWAP_BUTTONS:
         // TODO case wxSYS_PENWINDOWS_PRESENT:
         // TODO case wxSYS_SHOW_SOUNDS:
         // TODO case wxSYS_SWAP_BUTTONS:
+
+        default:
+            break;
     }
     return -1;  // unsupported metric
 }
     }
     return -1;  // unsupported metric
 }
@@ -298,8 +327,11 @@ bool wxSystemSettingsNative::HasFeature( wxSystemFeature index )
         case wxSYS_CAN_ICONIZE_FRAME:
             return true;
 
         case wxSYS_CAN_ICONIZE_FRAME:
             return true;
 
-        case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
-            return false;
+        // TODO case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
+        // TODO case wxSYS_TABLET_PRESENT:
+
+        default:
+            break;
     }
 
     return false;
     }
 
     return false;