]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: settings.cpp | |
3 | // Purpose: wxSettings | |
a31a5f85 | 4 | // Author: Stefan Csomor |
e9576ca5 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
e9576ca5 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
00500f40 | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "settings.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/settings.h" | |
03e11df5 | 17 | #include "wx/gdicmn.h" |
00500f40 | 18 | #include "wx/utils.h" |
e9576ca5 | 19 | |
76a5e5d2 SC |
20 | #include "wx/mac/uma.h" |
21 | ||
a174f139 GD |
22 | // ---------------------------------------------------------------------------- |
23 | // wxSystemSettingsNative | |
24 | // ---------------------------------------------------------------------------- | |
25 | ||
26 | // ---------------------------------------------------------------------------- | |
27 | // colours | |
28 | // ---------------------------------------------------------------------------- | |
29 | ||
30 | wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) | |
e9576ca5 | 31 | { |
00500f40 RR |
32 | int major,minor; |
33 | wxGetOsVersion( &major, &minor ); | |
34 | ||
35 | switch( index ) | |
36 | { | |
37 | case wxSYS_COLOUR_SCROLLBAR : | |
38 | case wxSYS_COLOUR_BACKGROUND: | |
39 | case wxSYS_COLOUR_ACTIVECAPTION: | |
40 | case wxSYS_COLOUR_INACTIVECAPTION: | |
41 | case wxSYS_COLOUR_MENU: | |
42 | case wxSYS_COLOUR_WINDOW: | |
43 | case wxSYS_COLOUR_WINDOWFRAME: | |
44 | case wxSYS_COLOUR_ACTIVEBORDER: | |
45 | case wxSYS_COLOUR_INACTIVEBORDER: | |
46 | case wxSYS_COLOUR_BTNFACE: | |
fc1f7cd5 | 47 | case wxSYS_COLOUR_MENUBAR: |
00500f40 RR |
48 | return wxColor( 0xDD , 0xDD , 0xDD ) ; |
49 | break ; | |
519cb848 | 50 | |
00500f40 RR |
51 | case wxSYS_COLOUR_LISTBOX : |
52 | { | |
53 | if (major >= 10) | |
54 | return *wxWHITE ; | |
55 | else | |
56 | return wxColor( 0xEE , 0xEE , 0xEE ) ; | |
57 | break ; | |
58 | } | |
59 | case wxSYS_COLOUR_BTNSHADOW: | |
11d1adbf SC |
60 | if (major >= 10) |
61 | return wxColor( 0xBE , 0xBE , 0xBE ) ; | |
62 | else | |
63 | return wxColor( 0x44 , 0x44 , 0x44 ) ; | |
00500f40 | 64 | break ; |
519cb848 | 65 | |
00500f40 RR |
66 | case wxSYS_COLOUR_BTNTEXT: |
67 | case wxSYS_COLOUR_MENUTEXT: | |
68 | case wxSYS_COLOUR_WINDOWTEXT: | |
69 | case wxSYS_COLOUR_CAPTIONTEXT: | |
70 | case wxSYS_COLOUR_INFOTEXT: | |
71 | case wxSYS_COLOUR_INACTIVECAPTIONTEXT: | |
72 | return *wxBLACK; | |
73 | break ; | |
74 | case wxSYS_COLOUR_HIGHLIGHT: | |
75 | { | |
76 | RGBColor hilite ; | |
77 | LMGetHiliteRGB(&hilite) ; | |
78 | return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; | |
79 | } | |
80 | break ; | |
81 | case wxSYS_COLOUR_BTNHIGHLIGHT: | |
82 | case wxSYS_COLOUR_GRAYTEXT: | |
83 | return wxColor( 0xCC , 0xCC , 0xCC ) ; | |
84 | break ; | |
85 | ||
86 | case wxSYS_COLOUR_3DDKSHADOW: | |
87 | return wxColor( 0x44 , 0x44 , 0x44 ) ; | |
88 | break ; | |
89 | case wxSYS_COLOUR_3DLIGHT: | |
90 | return wxColor( 0xCC , 0xCC , 0xCC ) ; | |
91 | break ; | |
92 | case wxSYS_COLOUR_HIGHLIGHTTEXT : | |
93 | { | |
94 | RGBColor hilite ; | |
95 | LMGetHiliteRGB(&hilite) ; | |
96 | if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) | |
97 | return *wxWHITE ; | |
98 | else | |
99 | return *wxBLACK ; | |
100 | } | |
101 | break ; | |
102 | case wxSYS_COLOUR_INFOBK : | |
103 | case wxSYS_COLOUR_APPWORKSPACE: | |
104 | return *wxWHITE ; | |
105 | break ; | |
fc1f7cd5 GD |
106 | |
107 | case wxSYS_COLOUR_HOTLIGHT: | |
108 | case wxSYS_COLOUR_GRADIENTACTIVECAPTION: | |
109 | case wxSYS_COLOUR_GRADIENTINACTIVECAPTION: | |
110 | case wxSYS_COLOUR_MENUHILIGHT: | |
111 | // TODO | |
112 | return *wxBLACK; | |
113 | ||
114 | case wxSYS_COLOUR_MAX: | |
115 | wxFAIL_MSG( _T("unknown system colour index") ); | |
116 | break ; | |
00500f40 RR |
117 | } |
118 | return *wxWHITE; | |
e9576ca5 SC |
119 | } |
120 | ||
a174f139 GD |
121 | // ---------------------------------------------------------------------------- |
122 | // fonts | |
123 | // ---------------------------------------------------------------------------- | |
124 | ||
125 | wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) | |
e9576ca5 | 126 | { |
e9576ca5 SC |
127 | switch (index) |
128 | { | |
519cb848 SC |
129 | case wxSYS_ANSI_VAR_FONT : |
130 | case wxSYS_SYSTEM_FONT : | |
131 | case wxSYS_DEVICE_DEFAULT_FONT : | |
132 | case wxSYS_DEFAULT_GUI_FONT : | |
00500f40 RR |
133 | { |
134 | return *wxSMALL_FONT ; | |
135 | } ; | |
136 | break ; | |
519cb848 SC |
137 | case wxSYS_OEM_FIXED_FONT : |
138 | case wxSYS_ANSI_FIXED_FONT : | |
139 | case wxSYS_SYSTEM_FIXED_FONT : | |
140 | default : | |
00500f40 RR |
141 | { |
142 | return *wxNORMAL_FONT ; | |
143 | } ; | |
144 | break ; | |
145 | ||
e9576ca5 | 146 | } |
519cb848 | 147 | return *wxNORMAL_FONT; |
e9576ca5 SC |
148 | } |
149 | ||
a174f139 GD |
150 | // ---------------------------------------------------------------------------- |
151 | // system metrics/features | |
152 | // ---------------------------------------------------------------------------- | |
153 | ||
e9576ca5 | 154 | // Get a system metric, e.g. scrollbar size |
a174f139 | 155 | int wxSystemSettingsNative::GetMetric(wxSystemMetric index) |
e9576ca5 | 156 | { |
e8ca7105 GD |
157 | int value; |
158 | ||
00500f40 RR |
159 | switch ( index) |
160 | { | |
e9576ca5 | 161 | case wxSYS_MOUSE_BUTTONS: |
e8ca7105 GD |
162 | // we emulate a two button mouse (ctrl + click = right button ) |
163 | return 2; | |
e9576ca5 SC |
164 | case wxSYS_BORDER_X: |
165 | // TODO | |
e8ca7105 | 166 | return 0; |
e9576ca5 SC |
167 | case wxSYS_BORDER_Y: |
168 | // TODO | |
00500f40 | 169 | return 0; |
e9576ca5 SC |
170 | case wxSYS_CURSOR_X: |
171 | // TODO | |
00500f40 | 172 | return 0; |
e9576ca5 SC |
173 | case wxSYS_CURSOR_Y: |
174 | // TODO | |
00500f40 | 175 | return 0; |
e9576ca5 SC |
176 | case wxSYS_DCLICK_X: |
177 | // TODO | |
00500f40 | 178 | return 0; |
e9576ca5 SC |
179 | case wxSYS_DCLICK_Y: |
180 | // TODO | |
00500f40 | 181 | return 0; |
e9576ca5 SC |
182 | case wxSYS_DRAG_X: |
183 | // TODO | |
00500f40 | 184 | return 0; |
e9576ca5 SC |
185 | case wxSYS_DRAG_Y: |
186 | // TODO | |
00500f40 | 187 | return 0; |
e9576ca5 SC |
188 | case wxSYS_EDGE_X: |
189 | // TODO | |
00500f40 | 190 | return 0; |
e9576ca5 SC |
191 | case wxSYS_EDGE_Y: |
192 | // TODO | |
00500f40 | 193 | return 0; |
e9576ca5 | 194 | case wxSYS_HSCROLL_ARROW_X: |
a174f139 | 195 | return 16; |
e9576ca5 | 196 | case wxSYS_HSCROLL_ARROW_Y: |
a174f139 | 197 | return 16; |
e9576ca5 | 198 | case wxSYS_HTHUMB_X: |
a174f139 | 199 | return 16; |
e9576ca5 SC |
200 | case wxSYS_ICON_X: |
201 | // TODO | |
00500f40 | 202 | return 0; |
e9576ca5 SC |
203 | case wxSYS_ICON_Y: |
204 | // TODO | |
00500f40 | 205 | return 0; |
e9576ca5 SC |
206 | case wxSYS_ICONSPACING_X: |
207 | // TODO | |
00500f40 | 208 | return 0; |
e9576ca5 SC |
209 | case wxSYS_ICONSPACING_Y: |
210 | // TODO | |
00500f40 | 211 | return 0; |
e9576ca5 SC |
212 | case wxSYS_WINDOWMIN_X: |
213 | // TODO | |
00500f40 | 214 | return 0; |
e9576ca5 SC |
215 | case wxSYS_WINDOWMIN_Y: |
216 | // TODO | |
00500f40 | 217 | return 0; |
e9576ca5 | 218 | case wxSYS_SCREEN_X: |
e8ca7105 GD |
219 | wxDisplaySize(&value, NULL); |
220 | return value; | |
e9576ca5 | 221 | case wxSYS_SCREEN_Y: |
e8ca7105 GD |
222 | wxDisplaySize(NULL, &value); |
223 | return value; | |
e9576ca5 SC |
224 | case wxSYS_FRAMESIZE_X: |
225 | // TODO | |
00500f40 | 226 | return 0; |
e9576ca5 SC |
227 | case wxSYS_FRAMESIZE_Y: |
228 | // TODO | |
00500f40 | 229 | return 0; |
e9576ca5 SC |
230 | case wxSYS_SMALLICON_X: |
231 | // TODO | |
00500f40 | 232 | return 0; |
e9576ca5 SC |
233 | case wxSYS_SMALLICON_Y: |
234 | // TODO | |
00500f40 | 235 | return 0; |
e9576ca5 | 236 | case wxSYS_HSCROLL_Y: |
a174f139 | 237 | return 16; |
e9576ca5 | 238 | case wxSYS_VSCROLL_X: |
a174f139 | 239 | return 16; |
e9576ca5 | 240 | case wxSYS_VSCROLL_ARROW_X: |
a174f139 | 241 | return 16; |
e9576ca5 | 242 | case wxSYS_VSCROLL_ARROW_Y: |
a174f139 | 243 | return 16; |
e9576ca5 | 244 | case wxSYS_VTHUMB_Y: |
a174f139 | 245 | return 16; |
e9576ca5 SC |
246 | case wxSYS_CAPTION_Y: |
247 | // TODO | |
a174f139 | 248 | return 0; |
e9576ca5 SC |
249 | case wxSYS_MENU_Y: |
250 | // TODO | |
a174f139 | 251 | return 0; |
e9576ca5 SC |
252 | case wxSYS_NETWORK_PRESENT: |
253 | // TODO | |
a174f139 | 254 | return 0; |
e9576ca5 | 255 | case wxSYS_PENWINDOWS_PRESENT: |
a174f139 | 256 | return 0; |
e9576ca5 SC |
257 | case wxSYS_SHOW_SOUNDS: |
258 | // TODO | |
00500f40 | 259 | return 0; |
e9576ca5 | 260 | case wxSYS_SWAP_BUTTONS: |
a174f139 GD |
261 | return 0; |
262 | default: | |
263 | return 0; | |
00500f40 RR |
264 | } |
265 | return 0; | |
e9576ca5 SC |
266 | } |
267 | ||
a174f139 | 268 | bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) |
253293c1 VS |
269 | { |
270 | switch (index) | |
271 | { | |
272 | case wxSYS_CAN_ICONIZE_FRAME: | |
273 | case wxSYS_CAN_DRAW_FRAME_DECORATIONS: | |
a174f139 GD |
274 | return TRUE; |
275 | ||
253293c1 VS |
276 | default: |
277 | return FALSE; | |
278 | } | |
279 | } |