]>
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 | 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 | { | |
65 | return TRUE; | |
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; | |
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 | ||
d697657f DW |
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 | ||
a0606634 DW |
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); | |
a0606634 DW |
169 | |
170 | case wxSYS_COLOUR_WINDOWTEXT: | |
171 | case wxSYS_COLOUR_INACTIVECAPTIONTEXT: | |
172 | case wxSYS_COLOUR_BTNTEXT: | |
173 | case wxSYS_COLOUR_INFOTEXT: | |
7e99520b | 174 | vCol = (*wxBLACK); |
a0606634 DW |
175 | break; |
176 | ||
177 | // | |
178 | // We should customize these to look like other ports | |
179 | // | |
180 | ||
181 | case wxSYS_COLOUR_ACTIVECAPTION: | |
182 | case wxSYS_COLOUR_ACTIVEBORDER: | |
183 | case wxSYS_COLOUR_HIGHLIGHT: | |
7e99520b | 184 | vCol = (*wxBLUE); |
a0606634 DW |
185 | break; |
186 | ||
187 | case wxSYS_COLOUR_SCROLLBAR: | |
188 | case wxSYS_COLOUR_BACKGROUND: | |
189 | case wxSYS_COLOUR_INACTIVECAPTION: | |
190 | case wxSYS_COLOUR_MENU: | |
191 | case wxSYS_COLOUR_INACTIVEBORDER: | |
192 | case wxSYS_COLOUR_APPWORKSPACE: | |
193 | case wxSYS_COLOUR_HIGHLIGHTTEXT: | |
194 | case wxSYS_COLOUR_GRAYTEXT: | |
195 | case wxSYS_COLOUR_3DDKSHADOW: | |
196 | case wxSYS_COLOUR_3DLIGHT: | |
197 | case wxSYS_COLOUR_INFOBK: | |
7e99520b | 198 | vCol = (*wxLIGHT_GREY); |
a0606634 DW |
199 | break; |
200 | ||
201 | default: | |
202 | vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP | |
203 | ,SYSCLR_WINDOW | |
204 | ,0L | |
205 | ); | |
206 | vCol.Set( GetRValue(vRef) | |
207 | ,GetGValue(vRef) | |
208 | ,GetBValue(vRef) | |
209 | ); | |
a0606634 DW |
210 | break; |
211 | } | |
212 | return(vCol); | |
793c7f9b | 213 | } // end of wxSystemSettingsNative::GetColour |
0e320a79 | 214 | |
793c7f9b DW |
215 | wxFont wxSystemSettingsNative::GetFont( |
216 | wxSystemFont index | |
217 | ) | |
0e320a79 DW |
218 | { |
219 | // TODO | |
220 | switch (index) | |
221 | { | |
222 | case wxSYS_DEVICE_DEFAULT_FONT: | |
223 | { | |
224 | break; | |
225 | } | |
226 | case wxSYS_DEFAULT_PALETTE: | |
227 | { | |
228 | break; | |
229 | } | |
230 | case wxSYS_SYSTEM_FIXED_FONT: | |
231 | { | |
232 | break; | |
233 | } | |
234 | case wxSYS_SYSTEM_FONT: | |
235 | { | |
236 | break; | |
237 | } | |
238 | default: | |
239 | case wxSYS_DEFAULT_GUI_FONT: | |
240 | { | |
241 | break; | |
242 | } | |
243 | } | |
7e99520b DW |
244 | if(wxSWISS_FONT) |
245 | return *wxSWISS_FONT; | |
0e320a79 | 246 | |
7e99520b | 247 | return wxNullFont; |
0e320a79 DW |
248 | } |
249 | ||
250 | // Get a system metric, e.g. scrollbar size | |
6670f564 WS |
251 | int wxSystemSettingsNative::GetMetric( wxSystemMetric index, |
252 | wxWindow* WXUNUSED(win) ) | |
0e320a79 | 253 | { |
409c9842 DW |
254 | switch ( index) |
255 | { | |
1d451c5b RD |
256 | // TODO case wxSYS_MOUSE_BUTTONS: |
257 | // TODO case wxSYS_BORDER_X: | |
258 | // TODO case wxSYS_BORDER_Y: | |
259 | // TODO case wxSYS_CURSOR_X: | |
260 | // TODO case wxSYS_CURSOR_Y: | |
261 | // TODO case wxSYS_DCLICK_X: | |
262 | // TODO case wxSYS_DCLICK_Y: | |
263 | // TODO case wxSYS_DRAG_X: | |
264 | // TODO case wxSYS_DRAG_Y: | |
265 | // TODO case wxSYS_EDGE_X: | |
266 | // TODO case wxSYS_EDGE_Y: | |
267 | // TODO case wxSYS_HSCROLL_ARROW_X: | |
268 | // TODO case wxSYS_HSCROLL_ARROW_Y: | |
269 | // TODO case wxSYS_HTHUMB_X: | |
270 | // TODO case wxSYS_ICON_X: | |
271 | // TODO case wxSYS_ICON_Y: | |
272 | // TODO case wxSYS_ICONSPACING_X: | |
273 | // TODO case wxSYS_ICONSPACING_Y: | |
274 | // TODO case wxSYS_WINDOWMIN_X: | |
275 | // TODO case wxSYS_WINDOWMIN_Y: | |
6670f564 | 276 | |
0e320a79 | 277 | case wxSYS_SCREEN_X: |
68a2e005 | 278 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); |
0e320a79 | 279 | case wxSYS_SCREEN_Y: |
68a2e005 | 280 | return ::WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); |
6670f564 | 281 | |
1d451c5b RD |
282 | // TODO case wxSYS_FRAMESIZE_X: |
283 | // TODO case wxSYS_FRAMESIZE_Y: | |
284 | // TODO case wxSYS_SMALLICON_X: | |
285 | // TODO case wxSYS_SMALLICON_Y: | |
286 | // TODO case wxSYS_HSCROLL_Y: | |
287 | // TODO case wxSYS_VSCROLL_X: | |
288 | // TODO case wxSYS_VSCROLL_ARROW_X: | |
289 | // TODO case wxSYS_VSCROLL_ARROW_Y: | |
290 | // TODO case wxSYS_VTHUMB_Y: | |
291 | // TODO case wxSYS_CAPTION_Y: | |
292 | // TODO case wxSYS_MENU_Y: | |
293 | // TODO case wxSYS_NETWORK_PRESENT: | |
294 | // TODO case wxSYS_PENWINDOWS_PRESENT: | |
295 | // TODO case wxSYS_SHOW_SOUNDS: | |
296 | // TODO case wxSYS_SWAP_BUTTONS: | |
409c9842 | 297 | } |
6670f564 | 298 | return -1; // unsupported metric |
0e320a79 DW |
299 | } |
300 | ||
6670f564 | 301 | bool wxSystemSettingsNative::HasFeature( wxSystemFeature index ) |
253293c1 VS |
302 | { |
303 | switch (index) | |
304 | { | |
1a2076a2 | 305 | case wxSYS_CAN_ICONIZE_FRAME: |
6670f564 | 306 | return true; |
793c7f9b | 307 | |
253293c1 | 308 | case wxSYS_CAN_DRAW_FRAME_DECORATIONS: |
6670f564 | 309 | return false; |
253293c1 | 310 | } |
6670f564 WS |
311 | |
312 | return false; | |
253293c1 | 313 | } |