]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/settings.cpp
Fixed assertion that could appear under wxGTK if wxComboCtrl drop-down button was...
[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 {
37 delete gs_fontDefault;
38 gs_fontDefault = NULL;
39 }
40
41private:
42 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
43};
44
45IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
46
47
32b8ec41 48
0ab5e0e8 49wxColour wxSystemSettingsNative::GetColour(wxSystemColour WXUNUSED(index))
7bdc1879 50{
921d9418 51 // overridden by wxSystemSettings::GetColour in wxUniversal
ef344ff8 52 return wxColour(0,0,0);
7bdc1879
VS
53}
54
0ab5e0e8 55wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
7bdc1879 56{
5acaf196 57 switch (index)
8fbdfa4f 58 {
5acaf196
VS
59 case wxSYS_OEM_FIXED_FONT:
60 case wxSYS_ANSI_FIXED_FONT:
61 case wxSYS_SYSTEM_FIXED_FONT:
62 {
63 return *wxNORMAL_FONT;
64 }
65 case wxSYS_ANSI_VAR_FONT:
66 case wxSYS_SYSTEM_FONT:
67 case wxSYS_DEVICE_DEFAULT_FONT:
68 case wxSYS_DEFAULT_GUI_FONT:
69 {
70 if ( !gs_fontDefault )
127eab18 71 gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial");
5acaf196
VS
72 return *gs_fontDefault;
73 }
78f93365
WS
74 default:
75 {
76 }
8fbdfa4f 77 }
127eab18
WS
78
79 return wxNullFont;
7bdc1879
VS
80}
81
9b0b5ba7 82int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
7bdc1879 83{
5acaf196 84 int val;
127eab18 85
5acaf196
VS
86 switch (index)
87 {
88 case wxSYS_SCREEN_X:
89 wxDisplaySize(&val, NULL);
90 return val;
91 case wxSYS_SCREEN_Y:
92 wxDisplaySize(NULL, &val);
93 return val;
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 106 case wxSYS_CAN_ICONIZE_FRAME:
253293c1 107 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
b626fee2 108 case wxSYS_TABLET_PRESENT:
127eab18 109 return false;
b626fee2 110
78f93365 111 default:
b626fee2 112 wxFAIL_MSG( _T("unknown feature") );
253293c1 113 }
127eab18
WS
114
115 return false;
253293c1 116}