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