]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/settings.cpp
textctrl always needs ATSU...
[wxWidgets.git] / src / mac / carbon / settings.cpp
CommitLineData
e9576ca5 1/////////////////////////////////////////////////////////////////////////////
de6185e2 2// Name: src/mac/carbon/settings.cpp
e9576ca5 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
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878
SC
12#include "wx/wxprec.h"
13
e9576ca5 14#include "wx/settings.h"
de6185e2
WS
15
16#ifndef WX_PRECOMP
17 #include "wx/utils.h"
dd05139a 18 #include "wx/gdicmn.h"
de6185e2
WS
19#endif
20
76a5e5d2
SC
21#include "wx/mac/uma.h"
22
a174f139
GD
23// ----------------------------------------------------------------------------
24// wxSystemSettingsNative
25// ----------------------------------------------------------------------------
26
27// ----------------------------------------------------------------------------
28// colours
29// ----------------------------------------------------------------------------
30
31wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
e9576ca5 32{
76e36d43 33 wxColour resultColor;
76e36d43
DS
34 ThemeBrush colorBrushID;
35
76e36d43 36 switch ( index )
00500f40 37 {
26af4dbd
SC
38 case wxSYS_COLOUR_WINDOW:
39 resultColor = *wxWHITE ;
40 break ;
00500f40
RR
41 case wxSYS_COLOUR_SCROLLBAR :
42 case wxSYS_COLOUR_BACKGROUND:
43 case wxSYS_COLOUR_ACTIVECAPTION:
44 case wxSYS_COLOUR_INACTIVECAPTION:
45 case wxSYS_COLOUR_MENU:
00500f40
RR
46 case wxSYS_COLOUR_WINDOWFRAME:
47 case wxSYS_COLOUR_ACTIVEBORDER:
48 case wxSYS_COLOUR_INACTIVEBORDER:
49 case wxSYS_COLOUR_BTNFACE:
fc1f7cd5 50 case wxSYS_COLOUR_MENUBAR:
76e36d43 51 resultColor = wxColor( 0xDD, 0xDD, 0xDD );
00500f40 52 break ;
519cb848 53
00500f40 54 case wxSYS_COLOUR_LISTBOX :
a01d9a25 55 resultColor = *wxWHITE ;
00500f40 56 break ;
76e36d43 57
00500f40 58 case wxSYS_COLOUR_BTNSHADOW:
a01d9a25 59 resultColor = wxColor( 0xBE, 0xBE, 0xBE );
00500f40 60 break ;
519cb848 61
00500f40
RR
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:
76e36d43 68 resultColor = *wxBLACK;
00500f40 69 break ;
76e36d43 70
00500f40 71 case wxSYS_COLOUR_HIGHLIGHT:
276ee533 72 {
80f3f3be 73#if 0
76e36d43 74 // NB: enable this case as desired
276ee533 75 colorBrushID = kThemeBrushAlternatePrimaryHighlightColor;
76e36d43 76#else
276ee533 77 colorBrushID = kThemeBrushPrimaryHighlightColor;
76e36d43 78#endif
a01d9a25 79 resultColor = wxColor( wxMacCreateCGColorFromHITheme(colorBrushID) );
276ee533 80 }
00500f40 81 break ;
76e36d43 82
00500f40
RR
83 case wxSYS_COLOUR_BTNHIGHLIGHT:
84 case wxSYS_COLOUR_GRAYTEXT:
76e36d43 85 resultColor = wxColor( 0xCC, 0xCC, 0xCC );
00500f40 86 break ;
902725ee 87
00500f40 88 case wxSYS_COLOUR_3DDKSHADOW:
76e36d43 89 resultColor = wxColor( 0x44, 0x44, 0x44 );
00500f40 90 break ;
76e36d43 91
00500f40 92 case wxSYS_COLOUR_3DLIGHT:
76e36d43 93 resultColor = wxColor( 0xCC, 0xCC, 0xCC );
00500f40 94 break ;
76e36d43 95
00500f40 96 case wxSYS_COLOUR_HIGHLIGHTTEXT :
80f3f3be 97#if 0
76e36d43
DS
98 // NB: enable this case as desired
99 resultColor = *wxWHITE ;
100#else
276ee533 101 {
a01d9a25 102 wxColour highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor) );
276ee533
SC
103 if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0)
104 resultColor = *wxWHITE ;
105 else
106 resultColor = *wxBLACK ;
107 }
76e36d43 108#endif
00500f40 109 break ;
76e36d43 110
00500f40 111 case wxSYS_COLOUR_INFOBK :
76e36d43 112 resultColor = *wxWHITE ;
00500f40 113 break ;
26af4dbd
SC
114 case wxSYS_COLOUR_APPWORKSPACE:
115 resultColor = wxColor( 0x80, 0x80, 0x80 ); ;
116 break ;
fc1f7cd5
GD
117
118 case wxSYS_COLOUR_HOTLIGHT:
119 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
120 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
121 case wxSYS_COLOUR_MENUHILIGHT:
76e36d43
DS
122 // TODO:
123 resultColor = *wxBLACK;
124 break ;
902725ee 125
76e36d43
DS
126 // case wxSYS_COLOUR_MAX:
127 default:
128 resultColor = *wxWHITE;
129 // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, _T("unknown system colour index") );
fc1f7cd5 130 break ;
00500f40 131 }
76e36d43
DS
132
133 return resultColor;
e9576ca5
SC
134}
135
a174f139
GD
136// ----------------------------------------------------------------------------
137// fonts
138// ----------------------------------------------------------------------------
139
140wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
e9576ca5 141{
e9576ca5
SC
142 switch (index)
143 {
519cb848
SC
144 case wxSYS_ANSI_VAR_FONT :
145 case wxSYS_SYSTEM_FONT :
146 case wxSYS_DEVICE_DEFAULT_FONT :
147 case wxSYS_DEFAULT_GUI_FONT :
76e36d43 148 return *wxSMALL_FONT ;
00500f40 149 break ;
902725ee 150
519cb848 151 default :
00500f40 152 break ;
e9576ca5 153 }
76e36d43 154
519cb848 155 return *wxNORMAL_FONT;
e9576ca5
SC
156}
157
a174f139
GD
158// ----------------------------------------------------------------------------
159// system metrics/features
160// ----------------------------------------------------------------------------
161
e9576ca5 162// Get a system metric, e.g. scrollbar size
9b0b5ba7 163int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
e9576ca5 164{
e8ca7105
GD
165 int value;
166
76e36d43 167 switch ( index )
00500f40 168 {
e9576ca5 169 case wxSYS_MOUSE_BUTTONS:
76e36d43 170 // we emulate a two button mouse (ctrl + click = right button)
e8ca7105 171 return 2;
902725ee 172
1d451c5b
RD
173 // TODO case wxSYS_BORDER_X:
174 // TODO case wxSYS_BORDER_Y:
175 // TODO case wxSYS_CURSOR_X:
176 // TODO case wxSYS_CURSOR_Y:
177 // TODO case wxSYS_DCLICK_X:
178 // TODO case wxSYS_DCLICK_Y:
179 // TODO case wxSYS_DRAG_X:
180 // TODO case wxSYS_DRAG_Y:
181 // TODO case wxSYS_EDGE_X:
182 // TODO case wxSYS_EDGE_Y:
902725ee 183
e9576ca5 184 case wxSYS_HSCROLL_ARROW_X:
e9576ca5 185 case wxSYS_HSCROLL_ARROW_Y:
e9576ca5 186 case wxSYS_HTHUMB_X:
a174f139 187 return 16;
902725ee 188
1d451c5b
RD
189 // TODO case wxSYS_ICON_X:
190 // TODO case wxSYS_ICON_Y:
191 // TODO case wxSYS_ICONSPACING_X:
192 // TODO case wxSYS_ICONSPACING_Y:
193 // TODO case wxSYS_WINDOWMIN_X:
194 // TODO case wxSYS_WINDOWMIN_Y:
195
e9576ca5 196 case wxSYS_SCREEN_X:
76e36d43 197 wxDisplaySize( &value, NULL );
e8ca7105 198 return value;
76e36d43 199
e9576ca5 200 case wxSYS_SCREEN_Y:
76e36d43 201 wxDisplaySize( NULL, &value );
e8ca7105 202 return value;
902725ee 203
1d451c5b
RD
204 // TODO case wxSYS_FRAMESIZE_X:
205 // TODO case wxSYS_FRAMESIZE_Y:
206 // TODO case wxSYS_SMALLICON_X:
207 // TODO case wxSYS_SMALLICON_Y:
902725ee 208
e9576ca5 209 case wxSYS_HSCROLL_Y:
e9576ca5 210 case wxSYS_VSCROLL_X:
e9576ca5 211 case wxSYS_VSCROLL_ARROW_X:
e9576ca5 212 case wxSYS_VSCROLL_ARROW_Y:
e9576ca5 213 case wxSYS_VTHUMB_Y:
a174f139 214 return 16;
902725ee 215
e9576ca5 216 case wxSYS_PENWINDOWS_PRESENT:
a174f139 217 return 0;
902725ee 218
e9576ca5 219 case wxSYS_SWAP_BUTTONS:
a174f139 220 return 0;
1d451c5b 221
76e36d43
DS
222 // TODO: case wxSYS_CAPTION_Y:
223 // TODO: case wxSYS_MENU_Y:
224 // TODO: case wxSYS_NETWORK_PRESENT:
225 // TODO: case wxSYS_SHOW_SOUNDS:
226
9cd80843 227 case wxSYS_DCLICK_MSEC:
276ee533
SC
228#ifdef __LP64__
229 // default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway
230 // but rather rely on the 'click-count' by the system delivered in a mouse event
231 return 500;
232#else
9cd80843 233 return (int)(GetDblTime() * 1000. / 60.);
276ee533 234#endif
a174f139 235 default:
76e36d43
DS
236 // unsupported metric
237 break;
00500f40 238 }
76e36d43 239
902725ee 240 return -1;
e9576ca5
SC
241}
242
a174f139 243bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
244{
245 switch (index)
246 {
902725ee 247 case wxSYS_CAN_ICONIZE_FRAME:
253293c1 248 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
902725ee
WS
249 return true;
250
253293c1 251 default:
902725ee 252 return false;
253293c1
VS
253 }
254}