]> git.saurik.com Git - wxWidgets.git/blame - src/os2/settings.cpp
wxWinCE power build fixes.
[wxWidgets.git] / src / os2 / settings.cpp
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
63a3cd7a 2// Name: src/os2/settings.cpp
0e320a79 3// Purpose: wxSettings
409c9842 4// Author: David Webster
0e320a79 5// Modified by:
409c9842 6// Created: 10/15/99
0e320a79 7// RCS-ID: $Id$
409c9842 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
409c9842
DW
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifndef WX_PRECOMP
7520f3da
WS
16 #include <stdio.h>
17 #include "wx/pen.h"
18 #include "wx/brush.h"
19 #include "wx/gdicmn.h"
cdccdfab 20 #include "wx/window.h"
9eddec69 21 #include "wx/settings.h"
0e320a79
DW
22#endif
23
e7262344 24#include "wx/module.h"
409c9842 25#include "wx/os2/private.h"
0e320a79 26
fd6d5c94
DW
27// the module which is used to clean up wxSystemSettings data (this is a
28// singleton class so it can't be done in the dtor)
29class wxSystemSettingsModule : public wxModule
30{
31 friend class wxSystemSettings;
32public:
33 virtual bool OnInit();
34 virtual void OnExit();
35
36private:
37 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
38
39 static wxArrayString sm_optionNames;
40 static wxArrayString sm_optionValues;
41};
42
43// ----------------------------------------------------------------------------
44// global data
45// ----------------------------------------------------------------------------
46
47static wxFont *gs_fontDefault = NULL;
48
49// ============================================================================
50// implementation
51// ============================================================================
52
53// ----------------------------------------------------------------------------
54// wxSystemSettingsModule
55// ----------------------------------------------------------------------------
56
57IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
58
59wxArrayString wxSystemSettingsModule::sm_optionNames;
60wxArrayString wxSystemSettingsModule::sm_optionValues;
61
62bool wxSystemSettingsModule::OnInit()
63{
63a3cd7a 64 return true;
fd6d5c94
DW
65}
66
67void wxSystemSettingsModule::OnExit()
68{
69 sm_optionNames.Clear();
70 sm_optionValues.Clear();
71 delete gs_fontDefault;
72}
73
793c7f9b
DW
74wxColour wxSystemSettingsNative::GetColour(
75 wxSystemColour nIndex
a0606634 76)
0e320a79 77{
a0606634
DW
78 COLORREF vRef;
79 wxColour vCol;
a12f4647 80 LONG vSysClr;
a0606634
DW
81 switch (nIndex)
82 {
83 //
84 // PM actually has values for these
85 //
86 case wxSYS_COLOUR_WINDOW:
a12f4647 87 vSysClr = SYSCLR_WINDOW;
a0606634
DW
88 break;
89
90 case wxSYS_COLOUR_WINDOWFRAME:
a12f4647 91 vSysClr = SYSCLR_WINDOWFRAME;
a0606634
DW
92 break;
93
94 case wxSYS_COLOUR_MENUTEXT:
a12f4647
SN
95 vSysClr = SYSCLR_MENUTEXT;
96 break;
97
98 case wxSYS_COLOUR_MENUHILIGHT:
99 vSysClr = SYSCLR_MENUHILITE;
a0606634
DW
100 break;
101
102 case wxSYS_COLOUR_BTNFACE:
a12f4647 103 vSysClr = SYSCLR_BUTTONMIDDLE;
a0606634
DW
104 break;
105
106 case wxSYS_COLOUR_BTNSHADOW:
a12f4647 107 vSysClr = SYSCLR_BUTTONDARK;
a0606634
DW
108 break;
109
110 case wxSYS_COLOUR_BTNHIGHLIGHT:
a12f4647
SN
111 vSysClr = SYSCLR_BUTTONLIGHT;
112 break;
113
114 case wxSYS_COLOUR_BACKGROUND:
115 vSysClr = SYSCLR_BACKGROUND;
116 break;
117
118 case wxSYS_COLOUR_APPWORKSPACE:
119 vSysClr = SYSCLR_APPWORKSPACE;
a0606634
DW
120 break;
121
d697657f 122 case wxSYS_COLOUR_MENUBAR:
a12f4647
SN
123 case wxSYS_COLOUR_MENU:
124 vSysClr = SYSCLR_MENU;
125 break;
126
127 case wxSYS_COLOUR_INACTIVECAPTION:
128 vSysClr = SYSCLR_INACTIVETITLE;
129 break;
130
131 case wxSYS_COLOUR_INACTIVEBORDER:
132 vSysClr = SYSCLR_INACTIVEBORDER;
d697657f
DW
133 break;
134
a0606634 135 case wxSYS_COLOUR_LISTBOX:
a12f4647
SN
136 vSysClr = SYSCLR_ENTRYFIELD;
137 break;
138
a0606634 139 case wxSYS_COLOUR_CAPTIONTEXT:
a12f4647
SN
140 vSysClr = SYSCLR_TITLETEXT;
141 break;
a0606634 142
a0606634 143 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
a12f4647
SN
144 vSysClr = SYSCLR_INACTIVETITLETEXT;
145 break;
146
147 case wxSYS_COLOUR_WINDOWTEXT:
a0606634 148 case wxSYS_COLOUR_BTNTEXT:
a12f4647 149 vSysClr = SYSCLR_WINDOWTEXT;
a0606634
DW
150 break;
151
a12f4647
SN
152 case wxSYS_COLOUR_INFOTEXT:
153 vSysClr = SYSCLR_HELPTEXT;
154 break;
a0606634
DW
155
156 case wxSYS_COLOUR_ACTIVECAPTION:
a12f4647
SN
157 vSysClr = SYSCLR_ACTIVETITLE;
158 break;
159
a0606634 160 case wxSYS_COLOUR_ACTIVEBORDER:
a12f4647
SN
161 vSysClr = SYSCLR_ACTIVEBORDER;
162 break;
163
a0606634 164 case wxSYS_COLOUR_HIGHLIGHT:
a12f4647 165 vSysClr = SYSCLR_HILITEBACKGROUND;
a0606634
DW
166 break;
167
168 case wxSYS_COLOUR_SCROLLBAR:
a12f4647
SN
169 vSysClr = SYSCLR_SCROLLBAR;
170 break;
171
a0606634 172 case wxSYS_COLOUR_HIGHLIGHTTEXT:
a12f4647
SN
173 vSysClr = SYSCLR_HILITEFOREGROUND;
174 break;
175
176 case wxSYS_COLOUR_INFOBK:
177 vSysClr = SYSCLR_HELPBACKGROUND;
178 break;
179
180 // Don't know what these should be, so leave them grey (normally)
a0606634
DW
181 case wxSYS_COLOUR_GRAYTEXT:
182 case wxSYS_COLOUR_3DDKSHADOW:
183 case wxSYS_COLOUR_3DLIGHT:
a12f4647
SN
184 case wxSYS_COLOUR_HOTLIGHT:
185 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
186 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
187 vSysClr = SYSCLR_BUTTONMIDDLE;
a0606634
DW
188 break;
189
190 default:
a12f4647 191 vSysClr = SYSCLR_WINDOW;
a0606634
DW
192 break;
193 }
a12f4647
SN
194 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP,
195 vSysClr,
196 0L );
197 vCol.Set( GetRValue(vRef),
198 GetGValue(vRef),
199 GetBValue(vRef) );
a0606634 200 return(vCol);
793c7f9b 201} // end of wxSystemSettingsNative::GetColour
0e320a79 202
793c7f9b
DW
203wxFont wxSystemSettingsNative::GetFont(
204 wxSystemFont index
205)
0e320a79
DW
206{
207 // TODO
208 switch (index)
209 {
210 case wxSYS_DEVICE_DEFAULT_FONT:
211 {
212 break;
213 }
214 case wxSYS_DEFAULT_PALETTE:
215 {
216 break;
217 }
218 case wxSYS_SYSTEM_FIXED_FONT:
219 {
220 break;
221 }
222 case wxSYS_SYSTEM_FONT:
223 {
224 break;
225 }
226 default:
227 case wxSYS_DEFAULT_GUI_FONT:
228 {
229 break;
230 }
231 }
7e99520b
DW
232 if(wxSWISS_FONT)
233 return *wxSWISS_FONT;
0e320a79 234
7e99520b 235 return wxNullFont;
0e320a79
DW
236}
237
238// Get a system metric, e.g. scrollbar size
6670f564
WS
239int wxSystemSettingsNative::GetMetric( wxSystemMetric index,
240 wxWindow* WXUNUSED(win) )
0e320a79 241{
409c9842
DW
242 switch ( index)
243 {
1d451c5b
RD
244 // TODO case wxSYS_MOUSE_BUTTONS:
245 // TODO case wxSYS_BORDER_X:
246 // TODO case wxSYS_BORDER_Y:
247 // TODO case wxSYS_CURSOR_X:
248 // TODO case wxSYS_CURSOR_Y:
249 // TODO case wxSYS_DCLICK_X:
250 // TODO case wxSYS_DCLICK_Y:
251 // TODO case wxSYS_DRAG_X:
252 // TODO case wxSYS_DRAG_Y:
253 // TODO case wxSYS_EDGE_X:
254 // TODO case wxSYS_EDGE_Y:
255 // TODO case wxSYS_HSCROLL_ARROW_X:
256 // TODO case wxSYS_HSCROLL_ARROW_Y:
257 // TODO case wxSYS_HTHUMB_X:
258 // TODO case wxSYS_ICON_X:
259 // TODO case wxSYS_ICON_Y:
260 // TODO case wxSYS_ICONSPACING_X:
261 // TODO case wxSYS_ICONSPACING_Y:
262 // TODO case wxSYS_WINDOWMIN_X:
263 // TODO case wxSYS_WINDOWMIN_Y:
6670f564 264
0e320a79 265 case wxSYS_SCREEN_X:
68a2e005 266 return ::WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
0e320a79 267 case wxSYS_SCREEN_Y:
68a2e005 268 return ::WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
6670f564 269
1d451c5b
RD
270 // TODO case wxSYS_FRAMESIZE_X:
271 // TODO case wxSYS_FRAMESIZE_Y:
272 // TODO case wxSYS_SMALLICON_X:
273 // TODO case wxSYS_SMALLICON_Y:
a12f4647
SN
274
275 case wxSYS_HSCROLL_Y:
276 return ::WinQuerySysValue(HWND_DESKTOP,SV_CYHSCROLL);
277 case wxSYS_VSCROLL_X:
278 return ::WinQuerySysValue(HWND_DESKTOP,SV_CXVSCROLL);
279
1d451c5b
RD
280 // TODO case wxSYS_VSCROLL_ARROW_X:
281 // TODO case wxSYS_VSCROLL_ARROW_Y:
282 // TODO case wxSYS_VTHUMB_Y:
283 // TODO case wxSYS_CAPTION_Y:
284 // TODO case wxSYS_MENU_Y:
285 // TODO case wxSYS_NETWORK_PRESENT:
286 // TODO case wxSYS_PENWINDOWS_PRESENT:
287 // TODO case wxSYS_SHOW_SOUNDS:
288 // TODO case wxSYS_SWAP_BUTTONS:
63a3cd7a
WS
289
290 default:
63ae3663 291 break;
409c9842 292 }
6670f564 293 return -1; // unsupported metric
0e320a79
DW
294}
295
6670f564 296bool wxSystemSettingsNative::HasFeature( wxSystemFeature index )
253293c1
VS
297{
298 switch (index)
299 {
1a2076a2 300 case wxSYS_CAN_ICONIZE_FRAME:
6670f564 301 return true;
793c7f9b 302
45abfa71
WS
303 // TODO case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
304 // TODO case wxSYS_TABLET_PRESENT:
305
306 default:
307 break;
253293c1 308 }
6670f564
WS
309
310 return false;
253293c1 311}