]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/settings.cpp
wxSystemSettings::GetMetric returns -1 if the metric is not supported
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 return -1; // unsupported metric
99 }
100 }
101
102 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
103 {
104 switch (index)
105 {
106 case wxSYS_CAN_ICONIZE_FRAME:
107 return FALSE; break;
108 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
109 return FALSE; break;
110 default:
111 return FALSE;
112 }
113 }