1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/settings.cpp
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
20 #include "wx/gdicmn.h"
23 #include "wx/module.h"
24 #include "wx/settings.h"
25 #include "wx/window.h"
26 #include "wx/os2/private.h"
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
32 friend class wxSystemSettings
;
34 virtual bool OnInit();
35 virtual void OnExit();
38 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule
)
40 static wxArrayString sm_optionNames
;
41 static wxArrayString sm_optionValues
;
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 static wxFont
*gs_fontDefault
= NULL
;
50 // ============================================================================
52 // ============================================================================
54 // ----------------------------------------------------------------------------
55 // wxSystemSettingsModule
56 // ----------------------------------------------------------------------------
58 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule
, wxModule
)
60 wxArrayString
wxSystemSettingsModule::sm_optionNames
;
61 wxArrayString
wxSystemSettingsModule::sm_optionValues
;
63 bool wxSystemSettingsModule::OnInit()
68 void wxSystemSettingsModule::OnExit()
70 sm_optionNames
.Clear();
71 sm_optionValues
.Clear();
72 delete gs_fontDefault
;
75 wxColour
wxSystemSettingsNative::GetColour(
85 // PM actually has values for these
87 case wxSYS_COLOUR_WINDOW
:
88 vSysClr
= SYSCLR_WINDOW
;
91 case wxSYS_COLOUR_WINDOWFRAME
:
92 vSysClr
= SYSCLR_WINDOWFRAME
;
95 case wxSYS_COLOUR_MENUTEXT
:
96 vSysClr
= SYSCLR_MENUTEXT
;
99 case wxSYS_COLOUR_MENUHILIGHT
:
100 vSysClr
= SYSCLR_MENUHILITE
;
103 case wxSYS_COLOUR_BTNFACE
:
104 vSysClr
= SYSCLR_BUTTONMIDDLE
;
107 case wxSYS_COLOUR_BTNSHADOW
:
108 vSysClr
= SYSCLR_BUTTONDARK
;
111 case wxSYS_COLOUR_BTNHIGHLIGHT
:
112 vSysClr
= SYSCLR_BUTTONLIGHT
;
115 case wxSYS_COLOUR_BACKGROUND
:
116 vSysClr
= SYSCLR_BACKGROUND
;
119 case wxSYS_COLOUR_APPWORKSPACE
:
120 vSysClr
= SYSCLR_APPWORKSPACE
;
123 case wxSYS_COLOUR_MENUBAR
:
124 case wxSYS_COLOUR_MENU
:
125 vSysClr
= SYSCLR_MENU
;
128 case wxSYS_COLOUR_INACTIVECAPTION
:
129 vSysClr
= SYSCLR_INACTIVETITLE
;
132 case wxSYS_COLOUR_INACTIVEBORDER
:
133 vSysClr
= SYSCLR_INACTIVEBORDER
;
136 case wxSYS_COLOUR_LISTBOX
:
137 vSysClr
= SYSCLR_ENTRYFIELD
;
140 case wxSYS_COLOUR_CAPTIONTEXT
:
141 vSysClr
= SYSCLR_TITLETEXT
;
144 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
145 vSysClr
= SYSCLR_INACTIVETITLETEXT
;
148 case wxSYS_COLOUR_WINDOWTEXT
:
149 case wxSYS_COLOUR_BTNTEXT
:
150 vSysClr
= SYSCLR_WINDOWTEXT
;
153 case wxSYS_COLOUR_INFOTEXT
:
154 vSysClr
= SYSCLR_HELPTEXT
;
157 case wxSYS_COLOUR_ACTIVECAPTION
:
158 vSysClr
= SYSCLR_ACTIVETITLE
;
161 case wxSYS_COLOUR_ACTIVEBORDER
:
162 vSysClr
= SYSCLR_ACTIVEBORDER
;
165 case wxSYS_COLOUR_HIGHLIGHT
:
166 vSysClr
= SYSCLR_HILITEBACKGROUND
;
169 case wxSYS_COLOUR_SCROLLBAR
:
170 vSysClr
= SYSCLR_SCROLLBAR
;
173 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
174 vSysClr
= SYSCLR_HILITEFOREGROUND
;
177 case wxSYS_COLOUR_INFOBK
:
178 vSysClr
= SYSCLR_HELPBACKGROUND
;
181 // Don't know what these should be, so leave them grey (normally)
182 case wxSYS_COLOUR_GRAYTEXT
:
183 case wxSYS_COLOUR_3DDKSHADOW
:
184 case wxSYS_COLOUR_3DLIGHT
:
185 case wxSYS_COLOUR_HOTLIGHT
:
186 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
187 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
188 vSysClr
= SYSCLR_BUTTONMIDDLE
;
192 vSysClr
= SYSCLR_WINDOW
;
195 vRef
= (ULONG
)::WinQuerySysColor( HWND_DESKTOP
,
198 vCol
.Set( GetRValue(vRef
),
202 } // end of wxSystemSettingsNative::GetColour
204 wxFont
wxSystemSettingsNative::GetFont(
211 case wxSYS_DEVICE_DEFAULT_FONT
:
215 case wxSYS_DEFAULT_PALETTE
:
219 case wxSYS_SYSTEM_FIXED_FONT
:
223 case wxSYS_SYSTEM_FONT
:
228 case wxSYS_DEFAULT_GUI_FONT
:
234 return *wxSWISS_FONT
;
239 // Get a system metric, e.g. scrollbar size
240 int wxSystemSettingsNative::GetMetric( wxSystemMetric index
,
241 wxWindow
* WXUNUSED(win
) )
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:
267 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CXSCREEN
);
269 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CYSCREEN
);
271 // TODO case wxSYS_FRAMESIZE_X:
272 // TODO case wxSYS_FRAMESIZE_Y:
273 // TODO case wxSYS_SMALLICON_X:
274 // TODO case wxSYS_SMALLICON_Y:
276 case wxSYS_HSCROLL_Y
:
277 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CYHSCROLL
);
278 case wxSYS_VSCROLL_X
:
279 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CXVSCROLL
);
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:
294 return -1; // unsupported metric
297 bool wxSystemSettingsNative::HasFeature( wxSystemFeature index
)
301 case wxSYS_CAN_ICONIZE_FRAME
:
304 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: