]>
Commit | Line | Data |
---|---|---|
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) | |
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 | ||
a0606634 DW |
75 | wxColour wxSystemSettings::GetSystemColour( |
76 | int nIndex | |
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); | |
203 | } // end of wxSystemSettings::GetSystemColour | |
0e320a79 DW |
204 | |
205 | wxFont wxSystemSettings::GetSystemFont(int index) | |
206 | { | |
207 | // TODO | |
208 | switch (index) | |
209 | { | |
210 | case wxSYS_DEVICE_DEFAULT_FONT: | |
211 | { | |
212 | break; | |
213 | } | |
214 | case wxSYS_DEFAULT_PALETTE: | |
215 | { | |
216 | break; | |
217 | } | |
218 | case wxSYS_SYSTEM_FIXED_FONT: | |
219 | { | |
220 | break; | |
221 | } | |
222 | case wxSYS_SYSTEM_FONT: | |
223 | { | |
224 | break; | |
225 | } | |
226 | default: | |
227 | case wxSYS_DEFAULT_GUI_FONT: | |
228 | { | |
229 | break; | |
230 | } | |
231 | } | |
7e99520b DW |
232 | if(wxSWISS_FONT) |
233 | return *wxSWISS_FONT; | |
0e320a79 | 234 | |
7e99520b | 235 | return wxNullFont; |
0e320a79 DW |
236 | } |
237 | ||
238 | // Get a system metric, e.g. scrollbar size | |
239 | int wxSystemSettings::GetSystemMetric(int index) | |
240 | { | |
409c9842 DW |
241 | switch ( index) |
242 | { | |
0e320a79 DW |
243 | case wxSYS_MOUSE_BUTTONS: |
244 | // TODO | |
409c9842 | 245 | return 0; |
0e320a79 DW |
246 | case wxSYS_BORDER_X: |
247 | // TODO | |
409c9842 | 248 | return 0; |
0e320a79 DW |
249 | case wxSYS_BORDER_Y: |
250 | // TODO | |
409c9842 | 251 | return 0; |
0e320a79 DW |
252 | case wxSYS_CURSOR_X: |
253 | // TODO | |
409c9842 | 254 | return 0; |
0e320a79 DW |
255 | case wxSYS_CURSOR_Y: |
256 | // TODO | |
409c9842 | 257 | return 0; |
0e320a79 DW |
258 | case wxSYS_DCLICK_X: |
259 | // TODO | |
409c9842 | 260 | return 0; |
0e320a79 DW |
261 | case wxSYS_DCLICK_Y: |
262 | // TODO | |
409c9842 | 263 | return 0; |
0e320a79 DW |
264 | case wxSYS_DRAG_X: |
265 | // TODO | |
409c9842 | 266 | return 0; |
0e320a79 DW |
267 | case wxSYS_DRAG_Y: |
268 | // TODO | |
409c9842 | 269 | return 0; |
0e320a79 DW |
270 | case wxSYS_EDGE_X: |
271 | // TODO | |
409c9842 | 272 | return 0; |
0e320a79 DW |
273 | case wxSYS_EDGE_Y: |
274 | // TODO | |
409c9842 | 275 | return 0; |
0e320a79 DW |
276 | case wxSYS_HSCROLL_ARROW_X: |
277 | // TODO | |
409c9842 | 278 | return 0; |
0e320a79 DW |
279 | case wxSYS_HSCROLL_ARROW_Y: |
280 | // TODO | |
409c9842 | 281 | return 0; |
0e320a79 DW |
282 | case wxSYS_HTHUMB_X: |
283 | // TODO | |
409c9842 | 284 | return 0; |
0e320a79 DW |
285 | case wxSYS_ICON_X: |
286 | // TODO | |
409c9842 | 287 | return 0; |
0e320a79 DW |
288 | case wxSYS_ICON_Y: |
289 | // TODO | |
409c9842 | 290 | return 0; |
0e320a79 DW |
291 | case wxSYS_ICONSPACING_X: |
292 | // TODO | |
409c9842 | 293 | return 0; |
0e320a79 DW |
294 | case wxSYS_ICONSPACING_Y: |
295 | // TODO | |
409c9842 | 296 | return 0; |
0e320a79 DW |
297 | case wxSYS_WINDOWMIN_X: |
298 | // TODO | |
409c9842 | 299 | return 0; |
0e320a79 DW |
300 | case wxSYS_WINDOWMIN_Y: |
301 | // TODO | |
409c9842 | 302 | return 0; |
0e320a79 DW |
303 | case wxSYS_SCREEN_X: |
304 | // TODO | |
409c9842 | 305 | return 0; |
0e320a79 DW |
306 | case wxSYS_SCREEN_Y: |
307 | // TODO | |
409c9842 | 308 | return 0; |
0e320a79 DW |
309 | case wxSYS_FRAMESIZE_X: |
310 | // TODO | |
409c9842 | 311 | return 0; |
0e320a79 DW |
312 | case wxSYS_FRAMESIZE_Y: |
313 | // TODO | |
409c9842 | 314 | return 0; |
0e320a79 DW |
315 | case wxSYS_SMALLICON_X: |
316 | // TODO | |
409c9842 | 317 | return 0; |
0e320a79 DW |
318 | case wxSYS_SMALLICON_Y: |
319 | // TODO | |
409c9842 | 320 | return 0; |
0e320a79 DW |
321 | case wxSYS_HSCROLL_Y: |
322 | // TODO | |
409c9842 | 323 | return 0; |
0e320a79 DW |
324 | case wxSYS_VSCROLL_X: |
325 | // TODO | |
409c9842 | 326 | return 0; |
0e320a79 DW |
327 | case wxSYS_VSCROLL_ARROW_X: |
328 | // TODO | |
409c9842 | 329 | return 0; |
0e320a79 DW |
330 | case wxSYS_VSCROLL_ARROW_Y: |
331 | // TODO | |
409c9842 | 332 | return 0; |
0e320a79 DW |
333 | case wxSYS_VTHUMB_Y: |
334 | // TODO | |
409c9842 | 335 | return 0; |
0e320a79 DW |
336 | case wxSYS_CAPTION_Y: |
337 | // TODO | |
409c9842 | 338 | return 0; |
0e320a79 DW |
339 | case wxSYS_MENU_Y: |
340 | // TODO | |
409c9842 | 341 | return 0; |
0e320a79 DW |
342 | case wxSYS_NETWORK_PRESENT: |
343 | // TODO | |
409c9842 | 344 | return 0; |
0e320a79 DW |
345 | case wxSYS_PENWINDOWS_PRESENT: |
346 | // TODO | |
409c9842 | 347 | return 0; |
0e320a79 DW |
348 | case wxSYS_SHOW_SOUNDS: |
349 | // TODO | |
409c9842 | 350 | return 0; |
0e320a79 DW |
351 | case wxSYS_SWAP_BUTTONS: |
352 | // TODO | |
409c9842 DW |
353 | return 0; |
354 | default: | |
355 | return 0; | |
356 | } | |
357 | return 0; | |
0e320a79 DW |
358 | } |
359 | ||
253293c1 VS |
360 | bool wxSystemSettings::GetCapability(int index) |
361 | { | |
362 | switch (index) | |
363 | { | |
364 | case wxSYS_CAN_ICONIZE_FRAME: | |
365 | case wxSYS_CAN_DRAW_FRAME_DECORATIONS: | |
366 | return TRUE; break; | |
367 | default: | |
368 | return FALSE; | |
369 | } | |
370 | } |