From: Václav Slavík Date: Mon, 31 Dec 2001 11:53:21 +0000 (+0000) Subject: wxSystemSettings mods in wxMGL and wxGTK X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0ab5e0e88f962d2eb7b7786d3fa0e2271f444439 wxSystemSettings mods in wxMGL and wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 85b2c7c312..d9fb52626c 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -14,7 +14,7 @@ #include "wx/settings.h" #include "wx/debug.h" - +#include "wx/module.h" #include "wx/cmndata.h" #include @@ -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; } diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 85b2c7c312..d9fb52626c 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -14,7 +14,7 @@ #include "wx/settings.h" #include "wx/debug.h" - +#include "wx/module.h" #include "wx/cmndata.h" #include @@ -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; } diff --git a/src/mgl/settings.cpp b/src/mgl/settings.cpp index fb58cf7745..8ad12fc890 100644 --- a/src/mgl/settings.cpp +++ b/src/mgl/settings.cpp @@ -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) {