]> git.saurik.com Git - wxWidgets.git/blob - src/os2/settings.cpp
Set MONOLITHIC for posix platforms based on the output of wx-config,
[wxWidgets.git] / src / os2 / settings.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/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/pen.h"
18 #include "wx/brush.h"
19 #include "wx/gdicmn.h"
20 #include "wx/window.h"
21 #include "wx/settings.h"
22 #endif
23
24 #include "wx/module.h"
25 #include "wx/os2/private.h"
26
27 // the module which is used to clean up wxSystemSettings data (this is a
28 // singleton class so it can't be done in the dtor)
29 class wxSystemSettingsModule : public wxModule
30 {
31 friend class wxSystemSettings;
32 public:
33 virtual bool OnInit();
34 virtual void OnExit();
35
36 private:
37 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
38
39 static wxArrayString sm_optionNames;
40 static wxArrayString sm_optionValues;
41 };
42
43 // ----------------------------------------------------------------------------
44 // global data
45 // ----------------------------------------------------------------------------
46
47 static wxFont *gs_fontDefault = NULL;
48
49 // ============================================================================
50 // implementation
51 // ============================================================================
52
53 // ----------------------------------------------------------------------------
54 // wxSystemSettingsModule
55 // ----------------------------------------------------------------------------
56
57 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
58
59 wxArrayString wxSystemSettingsModule::sm_optionNames;
60 wxArrayString wxSystemSettingsModule::sm_optionValues;
61
62 bool wxSystemSettingsModule::OnInit()
63 {
64 return true;
65 }
66
67 void wxSystemSettingsModule::OnExit()
68 {
69 sm_optionNames.Clear();
70 sm_optionValues.Clear();
71 delete gs_fontDefault;
72 }
73
74 wxColour wxSystemSettingsNative::GetColour(
75 wxSystemColour nIndex
76 )
77 {
78 COLORREF vRef;
79 wxColour vCol;
80 LONG vSysClr;
81 switch (nIndex)
82 {
83 //
84 // PM actually has values for these
85 //
86 case wxSYS_COLOUR_WINDOW:
87 vSysClr = SYSCLR_WINDOW;
88 break;
89
90 case wxSYS_COLOUR_WINDOWFRAME:
91 vSysClr = SYSCLR_WINDOWFRAME;
92 break;
93
94 case wxSYS_COLOUR_MENUTEXT:
95 vSysClr = SYSCLR_MENUTEXT;
96 break;
97
98 case wxSYS_COLOUR_MENUHILIGHT:
99 vSysClr = SYSCLR_MENUHILITE;
100 break;
101
102 case wxSYS_COLOUR_BTNFACE:
103 vSysClr = SYSCLR_BUTTONMIDDLE;
104 break;
105
106 case wxSYS_COLOUR_BTNSHADOW:
107 vSysClr = SYSCLR_BUTTONDARK;
108 break;
109
110 case wxSYS_COLOUR_BTNHIGHLIGHT:
111 vSysClr = SYSCLR_BUTTONLIGHT;
112 break;
113
114 case wxSYS_COLOUR_BACKGROUND:
115 vSysClr = SYSCLR_BACKGROUND;
116 break;
117
118 case wxSYS_COLOUR_APPWORKSPACE:
119 vSysClr = SYSCLR_APPWORKSPACE;
120 break;
121
122 case wxSYS_COLOUR_MENUBAR:
123 case wxSYS_COLOUR_MENU:
124 vSysClr = SYSCLR_MENU;
125 break;
126
127 case wxSYS_COLOUR_INACTIVECAPTION:
128 vSysClr = SYSCLR_INACTIVETITLE;
129 break;
130
131 case wxSYS_COLOUR_INACTIVEBORDER:
132 vSysClr = SYSCLR_INACTIVEBORDER;
133 break;
134
135 case wxSYS_COLOUR_LISTBOX:
136 vSysClr = SYSCLR_ENTRYFIELD;
137 break;
138
139 case wxSYS_COLOUR_CAPTIONTEXT:
140 vSysClr = SYSCLR_TITLETEXT;
141 break;
142
143 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
144 vSysClr = SYSCLR_INACTIVETITLETEXT;
145 break;
146
147 case wxSYS_COLOUR_WINDOWTEXT:
148 case wxSYS_COLOUR_BTNTEXT:
149 vSysClr = SYSCLR_WINDOWTEXT;
150 break;
151
152 case wxSYS_COLOUR_INFOTEXT:
153 vSysClr = SYSCLR_HELPTEXT;
154 break;
155
156 case wxSYS_COLOUR_ACTIVECAPTION:
157 vSysClr = SYSCLR_ACTIVETITLE;
158 break;
159
160 case wxSYS_COLOUR_ACTIVEBORDER:
161 vSysClr = SYSCLR_ACTIVEBORDER;
162 break;
163
164 case wxSYS_COLOUR_HIGHLIGHT:
165 vSysClr = SYSCLR_HILITEBACKGROUND;
166 break;
167
168 case wxSYS_COLOUR_SCROLLBAR:
169 vSysClr = SYSCLR_SCROLLBAR;
170 break;
171
172 case wxSYS_COLOUR_HIGHLIGHTTEXT:
173 vSysClr = SYSCLR_HILITEFOREGROUND;
174 break;
175
176 case wxSYS_COLOUR_INFOBK:
177 vSysClr = SYSCLR_HELPBACKGROUND;
178 break;
179
180 // Don't know what these should be, so leave them grey (normally)
181 case wxSYS_COLOUR_GRAYTEXT:
182 case wxSYS_COLOUR_3DDKSHADOW:
183 case wxSYS_COLOUR_3DLIGHT:
184 case wxSYS_COLOUR_HOTLIGHT:
185 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
186 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
187 vSysClr = SYSCLR_BUTTONMIDDLE;
188 break;
189
190 default:
191 vSysClr = SYSCLR_WINDOW;
192 break;
193 }
194 vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP,
195 vSysClr,
196 0L );
197 vCol.Set( GetRValue(vRef),
198 GetGValue(vRef),
199 GetBValue(vRef) );
200 return(vCol);
201 } // end of wxSystemSettingsNative::GetColour
202
203 wxFont wxSystemSettingsNative::GetFont(
204 wxSystemFont index
205 )
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 }
232 if(wxSWISS_FONT)
233 return *wxSWISS_FONT;
234
235 return wxNullFont;
236 }
237
238 // Get a system metric, e.g. scrollbar size
239 int wxSystemSettingsNative::GetMetric( wxSystemMetric index,
240 wxWindow* WXUNUSED(win) )
241 {
242 switch ( index)
243 {
244 // TODO case wxSYS_MOUSE_BUTTONS:
245 // TODO case wxSYS_BORDER_X:
246 // TODO case wxSYS_BORDER_Y:
247 // TODO case wxSYS_CURSOR_X:
248 // TODO case wxSYS_CURSOR_Y:
249 // TODO case wxSYS_DCLICK_X:
250 // TODO case wxSYS_DCLICK_Y:
251 // TODO case wxSYS_DRAG_X:
252 // TODO case wxSYS_DRAG_Y:
253 // TODO case wxSYS_EDGE_X:
254 // TODO case wxSYS_EDGE_Y:
255 // TODO case wxSYS_HSCROLL_ARROW_X:
256 // TODO case wxSYS_HSCROLL_ARROW_Y:
257 // TODO case wxSYS_HTHUMB_X:
258 // TODO case wxSYS_ICON_X:
259 // TODO case wxSYS_ICON_Y:
260 // TODO case wxSYS_ICONSPACING_X:
261 // TODO case wxSYS_ICONSPACING_Y:
262 // TODO case wxSYS_WINDOWMIN_X:
263 // TODO case wxSYS_WINDOWMIN_Y:
264
265 case wxSYS_SCREEN_X:
266 return ::WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
267 case wxSYS_SCREEN_Y:
268 return ::WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
269
270 // TODO case wxSYS_FRAMESIZE_X:
271 // TODO case wxSYS_FRAMESIZE_Y:
272 // TODO case wxSYS_SMALLICON_X:
273 // TODO case wxSYS_SMALLICON_Y:
274
275 case wxSYS_HSCROLL_Y:
276 return ::WinQuerySysValue(HWND_DESKTOP,SV_CYHSCROLL);
277 case wxSYS_VSCROLL_X:
278 return ::WinQuerySysValue(HWND_DESKTOP,SV_CXVSCROLL);
279
280 // TODO case wxSYS_VSCROLL_ARROW_X:
281 // TODO case wxSYS_VSCROLL_ARROW_Y:
282 // TODO case wxSYS_VTHUMB_Y:
283 // TODO case wxSYS_CAPTION_Y:
284 // TODO case wxSYS_MENU_Y:
285 // TODO case wxSYS_NETWORK_PRESENT:
286 // TODO case wxSYS_PENWINDOWS_PRESENT:
287 // TODO case wxSYS_SHOW_SOUNDS:
288 // TODO case wxSYS_SWAP_BUTTONS:
289
290 default:
291 break;
292 }
293 return -1; // unsupported metric
294 }
295
296 bool wxSystemSettingsNative::HasFeature( wxSystemFeature index )
297 {
298 switch (index)
299 {
300 case wxSYS_CAN_ICONIZE_FRAME:
301 return true;
302
303 // TODO case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
304 // TODO case wxSYS_TABLET_PRESENT:
305
306 default:
307 break;
308 }
309
310 return false;
311 }