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
)
36 ThemeBrush colorBrushID
;
38 wxGetOsVersion( &major
, &minor
);
42 case wxSYS_COLOUR_SCROLLBAR
:
43 case wxSYS_COLOUR_BACKGROUND
:
44 case wxSYS_COLOUR_ACTIVECAPTION
:
45 case wxSYS_COLOUR_INACTIVECAPTION
:
46 case wxSYS_COLOUR_MENU
:
47 case wxSYS_COLOUR_WINDOW
:
48 case wxSYS_COLOUR_WINDOWFRAME
:
49 case wxSYS_COLOUR_ACTIVEBORDER
:
50 case wxSYS_COLOUR_INACTIVEBORDER
:
51 case wxSYS_COLOUR_BTNFACE
:
52 case wxSYS_COLOUR_MENUBAR
:
53 resultColor
= wxColor( 0xDD, 0xDD, 0xDD );
56 case wxSYS_COLOUR_LISTBOX
:
58 resultColor
= *wxWHITE
;
60 resultColor
= wxColor( 0xEE, 0xEE, 0xEE );
63 case wxSYS_COLOUR_BTNSHADOW
:
65 resultColor
= wxColor( 0xBE, 0xBE, 0xBE );
67 resultColor
= wxColor( 0x44, 0x44, 0x44 );
70 case wxSYS_COLOUR_BTNTEXT
:
71 case wxSYS_COLOUR_MENUTEXT
:
72 case wxSYS_COLOUR_WINDOWTEXT
:
73 case wxSYS_COLOUR_CAPTIONTEXT
:
74 case wxSYS_COLOUR_INFOTEXT
:
75 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
76 resultColor
= *wxBLACK
;
79 case wxSYS_COLOUR_HIGHLIGHT
:
81 #if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
82 // NB: enable this case as desired
83 colorBrushID
= kThemeBrushAlternatePrimaryHighlightColor
;
85 colorBrushID
= kThemeBrushPrimaryHighlightColor
;
88 GetThemeBrushAsColor( colorBrushID
, 32, true, &macRGB
);
89 resultColor
= wxColor( macRGB
.red
>> 8, macRGB
.green
>> 8, macRGB
.blue
>> 8 );
92 case wxSYS_COLOUR_BTNHIGHLIGHT
:
93 case wxSYS_COLOUR_GRAYTEXT
:
94 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
97 case wxSYS_COLOUR_3DDKSHADOW
:
98 resultColor
= wxColor( 0x44, 0x44, 0x44 );
101 case wxSYS_COLOUR_3DLIGHT
:
102 resultColor
= wxColor( 0xCC, 0xCC, 0xCC );
105 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
106 #if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
107 // NB: enable this case as desired
108 resultColor
= *wxWHITE
;
110 GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor
, 32, true, &macRGB
);
111 if ((macRGB
.red
+ macRGB
.green
+ macRGB
.blue
) == 0)
112 resultColor
= *wxWHITE
;
114 resultColor
= *wxBLACK
;
118 case wxSYS_COLOUR_INFOBK
:
119 case wxSYS_COLOUR_APPWORKSPACE
:
120 resultColor
= *wxWHITE
;
123 case wxSYS_COLOUR_HOTLIGHT
:
124 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
125 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
126 case wxSYS_COLOUR_MENUHILIGHT
:
128 resultColor
= *wxBLACK
;
131 // case wxSYS_COLOUR_MAX:
133 resultColor
= *wxWHITE
;
134 // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, _T("unknown system colour index") );
141 // ----------------------------------------------------------------------------
143 // ----------------------------------------------------------------------------
145 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
149 case wxSYS_ANSI_VAR_FONT
:
150 case wxSYS_SYSTEM_FONT
:
151 case wxSYS_DEVICE_DEFAULT_FONT
:
152 case wxSYS_DEFAULT_GUI_FONT
:
153 return *wxSMALL_FONT
;
160 return *wxNORMAL_FONT
;
163 // ----------------------------------------------------------------------------
164 // system metrics/features
165 // ----------------------------------------------------------------------------
167 // Get a system metric, e.g. scrollbar size
168 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
, wxWindow
* WXUNUSED(win
))
174 case wxSYS_MOUSE_BUTTONS
:
175 // we emulate a two button mouse (ctrl + click = right button)
178 // TODO case wxSYS_BORDER_X:
179 // TODO case wxSYS_BORDER_Y:
180 // TODO case wxSYS_CURSOR_X:
181 // TODO case wxSYS_CURSOR_Y:
182 // TODO case wxSYS_DCLICK_X:
183 // TODO case wxSYS_DCLICK_Y:
184 // TODO case wxSYS_DRAG_X:
185 // TODO case wxSYS_DRAG_Y:
186 // TODO case wxSYS_EDGE_X:
187 // TODO case wxSYS_EDGE_Y:
189 case wxSYS_HSCROLL_ARROW_X
:
190 case wxSYS_HSCROLL_ARROW_Y
:
194 // TODO case wxSYS_ICON_X:
195 // TODO case wxSYS_ICON_Y:
196 // TODO case wxSYS_ICONSPACING_X:
197 // TODO case wxSYS_ICONSPACING_Y:
198 // TODO case wxSYS_WINDOWMIN_X:
199 // TODO case wxSYS_WINDOWMIN_Y:
202 wxDisplaySize( &value
, NULL
);
206 wxDisplaySize( NULL
, &value
);
209 // TODO case wxSYS_FRAMESIZE_X:
210 // TODO case wxSYS_FRAMESIZE_Y:
211 // TODO case wxSYS_SMALLICON_X:
212 // TODO case wxSYS_SMALLICON_Y:
214 case wxSYS_HSCROLL_Y
:
215 case wxSYS_VSCROLL_X
:
216 case wxSYS_VSCROLL_ARROW_X
:
217 case wxSYS_VSCROLL_ARROW_Y
:
221 case wxSYS_PENWINDOWS_PRESENT
:
224 case wxSYS_SWAP_BUTTONS
:
227 // TODO: case wxSYS_CAPTION_Y:
228 // TODO: case wxSYS_MENU_Y:
229 // TODO: case wxSYS_NETWORK_PRESENT:
230 // TODO: case wxSYS_SHOW_SOUNDS:
233 // unsupported metric
240 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
244 case wxSYS_CAN_ICONIZE_FRAME
:
245 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: