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"
19 #include "wx/gdicmn.h"
20 #include "wx/window.h"
21 #include "wx/settings.h"
24 #include "wx/module.h"
25 #include "wx/os2/private.h"
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
31 friend class wxSystemSettings
;
33 virtual bool OnInit();
34 virtual void OnExit();
37 DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule
)
39 static wxArrayString sm_optionNames
;
40 static wxArrayString sm_optionValues
;
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
47 static wxFont
*gs_fontDefault
= NULL
;
49 // ============================================================================
51 // ============================================================================
53 // ----------------------------------------------------------------------------
54 // wxSystemSettingsModule
55 // ----------------------------------------------------------------------------
57 IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule
, wxModule
)
59 wxArrayString
wxSystemSettingsModule::sm_optionNames
;
60 wxArrayString
wxSystemSettingsModule::sm_optionValues
;
62 bool wxSystemSettingsModule::OnInit()
67 void wxSystemSettingsModule::OnExit()
69 sm_optionNames
.Clear();
70 sm_optionValues
.Clear();
71 delete gs_fontDefault
;
74 wxColour
wxSystemSettingsNative::GetColour(
84 // PM actually has values for these
86 case wxSYS_COLOUR_WINDOW
:
87 vSysClr
= SYSCLR_WINDOW
;
90 case wxSYS_COLOUR_WINDOWFRAME
:
91 vSysClr
= SYSCLR_WINDOWFRAME
;
94 case wxSYS_COLOUR_MENUTEXT
:
95 vSysClr
= SYSCLR_MENUTEXT
;
98 case wxSYS_COLOUR_MENUHILIGHT
:
99 vSysClr
= SYSCLR_MENUHILITE
;
102 case wxSYS_COLOUR_BTNFACE
:
103 vSysClr
= SYSCLR_BUTTONMIDDLE
;
106 case wxSYS_COLOUR_BTNSHADOW
:
107 vSysClr
= SYSCLR_BUTTONDARK
;
110 case wxSYS_COLOUR_BTNHIGHLIGHT
:
111 vSysClr
= SYSCLR_BUTTONLIGHT
;
114 case wxSYS_COLOUR_BACKGROUND
:
115 vSysClr
= SYSCLR_BACKGROUND
;
118 case wxSYS_COLOUR_APPWORKSPACE
:
119 vSysClr
= SYSCLR_APPWORKSPACE
;
122 case wxSYS_COLOUR_MENUBAR
:
123 case wxSYS_COLOUR_MENU
:
124 vSysClr
= SYSCLR_MENU
;
127 case wxSYS_COLOUR_INACTIVECAPTION
:
128 vSysClr
= SYSCLR_INACTIVETITLE
;
131 case wxSYS_COLOUR_INACTIVEBORDER
:
132 vSysClr
= SYSCLR_INACTIVEBORDER
;
135 case wxSYS_COLOUR_LISTBOX
:
136 vSysClr
= SYSCLR_ENTRYFIELD
;
139 case wxSYS_COLOUR_CAPTIONTEXT
:
140 vSysClr
= SYSCLR_TITLETEXT
;
143 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
144 vSysClr
= SYSCLR_INACTIVETITLETEXT
;
147 case wxSYS_COLOUR_WINDOWTEXT
:
148 case wxSYS_COLOUR_BTNTEXT
:
149 vSysClr
= SYSCLR_WINDOWTEXT
;
152 case wxSYS_COLOUR_INFOTEXT
:
153 vSysClr
= SYSCLR_HELPTEXT
;
156 case wxSYS_COLOUR_ACTIVECAPTION
:
157 vSysClr
= SYSCLR_ACTIVETITLE
;
160 case wxSYS_COLOUR_ACTIVEBORDER
:
161 vSysClr
= SYSCLR_ACTIVEBORDER
;
164 case wxSYS_COLOUR_HIGHLIGHT
:
165 vSysClr
= SYSCLR_HILITEBACKGROUND
;
168 case wxSYS_COLOUR_SCROLLBAR
:
169 vSysClr
= SYSCLR_SCROLLBAR
;
172 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
173 vSysClr
= SYSCLR_HILITEFOREGROUND
;
176 case wxSYS_COLOUR_INFOBK
:
177 vSysClr
= SYSCLR_HELPBACKGROUND
;
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
;
191 vSysClr
= SYSCLR_WINDOW
;
194 vRef
= (ULONG
)::WinQuerySysColor( HWND_DESKTOP
,
197 vCol
.Set( GetRValue(vRef
),
201 } // end of wxSystemSettingsNative::GetColour
203 wxFont
wxSystemSettingsNative::GetFont(
210 case wxSYS_DEVICE_DEFAULT_FONT
:
214 case wxSYS_DEFAULT_PALETTE
:
218 case wxSYS_SYSTEM_FIXED_FONT
:
222 case wxSYS_SYSTEM_FONT
:
227 case wxSYS_DEFAULT_GUI_FONT
:
233 return *wxSWISS_FONT
;
238 // Get a system metric, e.g. scrollbar size
239 int wxSystemSettingsNative::GetMetric( wxSystemMetric index
,
240 wxWindow
* WXUNUSED(win
) )
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:
266 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CXSCREEN
);
268 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CYSCREEN
);
270 // TODO case wxSYS_FRAMESIZE_X:
271 // TODO case wxSYS_FRAMESIZE_Y:
272 // TODO case wxSYS_SMALLICON_X:
273 // TODO case wxSYS_SMALLICON_Y:
275 case wxSYS_HSCROLL_Y
:
276 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CYHSCROLL
);
277 case wxSYS_VSCROLL_X
:
278 return ::WinQuerySysValue(HWND_DESKTOP
,SV_CXVSCROLL
);
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:
293 return -1; // unsupported metric
296 bool wxSystemSettingsNative::HasFeature( wxSystemFeature index
)
300 case wxSYS_CAN_ICONIZE_FRAME
:
303 // TODO case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
304 // TODO case wxSYS_TABLET_PRESENT: