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