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