]> git.saurik.com Git - wxWidgets.git/blame - src/mac/settings.cpp
don't crash in UnselectAll() if the tree has no root
[wxWidgets.git] / src / mac / settings.cpp
CommitLineData
e9576ca5
SC
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
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
a174f139
GD
20// ----------------------------------------------------------------------------
21// wxSystemSettingsNative
22// ----------------------------------------------------------------------------
23
24// ----------------------------------------------------------------------------
25// colours
26// ----------------------------------------------------------------------------
27
28wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
e9576ca5 29{
00500f40
RR
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 ;
519cb848 47
00500f40
RR
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 ;
519cb848 59
00500f40
RR
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;
e9576ca5
SC
102}
103
a174f139
GD
104// ----------------------------------------------------------------------------
105// fonts
106// ----------------------------------------------------------------------------
107
108wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
e9576ca5 109{
e9576ca5
SC
110 switch (index)
111 {
519cb848
SC
112 case wxSYS_ANSI_VAR_FONT :
113 case wxSYS_SYSTEM_FONT :
114 case wxSYS_DEVICE_DEFAULT_FONT :
115 case wxSYS_DEFAULT_GUI_FONT :
00500f40
RR
116 {
117 return *wxSMALL_FONT ;
118 } ;
119 break ;
519cb848
SC
120 case wxSYS_OEM_FIXED_FONT :
121 case wxSYS_ANSI_FIXED_FONT :
122 case wxSYS_SYSTEM_FIXED_FONT :
123 default :
00500f40
RR
124 {
125 return *wxNORMAL_FONT ;
126 } ;
127 break ;
128
e9576ca5 129 }
519cb848 130 return *wxNORMAL_FONT;
e9576ca5
SC
131}
132
a174f139
GD
133// ----------------------------------------------------------------------------
134// system metrics/features
135// ----------------------------------------------------------------------------
136
e9576ca5 137// Get a system metric, e.g. scrollbar size
a174f139 138int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
e9576ca5 139{
00500f40
RR
140 switch ( index)
141 {
e9576ca5 142 case wxSYS_MOUSE_BUTTONS:
00500f40 143 return 2; // we emulate a two button mouse (ctrl + click = right button )
e9576ca5
SC
144 case wxSYS_BORDER_X:
145 // TODO
00500f40 146 return 0;
e9576ca5
SC
147 case wxSYS_BORDER_Y:
148 // TODO
00500f40 149 return 0;
e9576ca5
SC
150 case wxSYS_CURSOR_X:
151 // TODO
00500f40 152 return 0;
e9576ca5
SC
153 case wxSYS_CURSOR_Y:
154 // TODO
00500f40 155 return 0;
e9576ca5
SC
156 case wxSYS_DCLICK_X:
157 // TODO
00500f40 158 return 0;
e9576ca5
SC
159 case wxSYS_DCLICK_Y:
160 // TODO
00500f40 161 return 0;
e9576ca5
SC
162 case wxSYS_DRAG_X:
163 // TODO
00500f40 164 return 0;
e9576ca5
SC
165 case wxSYS_DRAG_Y:
166 // TODO
00500f40 167 return 0;
e9576ca5
SC
168 case wxSYS_EDGE_X:
169 // TODO
00500f40 170 return 0;
e9576ca5
SC
171 case wxSYS_EDGE_Y:
172 // TODO
00500f40 173 return 0;
e9576ca5 174 case wxSYS_HSCROLL_ARROW_X:
a174f139 175 return 16;
e9576ca5 176 case wxSYS_HSCROLL_ARROW_Y:
a174f139 177 return 16;
e9576ca5 178 case wxSYS_HTHUMB_X:
a174f139 179 return 16;
e9576ca5
SC
180 case wxSYS_ICON_X:
181 // TODO
00500f40 182 return 0;
e9576ca5
SC
183 case wxSYS_ICON_Y:
184 // TODO
00500f40 185 return 0;
e9576ca5
SC
186 case wxSYS_ICONSPACING_X:
187 // TODO
00500f40 188 return 0;
e9576ca5
SC
189 case wxSYS_ICONSPACING_Y:
190 // TODO
00500f40 191 return 0;
e9576ca5
SC
192 case wxSYS_WINDOWMIN_X:
193 // TODO
00500f40 194 return 0;
e9576ca5
SC
195 case wxSYS_WINDOWMIN_Y:
196 // TODO
00500f40 197 return 0;
e9576ca5
SC
198 case wxSYS_SCREEN_X:
199 // TODO
00500f40 200 return 0;
e9576ca5
SC
201 case wxSYS_SCREEN_Y:
202 // TODO
00500f40 203 return 0;
e9576ca5
SC
204 case wxSYS_FRAMESIZE_X:
205 // TODO
00500f40 206 return 0;
e9576ca5
SC
207 case wxSYS_FRAMESIZE_Y:
208 // TODO
00500f40 209 return 0;
e9576ca5
SC
210 case wxSYS_SMALLICON_X:
211 // TODO
00500f40 212 return 0;
e9576ca5
SC
213 case wxSYS_SMALLICON_Y:
214 // TODO
00500f40 215 return 0;
e9576ca5 216 case wxSYS_HSCROLL_Y:
a174f139 217 return 16;
e9576ca5 218 case wxSYS_VSCROLL_X:
a174f139 219 return 16;
e9576ca5 220 case wxSYS_VSCROLL_ARROW_X:
a174f139 221 return 16;
e9576ca5 222 case wxSYS_VSCROLL_ARROW_Y:
a174f139 223 return 16;
e9576ca5 224 case wxSYS_VTHUMB_Y:
a174f139 225 return 16;
e9576ca5
SC
226 case wxSYS_CAPTION_Y:
227 // TODO
a174f139 228 return 0;
e9576ca5
SC
229 case wxSYS_MENU_Y:
230 // TODO
a174f139 231 return 0;
e9576ca5
SC
232 case wxSYS_NETWORK_PRESENT:
233 // TODO
a174f139 234 return 0;
e9576ca5 235 case wxSYS_PENWINDOWS_PRESENT:
a174f139 236 return 0;
e9576ca5
SC
237 case wxSYS_SHOW_SOUNDS:
238 // TODO
00500f40 239 return 0;
e9576ca5 240 case wxSYS_SWAP_BUTTONS:
a174f139
GD
241 return 0;
242 default:
243 return 0;
00500f40
RR
244 }
245 return 0;
e9576ca5
SC
246}
247
a174f139 248bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
249{
250 switch (index)
251 {
252 case wxSYS_CAN_ICONIZE_FRAME:
253 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
a174f139
GD
254 return TRUE;
255
253293c1
VS
256 default:
257 return FALSE;
258 }
259}