]>
Commit | Line | Data |
---|---|---|
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/module.h" | |
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_MENUBAR: | |
153 | vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP | |
154 | ,SYSCLR_MENU | |
155 | ,0L | |
156 | ); | |
157 | vCol.Set( GetRValue(vRef) | |
158 | ,GetGValue(vRef) | |
159 | ,GetBValue(vRef) | |
160 | ); | |
161 | break; | |
162 | ||
163 | // | |
164 | // We'll have to just give values to these | |
165 | // | |
166 | case wxSYS_COLOUR_LISTBOX: | |
167 | case wxSYS_COLOUR_CAPTIONTEXT: | |
168 | return(*wxWHITE); | |
169 | break; | |
170 | ||
171 | case wxSYS_COLOUR_WINDOWTEXT: | |
172 | case wxSYS_COLOUR_INACTIVECAPTIONTEXT: | |
173 | case wxSYS_COLOUR_BTNTEXT: | |
174 | case wxSYS_COLOUR_INFOTEXT: | |
175 | vCol = (*wxBLACK); | |
176 | break; | |
177 | ||
178 | // | |
179 | // We should customize these to look like other ports | |
180 | // | |
181 | ||
182 | case wxSYS_COLOUR_ACTIVECAPTION: | |
183 | case wxSYS_COLOUR_ACTIVEBORDER: | |
184 | case wxSYS_COLOUR_HIGHLIGHT: | |
185 | vCol = (*wxBLUE); | |
186 | break; | |
187 | ||
188 | case wxSYS_COLOUR_SCROLLBAR: | |
189 | case wxSYS_COLOUR_BACKGROUND: | |
190 | case wxSYS_COLOUR_INACTIVECAPTION: | |
191 | case wxSYS_COLOUR_MENU: | |
192 | case wxSYS_COLOUR_INACTIVEBORDER: | |
193 | case wxSYS_COLOUR_APPWORKSPACE: | |
194 | case wxSYS_COLOUR_HIGHLIGHTTEXT: | |
195 | case wxSYS_COLOUR_GRAYTEXT: | |
196 | case wxSYS_COLOUR_3DDKSHADOW: | |
197 | case wxSYS_COLOUR_3DLIGHT: | |
198 | case wxSYS_COLOUR_INFOBK: | |
199 | vCol = (*wxLIGHT_GREY); | |
200 | break; | |
201 | ||
202 | default: | |
203 | vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP | |
204 | ,SYSCLR_WINDOW | |
205 | ,0L | |
206 | ); | |
207 | vCol.Set( GetRValue(vRef) | |
208 | ,GetGValue(vRef) | |
209 | ,GetBValue(vRef) | |
210 | ); | |
211 | break; | |
212 | } | |
213 | return(vCol); | |
214 | } // end of wxSystemSettingsNative::GetColour | |
215 | ||
216 | wxFont wxSystemSettingsNative::GetFont( | |
217 | wxSystemFont index | |
218 | ) | |
219 | { | |
220 | // TODO | |
221 | switch (index) | |
222 | { | |
223 | case wxSYS_DEVICE_DEFAULT_FONT: | |
224 | { | |
225 | break; | |
226 | } | |
227 | case wxSYS_DEFAULT_PALETTE: | |
228 | { | |
229 | break; | |
230 | } | |
231 | case wxSYS_SYSTEM_FIXED_FONT: | |
232 | { | |
233 | break; | |
234 | } | |
235 | case wxSYS_SYSTEM_FONT: | |
236 | { | |
237 | break; | |
238 | } | |
239 | default: | |
240 | case wxSYS_DEFAULT_GUI_FONT: | |
241 | { | |
242 | break; | |
243 | } | |
244 | } | |
245 | if(wxSWISS_FONT) | |
246 | return *wxSWISS_FONT; | |
247 | ||
248 | return wxNullFont; | |
249 | } | |
250 | ||
251 | // Get a system metric, e.g. scrollbar size | |
252 | int wxSystemSettingsNative::GetMetric( | |
253 | wxSystemMetric index | |
254 | ) | |
255 | { | |
256 | switch ( index) | |
257 | { | |
258 | case wxSYS_MOUSE_BUTTONS: | |
259 | // TODO | |
260 | return 0; | |
261 | case wxSYS_BORDER_X: | |
262 | // TODO | |
263 | return 0; | |
264 | case wxSYS_BORDER_Y: | |
265 | // TODO | |
266 | return 0; | |
267 | case wxSYS_CURSOR_X: | |
268 | // TODO | |
269 | return 0; | |
270 | case wxSYS_CURSOR_Y: | |
271 | // TODO | |
272 | return 0; | |
273 | case wxSYS_DCLICK_X: | |
274 | // TODO | |
275 | return 0; | |
276 | case wxSYS_DCLICK_Y: | |
277 | // TODO | |
278 | return 0; | |
279 | case wxSYS_DRAG_X: | |
280 | // TODO | |
281 | return 0; | |
282 | case wxSYS_DRAG_Y: | |
283 | // TODO | |
284 | return 0; | |
285 | case wxSYS_EDGE_X: | |
286 | // TODO | |
287 | return 0; | |
288 | case wxSYS_EDGE_Y: | |
289 | // TODO | |
290 | return 0; | |
291 | case wxSYS_HSCROLL_ARROW_X: | |
292 | // TODO | |
293 | return 0; | |
294 | case wxSYS_HSCROLL_ARROW_Y: | |
295 | // TODO | |
296 | return 0; | |
297 | case wxSYS_HTHUMB_X: | |
298 | // TODO | |
299 | return 0; | |
300 | case wxSYS_ICON_X: | |
301 | // TODO | |
302 | return 0; | |
303 | case wxSYS_ICON_Y: | |
304 | // TODO | |
305 | return 0; | |
306 | case wxSYS_ICONSPACING_X: | |
307 | // TODO | |
308 | return 0; | |
309 | case wxSYS_ICONSPACING_Y: | |
310 | // TODO | |
311 | return 0; | |
312 | case wxSYS_WINDOWMIN_X: | |
313 | // TODO | |
314 | return 0; | |
315 | case wxSYS_WINDOWMIN_Y: | |
316 | // TODO | |
317 | return 0; | |
318 | case wxSYS_SCREEN_X: | |
319 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
320 | case wxSYS_SCREEN_Y: | |
321 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
322 | case wxSYS_FRAMESIZE_X: | |
323 | // TODO | |
324 | return 0; | |
325 | case wxSYS_FRAMESIZE_Y: | |
326 | // TODO | |
327 | return 0; | |
328 | case wxSYS_SMALLICON_X: | |
329 | // TODO | |
330 | return 0; | |
331 | case wxSYS_SMALLICON_Y: | |
332 | // TODO | |
333 | return 0; | |
334 | case wxSYS_HSCROLL_Y: | |
335 | // TODO | |
336 | return 0; | |
337 | case wxSYS_VSCROLL_X: | |
338 | // TODO | |
339 | return 0; | |
340 | case wxSYS_VSCROLL_ARROW_X: | |
341 | // TODO | |
342 | return 0; | |
343 | case wxSYS_VSCROLL_ARROW_Y: | |
344 | // TODO | |
345 | return 0; | |
346 | case wxSYS_VTHUMB_Y: | |
347 | // TODO | |
348 | return 0; | |
349 | case wxSYS_CAPTION_Y: | |
350 | // TODO | |
351 | return 0; | |
352 | case wxSYS_MENU_Y: | |
353 | // TODO | |
354 | return 0; | |
355 | case wxSYS_NETWORK_PRESENT: | |
356 | // TODO | |
357 | return 0; | |
358 | case wxSYS_PENWINDOWS_PRESENT: | |
359 | // TODO | |
360 | return 0; | |
361 | case wxSYS_SHOW_SOUNDS: | |
362 | // TODO | |
363 | return 0; | |
364 | case wxSYS_SWAP_BUTTONS: | |
365 | // TODO | |
366 | return 0; | |
367 | default: | |
368 | return 0; | |
369 | } | |
370 | return 0; | |
371 | } | |
372 | ||
373 | bool wxSystemSettingsNative::HasFeature( | |
374 | wxSystemFeature index | |
375 | ) | |
376 | { | |
377 | switch (index) | |
378 | { | |
379 | case wxSYS_CAN_ICONIZE_FRAME: | |
380 | return TRUE; | |
381 | ||
382 | case wxSYS_CAN_DRAW_FRAME_DECORATIONS: | |
383 | return FALSE; | |
384 | ||
385 | default: | |
386 | return FALSE; | |
387 | } | |
388 | return FALSE; | |
389 | } |