]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/settings.cpp
Check for NULL pointer
[wxWidgets.git] / src / mgl / settings.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: settings.h
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
10 #ifdef __GNUG__
11 #pragma implementation "settings.h"
12 #endif
13
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
16
17 #ifdef __BORLANDC__
18 #pragma hdrstop
19 #endif
20
21 #include "wx/settings.h"
22 #include "wx/colour.h"
23 #include "wx/font.h"
24 #include "wx/gdicmn.h"
25 #include "wx/module.h"
26
27 // ----------------------------------------------------------------------------
28 // global data
29 // ----------------------------------------------------------------------------
30
31 static wxFont *gs_fontDefault = NULL;
32
33 class wxSystemSettingsModule : public wxModule
34 {
35 public:
36 virtual bool OnInit() { return TRUE; }
37 virtual void OnExit()
38 {
39 delete gs_fontDefault;
40 gs_fontDefault = NULL;
41 }
42
43 private:
44 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
45 };
46
47 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
48
49
50
51 wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
52 {
53 // not implemented, the mean is in wxUniversal
54 return wxColour(0,0,0);
55 }
56
57 wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
58 {
59 switch (index)
60 {
61 case wxSYS_OEM_FIXED_FONT:
62 case wxSYS_ANSI_FIXED_FONT:
63 case wxSYS_SYSTEM_FIXED_FONT:
64 {
65 return *wxNORMAL_FONT;
66 }
67 case wxSYS_ANSI_VAR_FONT:
68 case wxSYS_SYSTEM_FONT:
69 case wxSYS_DEVICE_DEFAULT_FONT:
70 case wxSYS_DEFAULT_GUI_FONT:
71 {
72 if ( !gs_fontDefault )
73 gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, FALSE, "Arial");
74 return *gs_fontDefault;
75 }
76 default:
77 return wxNullFont;
78 }
79 }
80
81 int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
82 {
83 int val;
84
85 switch (index)
86 {
87 case wxSYS_SCREEN_X:
88 wxDisplaySize(&val, NULL);
89 return val;
90 case wxSYS_SCREEN_Y:
91 wxDisplaySize(NULL, &val);
92 return val;
93 case wxSYS_VSCROLL_X:
94 case wxSYS_HSCROLL_Y:
95 return 15;
96 break;
97 default:
98 wxCHECK_MSG(index, 0, wxT("wxSystemSettings::GetMetric not fully implemented"));
99 return 0;
100 }
101 }
102
103 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
104 {
105 switch (index)
106 {
107 case wxSYS_CAN_ICONIZE_FRAME:
108 return FALSE; break;
109 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
110 return FALSE; break;
111 default:
112 return FALSE;
113 }
114 }