]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/settings.cpp
better ownership handling
[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"
7cf41a5d
WS
17
18#ifndef WX_PRECOMP
19 #include "wx/colour.h"
48a1108e 20 #include "wx/font.h"
dd05139a 21 #include "wx/gdicmn.h"
02761f6c 22 #include "wx/module.h"
7cf41a5d
WS
23#endif
24
8fbdfa4f
VS
25// ----------------------------------------------------------------------------
26// global data
27// ----------------------------------------------------------------------------
28
29static wxFont *gs_fontDefault = NULL;
30
31class wxSystemSettingsModule : public wxModule
32{
33public:
127eab18 34 virtual bool OnInit() { return true; }
8fbdfa4f
VS
35 virtual void OnExit()
36 {
5276b0a5 37 wxDELETE(gs_fontDefault);
8fbdfa4f
VS
38 }
39
40private:
41 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
42};
43
44IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
45
46
32b8ec41 47
0ab5e0e8 48wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
7bdc1879 49{
921d9418 50 // overridden by wxSystemSettings::GetColour in wxUniversal
ef344ff8 51 return wxColour(0,0,0);
7bdc1879
VS
52}
53
0ab5e0e8 54wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
7bdc1879 55{
5acaf196 56 switch (index)
8fbdfa4f 57 {
5acaf196
VS
58 case wxSYS_OEM_FIXED_FONT:
59 case wxSYS_ANSI_FIXED_FONT:
60 case wxSYS_SYSTEM_FIXED_FONT:
61 {
62 return *wxNORMAL_FONT;
63 }
64 case wxSYS_ANSI_VAR_FONT:
65 case wxSYS_SYSTEM_FONT:
66 case wxSYS_DEVICE_DEFAULT_FONT:
67 case wxSYS_DEFAULT_GUI_FONT:
68 {
69 if ( !gs_fontDefault )
127eab18 70 gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial");
5acaf196
VS
71 return *gs_fontDefault;
72 }
78f93365
WS
73 default:
74 {
75 }
8fbdfa4f 76 }
127eab18
WS
77
78 return wxNullFont;
7bdc1879
VS
79}
80
9b0b5ba7 81int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
7bdc1879 82{
5acaf196 83 int val;
127eab18 84
5acaf196
VS
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;
78f93365
WS
93 default:
94 {
95 }
5acaf196 96 }
127eab18
WS
97
98 return -1; // unsupported metric
7bdc1879 99}
253293c1 100
0ab5e0e8 101bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
102{
103 switch (index)
104 {
127eab18 105 case wxSYS_CAN_ICONIZE_FRAME:
253293c1 106 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
b626fee2 107 case wxSYS_TABLET_PRESENT:
127eab18 108 return false;
b626fee2 109
78f93365 110 default:
9a83f860 111 wxFAIL_MSG( wxT("unknown feature") );
253293c1 112 }
127eab18
WS
113
114 return false;
253293c1 115}