]> git.saurik.com Git - wxWidgets.git/blame - src/os2/settings.cpp
mention wx[Flex]GridSizer too
[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"
0e320a79
DW
21#endif
22
23#include "wx/settings.h"
409c9842
DW
24#include "wx/window.h"
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{
64 return TRUE;
65}
66
67void wxSystemSettingsModule::OnExit()
68{
69 sm_optionNames.Clear();
70 sm_optionValues.Clear();
71 delete gs_fontDefault;
72}
73
a0606634
DW
74wxColour wxSystemSettings::GetSystemColour(
75 int nIndex
76)
0e320a79 77{
a0606634
DW
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 );
a0606634
DW
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 );
a0606634
DW
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 );
a0606634
DW
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 );
a0606634
DW
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 );
a0606634
DW
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:
7e99520b 163 vCol = (*wxBLACK);
a0606634
DW
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:
7e99520b 173 vCol = (*wxBLUE);
a0606634
DW
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:
7e99520b 187 vCol = (*wxLIGHT_GREY);
a0606634
DW
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 );
a0606634
DW
199 break;
200 }
201 return(vCol);
202} // end of wxSystemSettings::GetSystemColour
0e320a79
DW
203
204wxFont 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 }
7e99520b
DW
231 if(wxSWISS_FONT)
232 return *wxSWISS_FONT;
0e320a79 233
7e99520b 234 return wxNullFont;
0e320a79
DW
235}
236
237// Get a system metric, e.g. scrollbar size
238int wxSystemSettings::GetSystemMetric(int index)
239{
409c9842
DW
240 switch ( index)
241 {
0e320a79
DW
242 case wxSYS_MOUSE_BUTTONS:
243 // TODO
409c9842 244 return 0;
0e320a79
DW
245 case wxSYS_BORDER_X:
246 // TODO
409c9842 247 return 0;
0e320a79
DW
248 case wxSYS_BORDER_Y:
249 // TODO
409c9842 250 return 0;
0e320a79
DW
251 case wxSYS_CURSOR_X:
252 // TODO
409c9842 253 return 0;
0e320a79
DW
254 case wxSYS_CURSOR_Y:
255 // TODO
409c9842 256 return 0;
0e320a79
DW
257 case wxSYS_DCLICK_X:
258 // TODO
409c9842 259 return 0;
0e320a79
DW
260 case wxSYS_DCLICK_Y:
261 // TODO
409c9842 262 return 0;
0e320a79
DW
263 case wxSYS_DRAG_X:
264 // TODO
409c9842 265 return 0;
0e320a79
DW
266 case wxSYS_DRAG_Y:
267 // TODO
409c9842 268 return 0;
0e320a79
DW
269 case wxSYS_EDGE_X:
270 // TODO
409c9842 271 return 0;
0e320a79
DW
272 case wxSYS_EDGE_Y:
273 // TODO
409c9842 274 return 0;
0e320a79
DW
275 case wxSYS_HSCROLL_ARROW_X:
276 // TODO
409c9842 277 return 0;
0e320a79
DW
278 case wxSYS_HSCROLL_ARROW_Y:
279 // TODO
409c9842 280 return 0;
0e320a79
DW
281 case wxSYS_HTHUMB_X:
282 // TODO
409c9842 283 return 0;
0e320a79
DW
284 case wxSYS_ICON_X:
285 // TODO
409c9842 286 return 0;
0e320a79
DW
287 case wxSYS_ICON_Y:
288 // TODO
409c9842 289 return 0;
0e320a79
DW
290 case wxSYS_ICONSPACING_X:
291 // TODO
409c9842 292 return 0;
0e320a79
DW
293 case wxSYS_ICONSPACING_Y:
294 // TODO
409c9842 295 return 0;
0e320a79
DW
296 case wxSYS_WINDOWMIN_X:
297 // TODO
409c9842 298 return 0;
0e320a79
DW
299 case wxSYS_WINDOWMIN_Y:
300 // TODO
409c9842 301 return 0;
0e320a79
DW
302 case wxSYS_SCREEN_X:
303 // TODO
409c9842 304 return 0;
0e320a79
DW
305 case wxSYS_SCREEN_Y:
306 // TODO
409c9842 307 return 0;
0e320a79
DW
308 case wxSYS_FRAMESIZE_X:
309 // TODO
409c9842 310 return 0;
0e320a79
DW
311 case wxSYS_FRAMESIZE_Y:
312 // TODO
409c9842 313 return 0;
0e320a79
DW
314 case wxSYS_SMALLICON_X:
315 // TODO
409c9842 316 return 0;
0e320a79
DW
317 case wxSYS_SMALLICON_Y:
318 // TODO
409c9842 319 return 0;
0e320a79
DW
320 case wxSYS_HSCROLL_Y:
321 // TODO
409c9842 322 return 0;
0e320a79
DW
323 case wxSYS_VSCROLL_X:
324 // TODO
409c9842 325 return 0;
0e320a79
DW
326 case wxSYS_VSCROLL_ARROW_X:
327 // TODO
409c9842 328 return 0;
0e320a79
DW
329 case wxSYS_VSCROLL_ARROW_Y:
330 // TODO
409c9842 331 return 0;
0e320a79
DW
332 case wxSYS_VTHUMB_Y:
333 // TODO
409c9842 334 return 0;
0e320a79
DW
335 case wxSYS_CAPTION_Y:
336 // TODO
409c9842 337 return 0;
0e320a79
DW
338 case wxSYS_MENU_Y:
339 // TODO
409c9842 340 return 0;
0e320a79
DW
341 case wxSYS_NETWORK_PRESENT:
342 // TODO
409c9842 343 return 0;
0e320a79
DW
344 case wxSYS_PENWINDOWS_PRESENT:
345 // TODO
409c9842 346 return 0;
0e320a79
DW
347 case wxSYS_SHOW_SOUNDS:
348 // TODO
409c9842 349 return 0;
0e320a79
DW
350 case wxSYS_SWAP_BUTTONS:
351 // TODO
409c9842
DW
352 return 0;
353 default:
354 return 0;
355 }
356 return 0;
0e320a79
DW
357}
358