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