]> git.saurik.com Git - wxWidgets.git/commitdiff
wxSystemSettings mods in wxMGL and wxGTK
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 31 Dec 2001 11:53:21 +0000 (11:53 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 31 Dec 2001 11:53:21 +0000 (11:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/settings.cpp
src/gtk1/settings.cpp
src/mgl/settings.cpp

index 85b2c7c312c6b45c3cb97a212dbb1ac60b9c0abb..d9fb52626c024b940c5c05e2494e7f59f38015e5 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "wx/settings.h"
 #include "wx/debug.h"
-
+#include "wx/module.h"
 #include "wx/cmndata.h"
 
 #include <gdk/gdk.h>
@@ -73,18 +73,34 @@ wxColour *g_systemBtnTextColour       = (wxColour *) NULL;
 
 wxFont *g_systemFont = (wxFont *) NULL;
 
-void wxSystemSettings::Done()
+// ----------------------------------------------------------------------------
+// wxSystemSettingsModule
+// ----------------------------------------------------------------------------
+
+class wxSystemSettingsModule : public wxModule
 {
-//    delete g_systemWinColour;
-    delete g_systemBtnFaceColour;
-    delete g_systemBtnShadowColour;
-    delete g_systemBtnHighlightColour;
-    delete g_systemHighlightColour;
-    delete g_systemHighlightTextColour;
-    delete g_systemListBoxColour;
-    delete g_systemFont;
-    delete g_systemBtnTextColour;
-}
+public:
+    bool OnInit() { return TRUE; }
+    void OnExit()
+    {
+        //delete g_systemWinColour;
+        delete g_systemBtnFaceColour;
+        delete g_systemBtnShadowColour;
+        delete g_systemBtnHighlightColour;
+        delete g_systemHighlightColour;
+        delete g_systemHighlightTextColour;
+        delete g_systemListBoxColour;
+        delete g_systemFont;
+        delete g_systemBtnTextColour;
+    }
+    DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
+
+// ----------------------------------------------------------------------------
+// wxSystemSettings implementation
+// ----------------------------------------------------------------------------
 
 // kind of widget to use in GetColourFromGTKWidget
 enum wxGtkWidgetType
@@ -166,7 +182,7 @@ static bool GetColourFromGTKWidget(int& red, int& green, int& blue,
     return ok;
 }
 
-wxColour wxSystemSettings::GetSystemColour( int index )
+wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
 {
     switch (index)
     {
@@ -315,7 +331,7 @@ wxColour wxSystemSettings::GetSystemColour( int index )
   return *wxWHITE;
 }
 
-wxFont wxSystemSettings::GetSystemFont( int index )
+wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
 {
     switch (index)
     {
@@ -350,12 +366,13 @@ wxFont wxSystemSettings::GetSystemFont( int index )
             }
             return *g_systemFont;
         }
-    }
 
-    return wxNullFont;
+        default:
+            return wxNullFont;
+    }
 }
 
-int wxSystemSettings::GetSystemMetric( int index )
+int wxSystemSettingsNative::GetMetric( wxSystemMetric index )
 {
     switch (index)
     {
@@ -363,21 +380,22 @@ int wxSystemSettings::GetSystemMetric( int index )
         case wxSYS_SCREEN_Y:   return gdk_screen_height();
         case wxSYS_HSCROLL_Y:  return 15;
         case wxSYS_VSCROLL_X:  return 15;
+        default:               
+            wxFAIL_MSG( wxT("wxSystemSettings::GetMetric not fully implemented") );
+            return 0;
     }
-
-    wxCHECK_MSG( index, 0, wxT("wxSystemSettings::GetSystemMetric not fully implemented") );
-
-    return 0;
 }
 
-bool wxSystemSettings::GetCapability(int index)
+bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
 {
     switch (index)
     {
         case wxSYS_CAN_ICONIZE_FRAME: 
-            return FALSE; break;
+            return FALSE; 
+            break;
         case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
-            return TRUE; break;
+            return TRUE; 
+            break;
         default:
             return FALSE;
     }
index 85b2c7c312c6b45c3cb97a212dbb1ac60b9c0abb..d9fb52626c024b940c5c05e2494e7f59f38015e5 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "wx/settings.h"
 #include "wx/debug.h"
-
+#include "wx/module.h"
 #include "wx/cmndata.h"
 
 #include <gdk/gdk.h>
@@ -73,18 +73,34 @@ wxColour *g_systemBtnTextColour       = (wxColour *) NULL;
 
 wxFont *g_systemFont = (wxFont *) NULL;
 
-void wxSystemSettings::Done()
+// ----------------------------------------------------------------------------
+// wxSystemSettingsModule
+// ----------------------------------------------------------------------------
+
+class wxSystemSettingsModule : public wxModule
 {
-//    delete g_systemWinColour;
-    delete g_systemBtnFaceColour;
-    delete g_systemBtnShadowColour;
-    delete g_systemBtnHighlightColour;
-    delete g_systemHighlightColour;
-    delete g_systemHighlightTextColour;
-    delete g_systemListBoxColour;
-    delete g_systemFont;
-    delete g_systemBtnTextColour;
-}
+public:
+    bool OnInit() { return TRUE; }
+    void OnExit()
+    {
+        //delete g_systemWinColour;
+        delete g_systemBtnFaceColour;
+        delete g_systemBtnShadowColour;
+        delete g_systemBtnHighlightColour;
+        delete g_systemHighlightColour;
+        delete g_systemHighlightTextColour;
+        delete g_systemListBoxColour;
+        delete g_systemFont;
+        delete g_systemBtnTextColour;
+    }
+    DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
+
+// ----------------------------------------------------------------------------
+// wxSystemSettings implementation
+// ----------------------------------------------------------------------------
 
 // kind of widget to use in GetColourFromGTKWidget
 enum wxGtkWidgetType
@@ -166,7 +182,7 @@ static bool GetColourFromGTKWidget(int& red, int& green, int& blue,
     return ok;
 }
 
-wxColour wxSystemSettings::GetSystemColour( int index )
+wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
 {
     switch (index)
     {
@@ -315,7 +331,7 @@ wxColour wxSystemSettings::GetSystemColour( int index )
   return *wxWHITE;
 }
 
-wxFont wxSystemSettings::GetSystemFont( int index )
+wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
 {
     switch (index)
     {
@@ -350,12 +366,13 @@ wxFont wxSystemSettings::GetSystemFont( int index )
             }
             return *g_systemFont;
         }
-    }
 
-    return wxNullFont;
+        default:
+            return wxNullFont;
+    }
 }
 
-int wxSystemSettings::GetSystemMetric( int index )
+int wxSystemSettingsNative::GetMetric( wxSystemMetric index )
 {
     switch (index)
     {
@@ -363,21 +380,22 @@ int wxSystemSettings::GetSystemMetric( int index )
         case wxSYS_SCREEN_Y:   return gdk_screen_height();
         case wxSYS_HSCROLL_Y:  return 15;
         case wxSYS_VSCROLL_X:  return 15;
+        default:               
+            wxFAIL_MSG( wxT("wxSystemSettings::GetMetric not fully implemented") );
+            return 0;
     }
-
-    wxCHECK_MSG( index, 0, wxT("wxSystemSettings::GetSystemMetric not fully implemented") );
-
-    return 0;
 }
 
-bool wxSystemSettings::GetCapability(int index)
+bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
 {
     switch (index)
     {
         case wxSYS_CAN_ICONIZE_FRAME: 
-            return FALSE; break;
+            return FALSE; 
+            break;
         case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
-            return TRUE; break;
+            return TRUE; 
+            break;
         default:
             return FALSE;
     }
index fb58cf774578077616c71ebd7c84c43b5a563524..8ad12fc890bfa65f5be7870c2911c8f9771c31ca 100644 (file)
@@ -21,6 +21,7 @@
 #include "wx/settings.h"
 #include "wx/colour.h"
 #include "wx/font.h"
+#include "wx/gdicmn.h"
 #include "wx/module.h"
 
 // ----------------------------------------------------------------------------
@@ -47,13 +48,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
 
 
 
-wxColour wxSystemSettings::GetSystemColour(int WXUNUSED(index))
+wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
 {
-    // FIXME_MGL
+    // not implemented, the mean is in wxUniversal
     return wxColour(0,0,0);
 }
 
-wxFont wxSystemSettings::GetSystemFont(int index)
+wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
 {
     switch (index)
     {
@@ -77,7 +78,7 @@ wxFont wxSystemSettings::GetSystemFont(int index)
     }
 }
 
-int wxSystemSettings::GetSystemMetric(int index)
+int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
 {
     int val;
     
@@ -99,7 +100,7 @@ int wxSystemSettings::GetSystemMetric(int index)
     }
 }
 
-bool wxSystemSettings::GetCapability(int index)
+bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
 {
     switch (index)
     {