]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
63a3cd7a | 2 | // Name: src/os2/settings.cpp |
0e320a79 | 3 | // Purpose: wxSettings |
409c9842 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
409c9842 | 6 | // Created: 10/15/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
409c9842 | 8 | // Copyright: (c) David Webster |
65571936 | 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 | ||
e7262344 | 23 | #include "wx/module.h" |
0e320a79 | 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 | { | |
63a3cd7a | 65 | return true; |
fd6d5c94 DW |
66 | } |
67 | ||
68 | void wxSystemSettingsModule::OnExit() | |
69 | { | |
70 | sm_optionNames.Clear(); | |
71 | sm_optionValues.Clear(); | |
72 | delete gs_fontDefault; | |
73 | } | |
74 | ||
793c7f9b DW |
75 | wxColour wxSystemSettingsNative::GetColour( |
76 | wxSystemColour nIndex | |
a0606634 | 77 | ) |
0e320a79 | 78 | { |
a0606634 DW |
79 | COLORREF vRef; |
80 | wxColour vCol; | |
a12f4647 | 81 | LONG vSysClr; |
a0606634 DW |
82 | switch (nIndex) |
83 | { | |
84 | // | |
85 | // PM actually has values for these | |
86 | // | |
87 | case wxSYS_COLOUR_WINDOW: | |
a12f4647 | 88 | vSysClr = SYSCLR_WINDOW; |
a0606634 DW |
89 | break; |
90 | ||
91 | case wxSYS_COLOUR_WINDOWFRAME: | |
a12f4647 | 92 | vSysClr = SYSCLR_WINDOWFRAME; |
a0606634 DW |
93 | break; |
94 | ||
95 | case wxSYS_COLOUR_MENUTEXT: | |
a12f4647 SN |
96 | vSysClr = SYSCLR_MENUTEXT; |
97 | break; | |
98 | ||
99 | case wxSYS_COLOUR_MENUHILIGHT: | |
100 | vSysClr = SYSCLR_MENUHILITE; | |
a0606634 DW |
101 | break; |
102 | ||
103 | case wxSYS_COLOUR_BTNFACE: | |
a12f4647 | 104 | vSysClr = SYSCLR_BUTTONMIDDLE; |
a0606634 DW |
105 | break; |
106 | ||
107 | case wxSYS_COLOUR_BTNSHADOW: | |
a12f4647 | 108 | vSysClr = SYSCLR_BUTTONDARK; |
a0606634 DW |
109 | break; |
110 | ||
111 | case wxSYS_COLOUR_BTNHIGHLIGHT: | |
a12f4647 SN |
112 | vSysClr = SYSCLR_BUTTONLIGHT; |
113 | break; | |
114 | ||
115 | case wxSYS_COLOUR_BACKGROUND: | |
116 | vSysClr = SYSCLR_BACKGROUND; | |
117 | break; | |
118 | ||
119 | case wxSYS_COLOUR_APPWORKSPACE: | |
120 | vSysClr = SYSCLR_APPWORKSPACE; | |
a0606634 DW |
121 | break; |
122 | ||
d697657f | 123 | case wxSYS_COLOUR_MENUBAR: |
a12f4647 SN |
124 | case wxSYS_COLOUR_MENU: |
125 | vSysClr = SYSCLR_MENU; | |
126 | break; | |
127 | ||
128 | case wxSYS_COLOUR_INACTIVECAPTION: | |
129 | vSysClr = SYSCLR_INACTIVETITLE; | |
130 | break; | |
131 | ||
132 | case wxSYS_COLOUR_INACTIVEBORDER: | |
133 | vSysClr = SYSCLR_INACTIVEBORDER; | |
d697657f DW |
134 | break; |
135 | ||
a0606634 | 136 | case wxSYS_COLOUR_LISTBOX: |
a12f4647 SN |
137 | vSysClr = SYSCLR_ENTRYFIELD; |
138 | break; | |
139 | ||
a0606634 | 140 | case wxSYS_COLOUR_CAPTIONTEXT: |
a12f4647 SN |
141 | vSysClr = SYSCLR_TITLETEXT; |
142 | break; | |
a0606634 | 143 | |
a0606634 | 144 | case wxSYS_COLOUR_INACTIVECAPTIONTEXT: |
a12f4647 SN |
145 | vSysClr = SYSCLR_INACTIVETITLETEXT; |
146 | break; | |
147 | ||
148 | case wxSYS_COLOUR_WINDOWTEXT: | |
a0606634 | 149 | case wxSYS_COLOUR_BTNTEXT: |
a12f4647 | 150 | vSysClr = SYSCLR_WINDOWTEXT; |
a0606634 DW |
151 | break; |
152 | ||
a12f4647 SN |
153 | case wxSYS_COLOUR_INFOTEXT: |
154 | vSysClr = SYSCLR_HELPTEXT; | |
155 | break; | |
a0606634 DW |
156 | |
157 | case wxSYS_COLOUR_ACTIVECAPTION: | |
a12f4647 SN |
158 | vSysClr = SYSCLR_ACTIVETITLE; |
159 | break; | |
160 | ||
a0606634 | 161 | case wxSYS_COLOUR_ACTIVEBORDER: |
a12f4647 SN |
162 | vSysClr = SYSCLR_ACTIVEBORDER; |
163 | break; | |
164 | ||
a0606634 | 165 | case wxSYS_COLOUR_HIGHLIGHT: |
a12f4647 | 166 | vSysClr = SYSCLR_HILITEBACKGROUND; |
a0606634 DW |
167 | break; |
168 | ||
169 | case wxSYS_COLOUR_SCROLLBAR: | |
a12f4647 SN |
170 | vSysClr = SYSCLR_SCROLLBAR; |
171 | break; | |
172 | ||
a0606634 | 173 | case wxSYS_COLOUR_HIGHLIGHTTEXT: |
a12f4647 SN |
174 | vSysClr = SYSCLR_HILITEFOREGROUND; |
175 | break; | |
176 | ||
177 | case wxSYS_COLOUR_INFOBK: | |
178 | vSysClr = SYSCLR_HELPBACKGROUND; | |
179 | break; | |
180 | ||
181 | // Don't know what these should be, so leave them grey (normally) | |
a0606634 DW |
182 | case wxSYS_COLOUR_GRAYTEXT: |
183 | case wxSYS_COLOUR_3DDKSHADOW: | |
184 | case wxSYS_COLOUR_3DLIGHT: | |
a12f4647 SN |
185 | case wxSYS_COLOUR_HOTLIGHT: |
186 | case wxSYS_COLOUR_GRADIENTACTIVECAPTION: | |
187 | case wxSYS_COLOUR_GRADIENTINACTIVECAPTION: | |
188 | vSysClr = SYSCLR_BUTTONMIDDLE; | |
a0606634 DW |
189 | break; |
190 | ||
191 | default: | |
a12f4647 | 192 | vSysClr = SYSCLR_WINDOW; |
a0606634 DW |
193 | break; |
194 | } | |
a12f4647 SN |
195 | vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP, |
196 | vSysClr, | |
197 | 0L ); | |
198 | vCol.Set( GetRValue(vRef), | |
199 | GetGValue(vRef), | |
200 | GetBValue(vRef) ); | |
a0606634 | 201 | return(vCol); |
793c7f9b | 202 | } // end of wxSystemSettingsNative::GetColour |
0e320a79 | 203 | |
793c7f9b DW |
204 | wxFont wxSystemSettingsNative::GetFont( |
205 | wxSystemFont index | |
206 | ) | |
0e320a79 DW |
207 | { |
208 | // TODO | |
209 | switch (index) | |
210 | { | |
211 | case wxSYS_DEVICE_DEFAULT_FONT: | |
212 | { | |
213 | break; | |
214 | } | |
215 | case wxSYS_DEFAULT_PALETTE: | |
216 | { | |
217 | break; | |
218 | } | |
219 | case wxSYS_SYSTEM_FIXED_FONT: | |
220 | { | |
221 | break; | |
222 | } | |
223 | case wxSYS_SYSTEM_FONT: | |
224 | { | |
225 | break; | |
226 | } | |
227 | default: | |
228 | case wxSYS_DEFAULT_GUI_FONT: | |
229 | { | |
230 | break; | |
231 | } | |
232 | } | |
7e99520b DW |
233 | if(wxSWISS_FONT) |
234 | return *wxSWISS_FONT; | |
0e320a79 | 235 | |
7e99520b | 236 | return wxNullFont; |
0e320a79 DW |
237 | } |
238 | ||
239 | // Get a system metric, e.g. scrollbar size | |
6670f564 WS |
240 | int wxSystemSettingsNative::GetMetric( wxSystemMetric index, |
241 | wxWindow* WXUNUSED(win) ) | |
0e320a79 | 242 | { |
409c9842 DW |
243 | switch ( index) |
244 | { | |
1d451c5b RD |
245 | // TODO case wxSYS_MOUSE_BUTTONS: |
246 | // TODO case wxSYS_BORDER_X: | |
247 | // TODO case wxSYS_BORDER_Y: | |
248 | // TODO case wxSYS_CURSOR_X: | |
249 | // TODO case wxSYS_CURSOR_Y: | |
250 | // TODO case wxSYS_DCLICK_X: | |
251 | // TODO case wxSYS_DCLICK_Y: | |
252 | // TODO case wxSYS_DRAG_X: | |
253 | // TODO case wxSYS_DRAG_Y: | |
254 | // TODO case wxSYS_EDGE_X: | |
255 | // TODO case wxSYS_EDGE_Y: | |
256 | // TODO case wxSYS_HSCROLL_ARROW_X: | |
257 | // TODO case wxSYS_HSCROLL_ARROW_Y: | |
258 | // TODO case wxSYS_HTHUMB_X: | |
259 | // TODO case wxSYS_ICON_X: | |
260 | // TODO case wxSYS_ICON_Y: | |
261 | // TODO case wxSYS_ICONSPACING_X: | |
262 | // TODO case wxSYS_ICONSPACING_Y: | |
263 | // TODO case wxSYS_WINDOWMIN_X: | |
264 | // TODO case wxSYS_WINDOWMIN_Y: | |
6670f564 | 265 | |
0e320a79 | 266 | case wxSYS_SCREEN_X: |
68a2e005 | 267 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); |
0e320a79 | 268 | case wxSYS_SCREEN_Y: |
68a2e005 | 269 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); |
6670f564 | 270 | |
1d451c5b RD |
271 | // TODO case wxSYS_FRAMESIZE_X: |
272 | // TODO case wxSYS_FRAMESIZE_Y: | |
273 | // TODO case wxSYS_SMALLICON_X: | |
274 | // TODO case wxSYS_SMALLICON_Y: | |
a12f4647 SN |
275 | |
276 | case wxSYS_HSCROLL_Y: | |
277 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CYHSCROLL); | |
278 | case wxSYS_VSCROLL_X: | |
279 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CXVSCROLL); | |
280 | ||
1d451c5b RD |
281 | // TODO case wxSYS_VSCROLL_ARROW_X: |
282 | // TODO case wxSYS_VSCROLL_ARROW_Y: | |
283 | // TODO case wxSYS_VTHUMB_Y: | |
284 | // TODO case wxSYS_CAPTION_Y: | |
285 | // TODO case wxSYS_MENU_Y: | |
286 | // TODO case wxSYS_NETWORK_PRESENT: | |
287 | // TODO case wxSYS_PENWINDOWS_PRESENT: | |
288 | // TODO case wxSYS_SHOW_SOUNDS: | |
289 | // TODO case wxSYS_SWAP_BUTTONS: | |
63a3cd7a WS |
290 | |
291 | default: | |
63ae3663 | 292 | break; |
409c9842 | 293 | } |
6670f564 | 294 | return -1; // unsupported metric |
0e320a79 DW |
295 | } |
296 | ||
6670f564 | 297 | bool wxSystemSettingsNative::HasFeature( wxSystemFeature index ) |
253293c1 VS |
298 | { |
299 | switch (index) | |
300 | { | |
1a2076a2 | 301 | case wxSYS_CAN_ICONIZE_FRAME: |
6670f564 | 302 | return true; |
793c7f9b | 303 | |
45abfa71 WS |
304 | // TODO case wxSYS_CAN_DRAW_FRAME_DECORATIONS: |
305 | // TODO case wxSYS_TABLET_PRESENT: | |
306 | ||
307 | default: | |
308 | break; | |
253293c1 | 309 | } |
6670f564 WS |
310 | |
311 | return false; | |
253293c1 | 312 | } |