| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/mgl/settings.cpp |
| 3 | // Author: Vaclav Slavik, Robert Roebling |
| 4 | // Id: $Id$ |
| 5 | // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) |
| 6 | // Licence: wxWindows licence |
| 7 | ///////////////////////////////////////////////////////////////////////////// |
| 8 | |
| 9 | // For compilers that support precompilation, includes "wx.h". |
| 10 | #include "wx/wxprec.h" |
| 11 | |
| 12 | #ifdef __BORLANDC__ |
| 13 | #pragma hdrstop |
| 14 | #endif |
| 15 | |
| 16 | #include "wx/settings.h" |
| 17 | #include "wx/colour.h" |
| 18 | #include "wx/font.h" |
| 19 | #include "wx/gdicmn.h" |
| 20 | #include "wx/module.h" |
| 21 | |
| 22 | // ---------------------------------------------------------------------------- |
| 23 | // global data |
| 24 | // ---------------------------------------------------------------------------- |
| 25 | |
| 26 | static wxFont *gs_fontDefault = NULL; |
| 27 | |
| 28 | class wxSystemSettingsModule : public wxModule |
| 29 | { |
| 30 | public: |
| 31 | virtual bool OnInit() { return true; } |
| 32 | virtual void OnExit() |
| 33 | { |
| 34 | delete gs_fontDefault; |
| 35 | gs_fontDefault = NULL; |
| 36 | } |
| 37 | |
| 38 | private: |
| 39 | DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule) |
| 40 | }; |
| 41 | |
| 42 | IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule) |
| 43 | |
| 44 | |
| 45 | |
| 46 | wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index)) |
| 47 | { |
| 48 | // not implemented, the mean is in wxUniversal |
| 49 | return wxColour(0,0,0); |
| 50 | } |
| 51 | |
| 52 | wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) |
| 53 | { |
| 54 | switch (index) |
| 55 | { |
| 56 | case wxSYS_OEM_FIXED_FONT: |
| 57 | case wxSYS_ANSI_FIXED_FONT: |
| 58 | case wxSYS_SYSTEM_FIXED_FONT: |
| 59 | { |
| 60 | return *wxNORMAL_FONT; |
| 61 | } |
| 62 | case wxSYS_ANSI_VAR_FONT: |
| 63 | case wxSYS_SYSTEM_FONT: |
| 64 | case wxSYS_DEVICE_DEFAULT_FONT: |
| 65 | case wxSYS_DEFAULT_GUI_FONT: |
| 66 | { |
| 67 | if ( !gs_fontDefault ) |
| 68 | gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial"); |
| 69 | return *gs_fontDefault; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | return wxNullFont; |
| 74 | } |
| 75 | |
| 76 | int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win)) |
| 77 | { |
| 78 | int val; |
| 79 | |
| 80 | switch (index) |
| 81 | { |
| 82 | case wxSYS_SCREEN_X: |
| 83 | wxDisplaySize(&val, NULL); |
| 84 | return val; |
| 85 | case wxSYS_SCREEN_Y: |
| 86 | wxDisplaySize(NULL, &val); |
| 87 | return val; |
| 88 | case wxSYS_VSCROLL_X: |
| 89 | case wxSYS_HSCROLL_Y: |
| 90 | return 15; |
| 91 | } |
| 92 | |
| 93 | return -1; // unsupported metric |
| 94 | } |
| 95 | |
| 96 | bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) |
| 97 | { |
| 98 | switch (index) |
| 99 | { |
| 100 | case wxSYS_CAN_ICONIZE_FRAME: |
| 101 | return false; |
| 102 | case wxSYS_CAN_DRAW_FRAME_DECORATIONS: |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | return false; |
| 107 | } |