]> git.saurik.com Git - wxWidgets.git/blame - src/mac/settings.cpp
Implement GetValue() and SetValue() and send an event when clicked
[wxWidgets.git] / src / mac / settings.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: settings.cpp
3// Purpose: wxSettings
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
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{
e8ca7105
GD
154 int value;
155
00500f40
RR
156 switch ( index)
157 {
e9576ca5 158 case wxSYS_MOUSE_BUTTONS:
e8ca7105
GD
159 // we emulate a two button mouse (ctrl + click = right button )
160 return 2;
e9576ca5
SC
161 case wxSYS_BORDER_X:
162 // TODO
e8ca7105 163 return 0;
e9576ca5
SC
164 case wxSYS_BORDER_Y:
165 // TODO
00500f40 166 return 0;
e9576ca5
SC
167 case wxSYS_CURSOR_X:
168 // TODO
00500f40 169 return 0;
e9576ca5
SC
170 case wxSYS_CURSOR_Y:
171 // TODO
00500f40 172 return 0;
e9576ca5
SC
173 case wxSYS_DCLICK_X:
174 // TODO
00500f40 175 return 0;
e9576ca5
SC
176 case wxSYS_DCLICK_Y:
177 // TODO
00500f40 178 return 0;
e9576ca5
SC
179 case wxSYS_DRAG_X:
180 // TODO
00500f40 181 return 0;
e9576ca5
SC
182 case wxSYS_DRAG_Y:
183 // TODO
00500f40 184 return 0;
e9576ca5
SC
185 case wxSYS_EDGE_X:
186 // TODO
00500f40 187 return 0;
e9576ca5
SC
188 case wxSYS_EDGE_Y:
189 // TODO
00500f40 190 return 0;
e9576ca5 191 case wxSYS_HSCROLL_ARROW_X:
a174f139 192 return 16;
e9576ca5 193 case wxSYS_HSCROLL_ARROW_Y:
a174f139 194 return 16;
e9576ca5 195 case wxSYS_HTHUMB_X:
a174f139 196 return 16;
e9576ca5
SC
197 case wxSYS_ICON_X:
198 // TODO
00500f40 199 return 0;
e9576ca5
SC
200 case wxSYS_ICON_Y:
201 // TODO
00500f40 202 return 0;
e9576ca5
SC
203 case wxSYS_ICONSPACING_X:
204 // TODO
00500f40 205 return 0;
e9576ca5
SC
206 case wxSYS_ICONSPACING_Y:
207 // TODO
00500f40 208 return 0;
e9576ca5
SC
209 case wxSYS_WINDOWMIN_X:
210 // TODO
00500f40 211 return 0;
e9576ca5
SC
212 case wxSYS_WINDOWMIN_Y:
213 // TODO
00500f40 214 return 0;
e9576ca5 215 case wxSYS_SCREEN_X:
e8ca7105
GD
216 wxDisplaySize(&value, NULL);
217 return value;
e9576ca5 218 case wxSYS_SCREEN_Y:
e8ca7105
GD
219 wxDisplaySize(NULL, &value);
220 return value;
e9576ca5
SC
221 case wxSYS_FRAMESIZE_X:
222 // TODO
00500f40 223 return 0;
e9576ca5
SC
224 case wxSYS_FRAMESIZE_Y:
225 // TODO
00500f40 226 return 0;
e9576ca5
SC
227 case wxSYS_SMALLICON_X:
228 // TODO
00500f40 229 return 0;
e9576ca5
SC
230 case wxSYS_SMALLICON_Y:
231 // TODO
00500f40 232 return 0;
e9576ca5 233 case wxSYS_HSCROLL_Y:
a174f139 234 return 16;
e9576ca5 235 case wxSYS_VSCROLL_X:
a174f139 236 return 16;
e9576ca5 237 case wxSYS_VSCROLL_ARROW_X:
a174f139 238 return 16;
e9576ca5 239 case wxSYS_VSCROLL_ARROW_Y:
a174f139 240 return 16;
e9576ca5 241 case wxSYS_VTHUMB_Y:
a174f139 242 return 16;
e9576ca5
SC
243 case wxSYS_CAPTION_Y:
244 // TODO
a174f139 245 return 0;
e9576ca5
SC
246 case wxSYS_MENU_Y:
247 // TODO
a174f139 248 return 0;
e9576ca5
SC
249 case wxSYS_NETWORK_PRESENT:
250 // TODO
a174f139 251 return 0;
e9576ca5 252 case wxSYS_PENWINDOWS_PRESENT:
a174f139 253 return 0;
e9576ca5
SC
254 case wxSYS_SHOW_SOUNDS:
255 // TODO
00500f40 256 return 0;
e9576ca5 257 case wxSYS_SWAP_BUTTONS:
a174f139
GD
258 return 0;
259 default:
260 return 0;
00500f40
RR
261 }
262 return 0;
e9576ca5
SC
263}
264
a174f139 265bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
266{
267 switch (index)
268 {
269 case wxSYS_CAN_ICONIZE_FRAME:
270 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
a174f139
GD
271 return TRUE;
272
253293c1
VS
273 default:
274 return FALSE;
275 }
276}