1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/settings.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/settings.h"
20 #include "wx/gdicmn.h"
22 #include "wx/mac/uma.h"
24 // ----------------------------------------------------------------------------
25 // wxSystemSettingsNative
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 wxColour
wxSystemSettingsNative::GetColour(wxSystemColour index
)
37 ThemeBrush colorBrushID
;
39 wxGetOsVersion( &major
, &minor
);
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
:
53 case wxSYS_COLOUR_MENUBAR
:
54 resultColor
= wxColor( 0xDD, 0xDD, 0xDD );
57 case wxSYS_COLOUR_LISTBOX
:
59 resultColor
= *wxWHITE
;
61 resultColor
= wxColor( 0xEE, 0xEE, 0xEE );
64 case wxSYS_COLOUR_BTNSHADOW
:
66 resultColor
= wxColor( 0xBE, 0xBE, 0xBE );
68 resultColor
= wxColor( 0x44, 0x44, 0x44 );
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
:
77 resultColor
= *wxBLACK
;
80 case wxSYS_COLOUR_HIGHLIGHT
:
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
;
86 colorBrushID
= kThemeBrushPrimaryHighlightColor
;
89 GetThemeBrushAsColor( colorBrushID
, 32, true, &macRGB
);
90 resultColor
= wxColor( macRGB
.red
>> 8, macRGB
.green
>> 8, macRGB
.blue
>> 8 );
93 case wxSYS_COLOUR_BTNHIGHLIGHT
:
94 case wxSYS_COLOUR_GRAYTEXT
:
95 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
98 case wxSYS_COLOUR_3DDKSHADOW
:
99 resultColor
= wxColor( 0x44, 0x44, 0x44 );
102 case wxSYS_COLOUR_3DLIGHT
:
103 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
106 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
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
;
111 GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor
, 32, true, &macRGB
);
112 if ((macRGB
.red
+ macRGB
.green
+ macRGB
.blue
) == 0)
113 resultColor
= *wxWHITE
;
115 resultColor
= *wxBLACK
;
119 case wxSYS_COLOUR_INFOBK
:
120 case wxSYS_COLOUR_APPWORKSPACE
:
121 resultColor
= *wxWHITE
;
124 case wxSYS_COLOUR_HOTLIGHT
:
125 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
126 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
127 case wxSYS_COLOUR_MENUHILIGHT
:
129 resultColor
= *wxBLACK
;
132 // case wxSYS_COLOUR_MAX:
134 resultColor
= *wxWHITE
;
135 // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, _T("unknown system colour index") );
142 // ----------------------------------------------------------------------------
144 // ----------------------------------------------------------------------------
146 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
150 case wxSYS_ANSI_VAR_FONT
:
151 case wxSYS_SYSTEM_FONT
:
152 case wxSYS_DEVICE_DEFAULT_FONT
:
153 case wxSYS_DEFAULT_GUI_FONT
:
154 return *wxSMALL_FONT
;
161 return *wxNORMAL_FONT
;
164 // ----------------------------------------------------------------------------
165 // system metrics/features
166 // ----------------------------------------------------------------------------
168 // Get a system metric, e.g. scrollbar size
169 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
, wxWindow
* WXUNUSED(win
))
175 case wxSYS_MOUSE_BUTTONS
:
176 // we emulate a two button mouse (ctrl + click = right button)
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:
190 case wxSYS_HSCROLL_ARROW_X
:
191 case wxSYS_HSCROLL_ARROW_Y
:
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:
203 wxDisplaySize( &value
, NULL
);
207 wxDisplaySize( NULL
, &value
);
210 // TODO case wxSYS_FRAMESIZE_X:
211 // TODO case wxSYS_FRAMESIZE_Y:
212 // TODO case wxSYS_SMALLICON_X:
213 // TODO case wxSYS_SMALLICON_Y:
215 case wxSYS_HSCROLL_Y
:
216 case wxSYS_VSCROLL_X
:
217 case wxSYS_VSCROLL_ARROW_X
:
218 case wxSYS_VSCROLL_ARROW_Y
:
222 case wxSYS_PENWINDOWS_PRESENT
:
225 case wxSYS_SWAP_BUTTONS
:
228 // TODO: case wxSYS_CAPTION_Y:
229 // TODO: case wxSYS_MENU_Y:
230 // TODO: case wxSYS_NETWORK_PRESENT:
231 // TODO: case wxSYS_SHOW_SOUNDS:
234 // unsupported metric
241 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
245 case wxSYS_CAN_ICONIZE_FRAME
:
246 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: