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