Bitmap button updates
[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 #include "wx/module.h"
22 #endif
23
24 #include "wx/settings.h"
25 #include "wx/window.h"
26 #include "wx/os2/private.h"
27
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)
30 class wxSystemSettingsModule : public wxModule
31 {
32 friend class wxSystemSettings;
33 public:
34 virtual bool OnInit();
35 virtual void OnExit();
36
37 private:
38 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
39
40 static wxArrayString sm_optionNames;
41 static wxArrayString sm_optionValues;
42 };
43
44 // ----------------------------------------------------------------------------
45 // global data
46 // ----------------------------------------------------------------------------
47
48 static wxFont *gs_fontDefault = NULL;
49
50 // ============================================================================
51 // implementation
52 // ============================================================================
53
54 // ----------------------------------------------------------------------------
55 // wxSystemSettingsModule
56 // ----------------------------------------------------------------------------
57
58 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
59
60 wxArrayString wxSystemSettingsModule::sm_optionNames;
61 wxArrayString wxSystemSettingsModule::sm_optionValues;
62
63 bool wxSystemSettingsModule::OnInit()
64 {
65 return TRUE;
66 }
67
68 void wxSystemSettingsModule::OnExit()
69 {
70 sm_optionNames.Clear();
71 sm_optionValues.Clear();
72 delete gs_fontDefault;
73 }
74
75 wxColour wxSystemSettingsNative::GetColour(
76 wxSystemColour nIndex
77 )
78 {
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 );
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 );
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 );
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 );
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 );
150 break;
151
152 case wxSYS_COLOUR_BTNDARKSHADOW:
153 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
154 ,SYSCLR_BUTTONDARK
155 ,0L
156 );
157 vCol.Set( GetRValue(vRef)
158 ,GetGValue(vRef)
159 ,GetBValue(vRef)
160 );
161 break;
162
163 case wxSYS_COLOUR_MENUBAR:
164 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
165 ,SYSCLR_MENU
166 ,0L
167 );
168 vCol.Set( GetRValue(vRef)
169 ,GetGValue(vRef)
170 ,GetBValue(vRef)
171 );
172 break;
173
174 //
175 // We'll have to just give values to these
176 //
177 case wxSYS_COLOUR_LISTBOX:
178 case wxSYS_COLOUR_CAPTIONTEXT:
179 return(*wxWHITE);
180 break;
181
182 case wxSYS_COLOUR_WINDOWTEXT:
183 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
184 case wxSYS_COLOUR_BTNTEXT:
185 case wxSYS_COLOUR_INFOTEXT:
186 vCol = (*wxBLACK);
187 break;
188
189 //
190 // We should customize these to look like other ports
191 //
192
193 case wxSYS_COLOUR_ACTIVECAPTION:
194 case wxSYS_COLOUR_ACTIVEBORDER:
195 case wxSYS_COLOUR_HIGHLIGHT:
196 vCol = (*wxBLUE);
197 break;
198
199 case wxSYS_COLOUR_SCROLLBAR:
200 case wxSYS_COLOUR_BACKGROUND:
201 case wxSYS_COLOUR_INACTIVECAPTION:
202 case wxSYS_COLOUR_MENU:
203 case wxSYS_COLOUR_INACTIVEBORDER:
204 case wxSYS_COLOUR_APPWORKSPACE:
205 case wxSYS_COLOUR_HIGHLIGHTTEXT:
206 case wxSYS_COLOUR_GRAYTEXT:
207 case wxSYS_COLOUR_3DDKSHADOW:
208 case wxSYS_COLOUR_3DLIGHT:
209 case wxSYS_COLOUR_INFOBK:
210 vCol = (*wxLIGHT_GREY);
211 break;
212
213 default:
214 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
215 ,SYSCLR_WINDOW
216 ,0L
217 );
218 vCol.Set( GetRValue(vRef)
219 ,GetGValue(vRef)
220 ,GetBValue(vRef)
221 );
222 break;
223 }
224 return(vCol);
225 } // end of wxSystemSettingsNative::GetColour
226
227 wxFont wxSystemSettingsNative::GetFont(
228 wxSystemFont index
229 )
230 {
231 // TODO
232 switch (index)
233 {
234 case wxSYS_DEVICE_DEFAULT_FONT:
235 {
236 break;
237 }
238 case wxSYS_DEFAULT_PALETTE:
239 {
240 break;
241 }
242 case wxSYS_SYSTEM_FIXED_FONT:
243 {
244 break;
245 }
246 case wxSYS_SYSTEM_FONT:
247 {
248 break;
249 }
250 default:
251 case wxSYS_DEFAULT_GUI_FONT:
252 {
253 break;
254 }
255 }
256 if(wxSWISS_FONT)
257 return *wxSWISS_FONT;
258
259 return wxNullFont;
260 }
261
262 // Get a system metric, e.g. scrollbar size
263 int wxSystemSettingsNative::GetMetric(
264 wxSystemMetric index
265 )
266 {
267 switch ( index)
268 {
269 case wxSYS_MOUSE_BUTTONS:
270 // TODO
271 return 0;
272 case wxSYS_BORDER_X:
273 // TODO
274 return 0;
275 case wxSYS_BORDER_Y:
276 // TODO
277 return 0;
278 case wxSYS_CURSOR_X:
279 // TODO
280 return 0;
281 case wxSYS_CURSOR_Y:
282 // TODO
283 return 0;
284 case wxSYS_DCLICK_X:
285 // TODO
286 return 0;
287 case wxSYS_DCLICK_Y:
288 // TODO
289 return 0;
290 case wxSYS_DRAG_X:
291 // TODO
292 return 0;
293 case wxSYS_DRAG_Y:
294 // TODO
295 return 0;
296 case wxSYS_EDGE_X:
297 // TODO
298 return 0;
299 case wxSYS_EDGE_Y:
300 // TODO
301 return 0;
302 case wxSYS_HSCROLL_ARROW_X:
303 // TODO
304 return 0;
305 case wxSYS_HSCROLL_ARROW_Y:
306 // TODO
307 return 0;
308 case wxSYS_HTHUMB_X:
309 // TODO
310 return 0;
311 case wxSYS_ICON_X:
312 // TODO
313 return 0;
314 case wxSYS_ICON_Y:
315 // TODO
316 return 0;
317 case wxSYS_ICONSPACING_X:
318 // TODO
319 return 0;
320 case wxSYS_ICONSPACING_Y:
321 // TODO
322 return 0;
323 case wxSYS_WINDOWMIN_X:
324 // TODO
325 return 0;
326 case wxSYS_WINDOWMIN_Y:
327 // TODO
328 return 0;
329 case wxSYS_SCREEN_X:
330 // TODO
331 return 0;
332 case wxSYS_SCREEN_Y:
333 // TODO
334 return 0;
335 case wxSYS_FRAMESIZE_X:
336 // TODO
337 return 0;
338 case wxSYS_FRAMESIZE_Y:
339 // TODO
340 return 0;
341 case wxSYS_SMALLICON_X:
342 // TODO
343 return 0;
344 case wxSYS_SMALLICON_Y:
345 // TODO
346 return 0;
347 case wxSYS_HSCROLL_Y:
348 // TODO
349 return 0;
350 case wxSYS_VSCROLL_X:
351 // TODO
352 return 0;
353 case wxSYS_VSCROLL_ARROW_X:
354 // TODO
355 return 0;
356 case wxSYS_VSCROLL_ARROW_Y:
357 // TODO
358 return 0;
359 case wxSYS_VTHUMB_Y:
360 // TODO
361 return 0;
362 case wxSYS_CAPTION_Y:
363 // TODO
364 return 0;
365 case wxSYS_MENU_Y:
366 // TODO
367 return 0;
368 case wxSYS_NETWORK_PRESENT:
369 // TODO
370 return 0;
371 case wxSYS_PENWINDOWS_PRESENT:
372 // TODO
373 return 0;
374 case wxSYS_SHOW_SOUNDS:
375 // TODO
376 return 0;
377 case wxSYS_SWAP_BUTTONS:
378 // TODO
379 return 0;
380 default:
381 return 0;
382 }
383 return 0;
384 }
385
386 bool wxSystemSettingsNative::HasFeature(
387 wxSystemFeature index
388 )
389 {
390 switch (index)
391 {
392 case wxSYS_CAN_ICONIZE_FRAME:
393 return TRUE;
394
395 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
396 return FALSE;
397
398 default:
399 return FALSE;
400 }
401 return FALSE;
402 }