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"
18 #include "wx/gdicmn.h"
21 #include "wx/mac/uma.h"
23 // ----------------------------------------------------------------------------
24 // wxSystemSettingsNative
25 // ----------------------------------------------------------------------------
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 wxColour
wxSystemSettingsNative::GetColour(wxSystemColour index
)
35 ThemeBrush colorBrushID
;
37 wxGetOsVersion( &major
, &minor
);
41 case wxSYS_COLOUR_WINDOW
:
42 resultColor
= *wxWHITE
;
44 case wxSYS_COLOUR_SCROLLBAR
:
45 case wxSYS_COLOUR_BACKGROUND
:
46 case wxSYS_COLOUR_ACTIVECAPTION
:
47 case wxSYS_COLOUR_INACTIVECAPTION
:
48 case wxSYS_COLOUR_MENU
:
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
:
83 // NB: enable this case as desired
84 colorBrushID
= kThemeBrushAlternatePrimaryHighlightColor
;
86 colorBrushID
= kThemeBrushPrimaryHighlightColor
;
89 HIThemeBrushCreateCGColor( colorBrushID
, &color
);
90 resultColor
= wxColor( color
);
94 case wxSYS_COLOUR_BTNHIGHLIGHT
:
95 case wxSYS_COLOUR_GRAYTEXT
:
96 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
99 case wxSYS_COLOUR_3DDKSHADOW
:
100 resultColor
= wxColor( 0x44, 0x44, 0x44 );
103 case wxSYS_COLOUR_3DLIGHT
:
104 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
107 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
109 // NB: enable this case as desired
110 resultColor
= *wxWHITE
;
114 HIThemeBrushCreateCGColor( kThemeBrushPrimaryHighlightColor
, &color
);
115 wxColour
highlightcolor( color
);
116 if ((highlightcolor
.Red() + highlightcolor
.Green() + highlightcolor
.Blue() ) == 0)
117 resultColor
= *wxWHITE
;
119 resultColor
= *wxBLACK
;
124 case wxSYS_COLOUR_INFOBK
:
125 resultColor
= *wxWHITE
;
127 case wxSYS_COLOUR_APPWORKSPACE
:
128 resultColor
= wxColor( 0x80, 0x80, 0x80 ); ;
131 case wxSYS_COLOUR_HOTLIGHT
:
132 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
133 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
134 case wxSYS_COLOUR_MENUHILIGHT
:
136 resultColor
= *wxBLACK
;
139 // case wxSYS_COLOUR_MAX:
141 resultColor
= *wxWHITE
;
142 // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, _T("unknown system colour index") );
149 // ----------------------------------------------------------------------------
151 // ----------------------------------------------------------------------------
153 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
157 case wxSYS_ANSI_VAR_FONT
:
158 case wxSYS_SYSTEM_FONT
:
159 case wxSYS_DEVICE_DEFAULT_FONT
:
160 case wxSYS_DEFAULT_GUI_FONT
:
161 return *wxSMALL_FONT
;
168 return *wxNORMAL_FONT
;
171 // ----------------------------------------------------------------------------
172 // system metrics/features
173 // ----------------------------------------------------------------------------
175 // Get a system metric, e.g. scrollbar size
176 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
, wxWindow
* WXUNUSED(win
))
182 case wxSYS_MOUSE_BUTTONS
:
183 // we emulate a two button mouse (ctrl + click = right button)
186 // TODO case wxSYS_BORDER_X:
187 // TODO case wxSYS_BORDER_Y:
188 // TODO case wxSYS_CURSOR_X:
189 // TODO case wxSYS_CURSOR_Y:
190 // TODO case wxSYS_DCLICK_X:
191 // TODO case wxSYS_DCLICK_Y:
192 // TODO case wxSYS_DRAG_X:
193 // TODO case wxSYS_DRAG_Y:
194 // TODO case wxSYS_EDGE_X:
195 // TODO case wxSYS_EDGE_Y:
197 case wxSYS_HSCROLL_ARROW_X
:
198 case wxSYS_HSCROLL_ARROW_Y
:
202 // TODO case wxSYS_ICON_X:
203 // TODO case wxSYS_ICON_Y:
204 // TODO case wxSYS_ICONSPACING_X:
205 // TODO case wxSYS_ICONSPACING_Y:
206 // TODO case wxSYS_WINDOWMIN_X:
207 // TODO case wxSYS_WINDOWMIN_Y:
210 wxDisplaySize( &value
, NULL
);
214 wxDisplaySize( NULL
, &value
);
217 // TODO case wxSYS_FRAMESIZE_X:
218 // TODO case wxSYS_FRAMESIZE_Y:
219 // TODO case wxSYS_SMALLICON_X:
220 // TODO case wxSYS_SMALLICON_Y:
222 case wxSYS_HSCROLL_Y
:
223 case wxSYS_VSCROLL_X
:
224 case wxSYS_VSCROLL_ARROW_X
:
225 case wxSYS_VSCROLL_ARROW_Y
:
229 case wxSYS_PENWINDOWS_PRESENT
:
232 case wxSYS_SWAP_BUTTONS
:
235 // TODO: case wxSYS_CAPTION_Y:
236 // TODO: case wxSYS_MENU_Y:
237 // TODO: case wxSYS_NETWORK_PRESENT:
238 // TODO: case wxSYS_SHOW_SOUNDS:
240 case wxSYS_DCLICK_MSEC
:
242 // default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway
243 // but rather rely on the 'click-count' by the system delivered in a mouse event
246 return (int)(GetDblTime() * 1000. / 60.);
249 // unsupported metric
256 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
260 case wxSYS_CAN_ICONIZE_FRAME
:
261 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: