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