]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/settings.cpp
Don't emit bogus size events if a child window
[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
18 #ifndef WX_PRECOMP
19 #include "wx/colour.h"
20 #include "wx/font.h"
21 #include "wx/gdicmn.h"
22 #endif
23
24 #include "wx/module.h"
25
26 // ----------------------------------------------------------------------------
27 // global data
28 // ----------------------------------------------------------------------------
29
30 static wxFont *gs_fontDefault = NULL;
31
32 class wxSystemSettingsModule : public wxModule
33 {
34 public:
35 virtual bool OnInit() { return true; }
36 virtual void OnExit()
37 {
38 delete gs_fontDefault;
39 gs_fontDefault = NULL;
40 }
41
42 private:
43 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
44 };
45
46 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
47
48
49
50 wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
51 {
52 // not implemented, the mean is in wxUniversal
53 return wxColour(0,0,0);
54 }
55
56 wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
57 {
58 switch (index)
59 {
60 case wxSYS_OEM_FIXED_FONT:
61 case wxSYS_ANSI_FIXED_FONT:
62 case wxSYS_SYSTEM_FIXED_FONT:
63 {
64 return *wxNORMAL_FONT;
65 }
66 case wxSYS_ANSI_VAR_FONT:
67 case wxSYS_SYSTEM_FONT:
68 case wxSYS_DEVICE_DEFAULT_FONT:
69 case wxSYS_DEFAULT_GUI_FONT:
70 {
71 if ( !gs_fontDefault )
72 gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial");
73 return *gs_fontDefault;
74 }
75 default:
76 {
77 }
78 }
79
80 return wxNullFont;
81 }
82
83 int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
84 {
85 int val;
86
87 switch (index)
88 {
89 case wxSYS_SCREEN_X:
90 wxDisplaySize(&val, NULL);
91 return val;
92 case wxSYS_SCREEN_Y:
93 wxDisplaySize(NULL, &val);
94 return val;
95 case wxSYS_VSCROLL_X:
96 case wxSYS_HSCROLL_Y:
97 return 15;
98 default:
99 {
100 }
101 }
102
103 return -1; // unsupported metric
104 }
105
106 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
107 {
108 switch (index)
109 {
110 case wxSYS_CAN_ICONIZE_FRAME:
111 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
112 case wxSYS_TABLET_PRESENT:
113 return false;
114
115 default:
116 wxFAIL_MSG( _T("unknown feature") );
117 }
118
119 return false;
120 }