]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/settings.cpp
cleanup
[wxWidgets.git] / src / mgl / settings.cpp
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
18 #ifndef WX_PRECOMP
19 #include "wx/colour.h"
20 #include "wx/font.h"
21 #include "wx/gdicmn.h"
22 #include "wx/module.h"
23 #endif
24
25 // ----------------------------------------------------------------------------
26 // global data
27 // ----------------------------------------------------------------------------
28
29 static wxFont *gs_fontDefault = NULL;
30
31 class wxSystemSettingsModule : public wxModule
32 {
33 public:
34 virtual bool OnInit() { return true; }
35 virtual void OnExit()
36 {
37 delete gs_fontDefault;
38 gs_fontDefault = NULL;
39 }
40
41 private:
42 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
43 };
44
45 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
46
47
48
49 wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
50 {
51 // overridden by wxSystemSettings::GetColour in wxUniversal
52 return wxColour(0,0,0);
53 }
54
55 wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
56 {
57 switch (index)
58 {
59 case wxSYS_OEM_FIXED_FONT:
60 case wxSYS_ANSI_FIXED_FONT:
61 case wxSYS_SYSTEM_FIXED_FONT:
62 {
63 return *wxNORMAL_FONT;
64 }
65 case wxSYS_ANSI_VAR_FONT:
66 case wxSYS_SYSTEM_FONT:
67 case wxSYS_DEVICE_DEFAULT_FONT:
68 case wxSYS_DEFAULT_GUI_FONT:
69 {
70 if ( !gs_fontDefault )
71 gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial");
72 return *gs_fontDefault;
73 }
74 default:
75 {
76 }
77 }
78
79 return wxNullFont;
80 }
81
82 int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
83 {
84 int val;
85
86 switch (index)
87 {
88 case wxSYS_SCREEN_X:
89 wxDisplaySize(&val, NULL);
90 return val;
91 case wxSYS_SCREEN_Y:
92 wxDisplaySize(NULL, &val);
93 return val;
94 case wxSYS_VSCROLL_X:
95 case wxSYS_HSCROLL_Y:
96 return 15;
97 default:
98 {
99 }
100 }
101
102 return -1; // unsupported metric
103 }
104
105 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
106 {
107 switch (index)
108 {
109 case wxSYS_CAN_ICONIZE_FRAME:
110 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
111 case wxSYS_TABLET_PRESENT:
112 return false;
113
114 default:
115 wxFAIL_MSG( _T("unknown feature") );
116 }
117
118 return false;
119 }