]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/settings.cpp
guard against empty ref
[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 #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 default:
72 {
73 }
74 }
75
76 return wxNullFont;
77 }
78
79 int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
80 {
81 int val;
82
83 switch (index)
84 {
85 case wxSYS_SCREEN_X:
86 wxDisplaySize(&val, NULL);
87 return val;
88 case wxSYS_SCREEN_Y:
89 wxDisplaySize(NULL, &val);
90 return val;
91 case wxSYS_VSCROLL_X:
92 case wxSYS_HSCROLL_Y:
93 return 15;
94 default:
95 {
96 }
97 }
98
99 return -1; // unsupported metric
100 }
101
102 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
103 {
104 switch (index)
105 {
106 case wxSYS_CAN_ICONIZE_FRAME:
107 return false;
108 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
109 return false;
110 default:
111 {
112 }
113 }
114
115 return false;
116 }