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