]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/settings.cpp
guard against empty ref
[wxWidgets.git] / src / mgl / settings.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
127eab18 2// Name: src/mgl/settings.cpp
5acaf196 3// Author: Vaclav Slavik, Robert Roebling
32b8ec41 4// Id: $Id$
c41c20a5 5// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
127eab18 6// Licence: wxWindows licence
32b8ec41
VZ
7/////////////////////////////////////////////////////////////////////////////
8
a246f95e
VS
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
11
12#ifdef __BORLANDC__
13 #pragma hdrstop
14#endif
15
32b8ec41 16#include "wx/settings.h"
7bdc1879
VS
17#include "wx/colour.h"
18#include "wx/font.h"
0ab5e0e8 19#include "wx/gdicmn.h"
8fbdfa4f
VS
20#include "wx/module.h"
21
22// ----------------------------------------------------------------------------
23// global data
24// ----------------------------------------------------------------------------
25
26static wxFont *gs_fontDefault = NULL;
27
28class wxSystemSettingsModule : public wxModule
29{
30public:
127eab18 31 virtual bool OnInit() { return true; }
8fbdfa4f
VS
32 virtual void OnExit()
33 {
34 delete gs_fontDefault;
35 gs_fontDefault = NULL;
36 }
37
38private:
39 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
40};
41
42IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
43
44
32b8ec41 45
0ab5e0e8 46wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
7bdc1879 47{
0ab5e0e8 48 // not implemented, the mean is in wxUniversal
ef344ff8 49 return wxColour(0,0,0);
7bdc1879
VS
50}
51
0ab5e0e8 52wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
7bdc1879 53{
5acaf196 54 switch (index)
8fbdfa4f 55 {
5acaf196
VS
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 )
127eab18 68 gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial");
5acaf196
VS
69 return *gs_fontDefault;
70 }
78f93365
WS
71 default:
72 {
73 }
8fbdfa4f 74 }
127eab18
WS
75
76 return wxNullFont;
7bdc1879
VS
77}
78
9b0b5ba7 79int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
7bdc1879 80{
5acaf196 81 int val;
127eab18 82
5acaf196
VS
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:
127eab18 93 return 15;
78f93365
WS
94 default:
95 {
96 }
5acaf196 97 }
127eab18
WS
98
99 return -1; // unsupported metric
7bdc1879 100}
253293c1 101
0ab5e0e8 102bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
103{
104 switch (index)
105 {
127eab18
WS
106 case wxSYS_CAN_ICONIZE_FRAME:
107 return false;
253293c1 108 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
127eab18 109 return false;
78f93365
WS
110 default:
111 {
112 }
253293c1 113 }
127eab18
WS
114
115 return false;
253293c1 116}