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
)
34 ThemeBrush colorBrushID
;
38 case wxSYS_COLOUR_WINDOW
:
39 resultColor
= *wxWHITE
;
41 case wxSYS_COLOUR_SCROLLBAR
:
42 case wxSYS_COLOUR_BACKGROUND
:
43 case wxSYS_COLOUR_ACTIVECAPTION
:
44 case wxSYS_COLOUR_INACTIVECAPTION
:
45 case wxSYS_COLOUR_MENU
:
46 case wxSYS_COLOUR_WINDOWFRAME
:
47 case wxSYS_COLOUR_ACTIVEBORDER
:
48 case wxSYS_COLOUR_INACTIVEBORDER
:
49 case wxSYS_COLOUR_BTNFACE
:
50 case wxSYS_COLOUR_MENUBAR
:
51 resultColor
= wxColor( 0xDD, 0xDD, 0xDD );
54 case wxSYS_COLOUR_LISTBOX
:
55 resultColor
= *wxWHITE
;
58 case wxSYS_COLOUR_BTNSHADOW
:
59 resultColor
= wxColor( 0xBE, 0xBE, 0xBE );
62 case wxSYS_COLOUR_BTNTEXT
:
63 case wxSYS_COLOUR_MENUTEXT
:
64 case wxSYS_COLOUR_WINDOWTEXT
:
65 case wxSYS_COLOUR_CAPTIONTEXT
:
66 case wxSYS_COLOUR_INFOTEXT
:
67 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
68 resultColor
= *wxBLACK
;
71 case wxSYS_COLOUR_HIGHLIGHT
:
74 // NB: enable this case as desired
75 colorBrushID
= kThemeBrushAlternatePrimaryHighlightColor
;
77 colorBrushID
= kThemeBrushPrimaryHighlightColor
;
79 resultColor
= wxColor( wxMacCreateCGColorFromHITheme(colorBrushID
) );
83 case wxSYS_COLOUR_BTNHIGHLIGHT
:
84 case wxSYS_COLOUR_GRAYTEXT
:
85 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
88 case wxSYS_COLOUR_3DDKSHADOW
:
89 resultColor
= wxColor( 0x44, 0x44, 0x44 );
92 case wxSYS_COLOUR_3DLIGHT
:
93 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
96 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
98 // NB: enable this case as desired
99 resultColor
= *wxWHITE
;
102 wxColour
highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor
) );
103 if ((highlightcolor
.Red() + highlightcolor
.Green() + highlightcolor
.Blue() ) == 0)
104 resultColor
= *wxWHITE
;
106 resultColor
= *wxBLACK
;
111 case wxSYS_COLOUR_INFOBK
:
112 // we don't have a way to detect tooltip color, so use the
113 // standard value used at least on 10.4:
114 resultColor
= wxColour( 0xFF, 0xFF, 0xD3 ) ;
116 case wxSYS_COLOUR_APPWORKSPACE
:
117 resultColor
= wxColor( 0x80, 0x80, 0x80 ); ;
120 case wxSYS_COLOUR_HOTLIGHT
:
121 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
122 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
123 case wxSYS_COLOUR_MENUHILIGHT
:
125 resultColor
= *wxBLACK
;
128 // case wxSYS_COLOUR_MAX:
130 resultColor
= *wxWHITE
;
131 // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, _T("unknown system colour index") );
138 // ----------------------------------------------------------------------------
140 // ----------------------------------------------------------------------------
142 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
146 case wxSYS_ANSI_VAR_FONT
:
147 case wxSYS_SYSTEM_FONT
:
148 case wxSYS_DEVICE_DEFAULT_FONT
:
149 case wxSYS_DEFAULT_GUI_FONT
:
150 return *wxSMALL_FONT
;
157 return *wxNORMAL_FONT
;
160 // ----------------------------------------------------------------------------
161 // system metrics/features
162 // ----------------------------------------------------------------------------
164 // Get a system metric, e.g. scrollbar size
165 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
, wxWindow
* WXUNUSED(win
))
171 case wxSYS_MOUSE_BUTTONS
:
172 // we emulate a two button mouse (ctrl + click = right button)
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:
186 case wxSYS_HSCROLL_ARROW_X
:
187 case wxSYS_HSCROLL_ARROW_Y
:
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:
199 wxDisplaySize( &value
, NULL
);
203 wxDisplaySize( NULL
, &value
);
206 // TODO case wxSYS_FRAMESIZE_X:
207 // TODO case wxSYS_FRAMESIZE_Y:
208 // TODO case wxSYS_SMALLICON_X:
209 // TODO case wxSYS_SMALLICON_Y:
211 case wxSYS_HSCROLL_Y
:
212 case wxSYS_VSCROLL_X
:
213 case wxSYS_VSCROLL_ARROW_X
:
214 case wxSYS_VSCROLL_ARROW_Y
:
218 case wxSYS_PENWINDOWS_PRESENT
:
221 case wxSYS_SWAP_BUTTONS
:
224 // TODO: case wxSYS_CAPTION_Y:
225 // TODO: case wxSYS_MENU_Y:
226 // TODO: case wxSYS_NETWORK_PRESENT:
227 // TODO: case wxSYS_SHOW_SOUNDS:
229 case wxSYS_DCLICK_MSEC
:
231 // default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway
232 // but rather rely on the 'click-count' by the system delivered in a mouse event
235 return (int)(GetDblTime() * 1000. / 60.);
238 // unsupported metric
245 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
249 case wxSYS_CAN_ICONIZE_FRAME
:
250 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: