]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/settings.cpp
since DoScreenToClient and ClientToScreen in toplvlcmn are implemented by calling...
[wxWidgets.git] / src / mac / carbon / 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 return wxColor( 0xDD , 0xDD , 0xDD ) ;
48 break ;
49
50 case wxSYS_COLOUR_LISTBOX :
51 {
52 if (major >= 10)
53 return *wxWHITE ;
54 else
55 return wxColor( 0xEE , 0xEE , 0xEE ) ;
56 break ;
57 }
58 case wxSYS_COLOUR_BTNSHADOW:
59 return wxColor( 0x44 , 0x44 , 0x44 ) ;
60 break ;
61
62 case wxSYS_COLOUR_BTNTEXT:
63 case wxSYS_COLOUR_MENUTEXT:
64 case wxSYS_COLOUR_WINDOWTEXT:
65 case wxSYS_COLOUR_CAPTIONTEXT:
66 case wxSYS_COLOUR_INFOTEXT:
67 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
68 return *wxBLACK;
69 break ;
70 case wxSYS_COLOUR_HIGHLIGHT:
71 {
72 RGBColor hilite ;
73 LMGetHiliteRGB(&hilite) ;
74 return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
75 }
76 break ;
77 case wxSYS_COLOUR_BTNHIGHLIGHT:
78 case wxSYS_COLOUR_GRAYTEXT:
79 return wxColor( 0xCC , 0xCC , 0xCC ) ;
80 break ;
81
82 case wxSYS_COLOUR_3DDKSHADOW:
83 return wxColor( 0x44 , 0x44 , 0x44 ) ;
84 break ;
85 case wxSYS_COLOUR_3DLIGHT:
86 return wxColor( 0xCC , 0xCC , 0xCC ) ;
87 break ;
88 case wxSYS_COLOUR_HIGHLIGHTTEXT :
89 {
90 RGBColor hilite ;
91 LMGetHiliteRGB(&hilite) ;
92 if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
93 return *wxWHITE ;
94 else
95 return *wxBLACK ;
96 }
97 break ;
98 case wxSYS_COLOUR_INFOBK :
99 case wxSYS_COLOUR_APPWORKSPACE:
100 return *wxWHITE ;
101 break ;
102 }
103 return *wxWHITE;
104 }
105
106 // ----------------------------------------------------------------------------
107 // fonts
108 // ----------------------------------------------------------------------------
109
110 wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
111 {
112 switch (index)
113 {
114 case wxSYS_ANSI_VAR_FONT :
115 case wxSYS_SYSTEM_FONT :
116 case wxSYS_DEVICE_DEFAULT_FONT :
117 case wxSYS_DEFAULT_GUI_FONT :
118 {
119 return *wxSMALL_FONT ;
120 } ;
121 break ;
122 case wxSYS_OEM_FIXED_FONT :
123 case wxSYS_ANSI_FIXED_FONT :
124 case wxSYS_SYSTEM_FIXED_FONT :
125 default :
126 {
127 return *wxNORMAL_FONT ;
128 } ;
129 break ;
130
131 }
132 return *wxNORMAL_FONT;
133 }
134
135 // ----------------------------------------------------------------------------
136 // system metrics/features
137 // ----------------------------------------------------------------------------
138
139 // Get a system metric, e.g. scrollbar size
140 int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
141 {
142 switch ( index)
143 {
144 case wxSYS_MOUSE_BUTTONS:
145 return 2; // we emulate a two button mouse (ctrl + click = right button )
146 case wxSYS_BORDER_X:
147 // TODO
148 return 0;
149 case wxSYS_BORDER_Y:
150 // TODO
151 return 0;
152 case wxSYS_CURSOR_X:
153 // TODO
154 return 0;
155 case wxSYS_CURSOR_Y:
156 // TODO
157 return 0;
158 case wxSYS_DCLICK_X:
159 // TODO
160 return 0;
161 case wxSYS_DCLICK_Y:
162 // TODO
163 return 0;
164 case wxSYS_DRAG_X:
165 // TODO
166 return 0;
167 case wxSYS_DRAG_Y:
168 // TODO
169 return 0;
170 case wxSYS_EDGE_X:
171 // TODO
172 return 0;
173 case wxSYS_EDGE_Y:
174 // TODO
175 return 0;
176 case wxSYS_HSCROLL_ARROW_X:
177 return 16;
178 case wxSYS_HSCROLL_ARROW_Y:
179 return 16;
180 case wxSYS_HTHUMB_X:
181 return 16;
182 case wxSYS_ICON_X:
183 // TODO
184 return 0;
185 case wxSYS_ICON_Y:
186 // TODO
187 return 0;
188 case wxSYS_ICONSPACING_X:
189 // TODO
190 return 0;
191 case wxSYS_ICONSPACING_Y:
192 // TODO
193 return 0;
194 case wxSYS_WINDOWMIN_X:
195 // TODO
196 return 0;
197 case wxSYS_WINDOWMIN_Y:
198 // TODO
199 return 0;
200 case wxSYS_SCREEN_X:
201 // TODO
202 return 0;
203 case wxSYS_SCREEN_Y:
204 // TODO
205 return 0;
206 case wxSYS_FRAMESIZE_X:
207 // TODO
208 return 0;
209 case wxSYS_FRAMESIZE_Y:
210 // TODO
211 return 0;
212 case wxSYS_SMALLICON_X:
213 // TODO
214 return 0;
215 case wxSYS_SMALLICON_Y:
216 // TODO
217 return 0;
218 case wxSYS_HSCROLL_Y:
219 return 16;
220 case wxSYS_VSCROLL_X:
221 return 16;
222 case wxSYS_VSCROLL_ARROW_X:
223 return 16;
224 case wxSYS_VSCROLL_ARROW_Y:
225 return 16;
226 case wxSYS_VTHUMB_Y:
227 return 16;
228 case wxSYS_CAPTION_Y:
229 // TODO
230 return 0;
231 case wxSYS_MENU_Y:
232 // TODO
233 return 0;
234 case wxSYS_NETWORK_PRESENT:
235 // TODO
236 return 0;
237 case wxSYS_PENWINDOWS_PRESENT:
238 return 0;
239 case wxSYS_SHOW_SOUNDS:
240 // TODO
241 return 0;
242 case wxSYS_SWAP_BUTTONS:
243 return 0;
244 default:
245 return 0;
246 }
247 return 0;
248 }
249
250 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
251 {
252 switch (index)
253 {
254 case wxSYS_CAN_ICONIZE_FRAME:
255 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
256 return TRUE;
257
258 default:
259 return FALSE;
260 }
261 }