]> git.saurik.com Git - wxWidgets.git/blob - src/os2/settings.cpp
Restored wxFileName::GetFullPath()
[wxWidgets.git] / src / os2 / settings.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: settings.cpp
3 // Purpose: wxSettings
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/15/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifndef WX_PRECOMP
16 #include <stdio.h>
17 #include "wx/defs.h"
18 #include "wx/pen.h"
19 #include "wx/brush.h"
20 #include "wx/gdicmn.h"
21 #endif
22
23 #include "wx/settings.h"
24 #include "wx/window.h"
25 #include "wx/os2/private.h"
26
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)
29 class wxSystemSettingsModule : public wxModule
30 {
31 friend class wxSystemSettings;
32 public:
33 virtual bool OnInit();
34 virtual void OnExit();
35
36 private:
37 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
38
39 static wxArrayString sm_optionNames;
40 static wxArrayString sm_optionValues;
41 };
42
43 // ----------------------------------------------------------------------------
44 // global data
45 // ----------------------------------------------------------------------------
46
47 static wxFont *gs_fontDefault = NULL;
48
49 // ============================================================================
50 // implementation
51 // ============================================================================
52
53 // ----------------------------------------------------------------------------
54 // wxSystemSettingsModule
55 // ----------------------------------------------------------------------------
56
57 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
58
59 wxArrayString wxSystemSettingsModule::sm_optionNames;
60 wxArrayString wxSystemSettingsModule::sm_optionValues;
61
62 bool wxSystemSettingsModule::OnInit()
63 {
64 return TRUE;
65 }
66
67 void wxSystemSettingsModule::OnExit()
68 {
69 sm_optionNames.Clear();
70 sm_optionValues.Clear();
71 delete gs_fontDefault;
72 }
73
74 wxColour wxSystemSettings::GetSystemColour(
75 int nIndex
76 )
77 {
78 COLORREF vRef;
79 wxColour vCol;
80 switch (nIndex)
81 {
82 //
83 // PM actually has values for these
84 //
85 case wxSYS_COLOUR_WINDOW:
86 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
87 ,SYSCLR_WINDOW
88 ,0L
89 );
90 vCol.Set( GetRValue(vRef)
91 ,GetGValue(vRef)
92 ,GetBValue(vRef)
93 );
94 break;
95
96 case wxSYS_COLOUR_WINDOWFRAME:
97 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
98 ,SYSCLR_WINDOWFRAME
99 ,0L
100 );
101 vCol.Set( GetRValue(vRef)
102 ,GetGValue(vRef)
103 ,GetBValue(vRef)
104 );
105 break;
106
107 case wxSYS_COLOUR_MENUTEXT:
108 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
109 ,SYSCLR_MENUTEXT
110 ,0L
111 );
112 vCol.Set( GetRValue(vRef)
113 ,GetGValue(vRef)
114 ,GetBValue(vRef)
115 );
116 break;
117
118 case wxSYS_COLOUR_BTNFACE:
119 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
120 ,SYSCLR_BUTTONDEFAULT
121 ,0L
122 );
123 vCol.Set( GetRValue(vRef)
124 ,GetGValue(vRef)
125 ,GetBValue(vRef)
126 );
127 break;
128
129 case wxSYS_COLOUR_BTNSHADOW:
130 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
131 ,SYSCLR_BUTTONMIDDLE
132 ,0L
133 );
134 vCol.Set( GetRValue(vRef)
135 ,GetGValue(vRef)
136 ,GetBValue(vRef)
137 );
138 break;
139
140 case wxSYS_COLOUR_BTNHIGHLIGHT:
141 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
142 ,SYSCLR_BUTTONLIGHT
143 ,0L
144 );
145 vCol.Set( GetRValue(vRef)
146 ,GetGValue(vRef)
147 ,GetBValue(vRef)
148 );
149 break;
150
151 //
152 // We'll have to just give values to these
153 //
154 case wxSYS_COLOUR_LISTBOX:
155 case wxSYS_COLOUR_CAPTIONTEXT:
156 return(*wxWHITE);
157 break;
158
159 case wxSYS_COLOUR_WINDOWTEXT:
160 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
161 case wxSYS_COLOUR_BTNTEXT:
162 case wxSYS_COLOUR_INFOTEXT:
163 vCol = (*wxBLACK);
164 break;
165
166 //
167 // We should customize these to look like other ports
168 //
169
170 case wxSYS_COLOUR_ACTIVECAPTION:
171 case wxSYS_COLOUR_ACTIVEBORDER:
172 case wxSYS_COLOUR_HIGHLIGHT:
173 vCol = (*wxBLUE);
174 break;
175
176 case wxSYS_COLOUR_SCROLLBAR:
177 case wxSYS_COLOUR_BACKGROUND:
178 case wxSYS_COLOUR_INACTIVECAPTION:
179 case wxSYS_COLOUR_MENU:
180 case wxSYS_COLOUR_INACTIVEBORDER:
181 case wxSYS_COLOUR_APPWORKSPACE:
182 case wxSYS_COLOUR_HIGHLIGHTTEXT:
183 case wxSYS_COLOUR_GRAYTEXT:
184 case wxSYS_COLOUR_3DDKSHADOW:
185 case wxSYS_COLOUR_3DLIGHT:
186 case wxSYS_COLOUR_INFOBK:
187 vCol = (*wxLIGHT_GREY);
188 break;
189
190 default:
191 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
192 ,SYSCLR_WINDOW
193 ,0L
194 );
195 vCol.Set( GetRValue(vRef)
196 ,GetGValue(vRef)
197 ,GetBValue(vRef)
198 );
199 break;
200 }
201 return(vCol);
202 } // end of wxSystemSettings::GetSystemColour
203
204 wxFont wxSystemSettings::GetSystemFont(int index)
205 {
206 // TODO
207 switch (index)
208 {
209 case wxSYS_DEVICE_DEFAULT_FONT:
210 {
211 break;
212 }
213 case wxSYS_DEFAULT_PALETTE:
214 {
215 break;
216 }
217 case wxSYS_SYSTEM_FIXED_FONT:
218 {
219 break;
220 }
221 case wxSYS_SYSTEM_FONT:
222 {
223 break;
224 }
225 default:
226 case wxSYS_DEFAULT_GUI_FONT:
227 {
228 break;
229 }
230 }
231 if(wxSWISS_FONT)
232 return *wxSWISS_FONT;
233
234 return wxNullFont;
235 }
236
237 // Get a system metric, e.g. scrollbar size
238 int wxSystemSettings::GetSystemMetric(int index)
239 {
240 switch ( index)
241 {
242 case wxSYS_MOUSE_BUTTONS:
243 // TODO
244 return 0;
245 case wxSYS_BORDER_X:
246 // TODO
247 return 0;
248 case wxSYS_BORDER_Y:
249 // TODO
250 return 0;
251 case wxSYS_CURSOR_X:
252 // TODO
253 return 0;
254 case wxSYS_CURSOR_Y:
255 // TODO
256 return 0;
257 case wxSYS_DCLICK_X:
258 // TODO
259 return 0;
260 case wxSYS_DCLICK_Y:
261 // TODO
262 return 0;
263 case wxSYS_DRAG_X:
264 // TODO
265 return 0;
266 case wxSYS_DRAG_Y:
267 // TODO
268 return 0;
269 case wxSYS_EDGE_X:
270 // TODO
271 return 0;
272 case wxSYS_EDGE_Y:
273 // TODO
274 return 0;
275 case wxSYS_HSCROLL_ARROW_X:
276 // TODO
277 return 0;
278 case wxSYS_HSCROLL_ARROW_Y:
279 // TODO
280 return 0;
281 case wxSYS_HTHUMB_X:
282 // TODO
283 return 0;
284 case wxSYS_ICON_X:
285 // TODO
286 return 0;
287 case wxSYS_ICON_Y:
288 // TODO
289 return 0;
290 case wxSYS_ICONSPACING_X:
291 // TODO
292 return 0;
293 case wxSYS_ICONSPACING_Y:
294 // TODO
295 return 0;
296 case wxSYS_WINDOWMIN_X:
297 // TODO
298 return 0;
299 case wxSYS_WINDOWMIN_Y:
300 // TODO
301 return 0;
302 case wxSYS_SCREEN_X:
303 // TODO
304 return 0;
305 case wxSYS_SCREEN_Y:
306 // TODO
307 return 0;
308 case wxSYS_FRAMESIZE_X:
309 // TODO
310 return 0;
311 case wxSYS_FRAMESIZE_Y:
312 // TODO
313 return 0;
314 case wxSYS_SMALLICON_X:
315 // TODO
316 return 0;
317 case wxSYS_SMALLICON_Y:
318 // TODO
319 return 0;
320 case wxSYS_HSCROLL_Y:
321 // TODO
322 return 0;
323 case wxSYS_VSCROLL_X:
324 // TODO
325 return 0;
326 case wxSYS_VSCROLL_ARROW_X:
327 // TODO
328 return 0;
329 case wxSYS_VSCROLL_ARROW_Y:
330 // TODO
331 return 0;
332 case wxSYS_VTHUMB_Y:
333 // TODO
334 return 0;
335 case wxSYS_CAPTION_Y:
336 // TODO
337 return 0;
338 case wxSYS_MENU_Y:
339 // TODO
340 return 0;
341 case wxSYS_NETWORK_PRESENT:
342 // TODO
343 return 0;
344 case wxSYS_PENWINDOWS_PRESENT:
345 // TODO
346 return 0;
347 case wxSYS_SHOW_SOUNDS:
348 // TODO
349 return 0;
350 case wxSYS_SWAP_BUTTONS:
351 // TODO
352 return 0;
353 default:
354 return 0;
355 }
356 return 0;
357 }
358