]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/settings.cpp
Check for NULL pointer
[wxWidgets.git] / src / mgl / settings.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
7bdc1879 2// Name: settings.h
5acaf196 3// Author: Vaclav Slavik, Robert Roebling
32b8ec41 4// Id: $Id$
c41c20a5 5// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
32b8ec41
VZ
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
9
10#ifdef __GNUG__
11#pragma implementation "settings.h"
12#endif
13
a246f95e
VS
14// For compilers that support precompilation, includes "wx.h".
15#include "wx/wxprec.h"
16
17#ifdef __BORLANDC__
18 #pragma hdrstop
19#endif
20
32b8ec41 21#include "wx/settings.h"
7bdc1879
VS
22#include "wx/colour.h"
23#include "wx/font.h"
0ab5e0e8 24#include "wx/gdicmn.h"
8fbdfa4f
VS
25#include "wx/module.h"
26
27// ----------------------------------------------------------------------------
28// global data
29// ----------------------------------------------------------------------------
30
31static wxFont *gs_fontDefault = NULL;
32
33class wxSystemSettingsModule : public wxModule
34{
35public:
36 virtual bool OnInit() { return TRUE; }
37 virtual void OnExit()
38 {
39 delete gs_fontDefault;
40 gs_fontDefault = NULL;
41 }
42
43private:
44 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
45};
46
47IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
48
49
32b8ec41 50
0ab5e0e8 51wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
7bdc1879 52{
0ab5e0e8 53 // not implemented, the mean is in wxUniversal
ef344ff8 54 return wxColour(0,0,0);
7bdc1879
VS
55}
56
0ab5e0e8 57wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
7bdc1879 58{
5acaf196 59 switch (index)
8fbdfa4f 60 {
5acaf196
VS
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;
8fbdfa4f 78 }
7bdc1879
VS
79}
80
0ab5e0e8 81int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
7bdc1879 82{
5acaf196
VS
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:
a756f210 98 wxCHECK_MSG(index, 0, wxT("wxSystemSettings::GetMetric not fully implemented"));
5acaf196
VS
99 return 0;
100 }
7bdc1879 101}
253293c1 102
0ab5e0e8 103bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
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}