]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/settings.cpp
Source cleaning.
[wxWidgets.git] / src / mac / carbon / settings.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: settings.cpp
3 // Purpose: wxSettings
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/settings.h"
15 #include "wx/gdicmn.h"
16 #include "wx/utils.h"
17
18 #include "wx/mac/uma.h"
19
20 // ----------------------------------------------------------------------------
21 // wxSystemSettingsNative
22 // ----------------------------------------------------------------------------
23
24 // ----------------------------------------------------------------------------
25 // colours
26 // ----------------------------------------------------------------------------
27
28 wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
29 {
30 int major,minor;
31 wxGetOsVersion( &major, &minor );
32
33 switch( index )
34 {
35 case wxSYS_COLOUR_SCROLLBAR :
36 case wxSYS_COLOUR_BACKGROUND:
37 case wxSYS_COLOUR_ACTIVECAPTION:
38 case wxSYS_COLOUR_INACTIVECAPTION:
39 case wxSYS_COLOUR_MENU:
40 case wxSYS_COLOUR_WINDOW:
41 case wxSYS_COLOUR_WINDOWFRAME:
42 case wxSYS_COLOUR_ACTIVEBORDER:
43 case wxSYS_COLOUR_INACTIVEBORDER:
44 case wxSYS_COLOUR_BTNFACE:
45 case wxSYS_COLOUR_MENUBAR:
46 return wxColor( 0xDD , 0xDD , 0xDD ) ;
47 break ;
48
49 case wxSYS_COLOUR_LISTBOX :
50 {
51 if (major >= 10)
52 return *wxWHITE ;
53 else
54 return wxColor( 0xEE , 0xEE , 0xEE ) ;
55 break ;
56 }
57 case wxSYS_COLOUR_BTNSHADOW:
58 if (major >= 10)
59 return wxColor( 0xBE , 0xBE , 0xBE ) ;
60 else
61 return wxColor( 0x44 , 0x44 , 0x44 ) ;
62 break ;
63
64 case wxSYS_COLOUR_BTNTEXT:
65 case wxSYS_COLOUR_MENUTEXT:
66 case wxSYS_COLOUR_WINDOWTEXT:
67 case wxSYS_COLOUR_CAPTIONTEXT:
68 case wxSYS_COLOUR_INFOTEXT:
69 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
70 return *wxBLACK;
71 break ;
72 case wxSYS_COLOUR_HIGHLIGHT:
73 {
74 RGBColor hilite ;
75 GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor, 32, true, &hilite );
76 return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
77 }
78 break ;
79 case wxSYS_COLOUR_BTNHIGHLIGHT:
80 case wxSYS_COLOUR_GRAYTEXT:
81 return wxColor( 0xCC , 0xCC , 0xCC ) ;
82 break ;
83
84 case wxSYS_COLOUR_3DDKSHADOW:
85 return wxColor( 0x44 , 0x44 , 0x44 ) ;
86 break ;
87 case wxSYS_COLOUR_3DLIGHT:
88 return wxColor( 0xCC , 0xCC , 0xCC ) ;
89 break ;
90 case wxSYS_COLOUR_HIGHLIGHTTEXT :
91 {
92 RGBColor hilite ;
93 GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor, 32, true, &hilite );
94 if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
95 return *wxWHITE ;
96 else
97 return *wxBLACK ;
98 }
99 break ;
100 case wxSYS_COLOUR_INFOBK :
101 case wxSYS_COLOUR_APPWORKSPACE:
102 return *wxWHITE ;
103 break ;
104
105 case wxSYS_COLOUR_HOTLIGHT:
106 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
107 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
108 case wxSYS_COLOUR_MENUHILIGHT:
109 // TODO
110 return *wxBLACK;
111
112 case wxSYS_COLOUR_MAX:
113 wxFAIL_MSG( _T("unknown system colour index") );
114 break ;
115 }
116 return *wxWHITE;
117 }
118
119 // ----------------------------------------------------------------------------
120 // fonts
121 // ----------------------------------------------------------------------------
122
123 wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
124 {
125 switch (index)
126 {
127 case wxSYS_ANSI_VAR_FONT :
128 case wxSYS_SYSTEM_FONT :
129 case wxSYS_DEVICE_DEFAULT_FONT :
130 case wxSYS_DEFAULT_GUI_FONT :
131 {
132 return *wxSMALL_FONT ;
133 } ;
134 break ;
135
136 default :
137 break ;
138 }
139 return *wxNORMAL_FONT;
140 }
141
142 // ----------------------------------------------------------------------------
143 // system metrics/features
144 // ----------------------------------------------------------------------------
145
146 // Get a system metric, e.g. scrollbar size
147 int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
148 {
149 int value;
150
151 switch ( index)
152 {
153 case wxSYS_MOUSE_BUTTONS:
154 // we emulate a two button mouse (ctrl + click = right button )
155 return 2;
156
157 // TODO case wxSYS_BORDER_X:
158 // TODO case wxSYS_BORDER_Y:
159 // TODO case wxSYS_CURSOR_X:
160 // TODO case wxSYS_CURSOR_Y:
161 // TODO case wxSYS_DCLICK_X:
162 // TODO case wxSYS_DCLICK_Y:
163 // TODO case wxSYS_DRAG_X:
164 // TODO case wxSYS_DRAG_Y:
165 // TODO case wxSYS_EDGE_X:
166 // TODO case wxSYS_EDGE_Y:
167
168 case wxSYS_HSCROLL_ARROW_X:
169 return 16;
170 case wxSYS_HSCROLL_ARROW_Y:
171 return 16;
172 case wxSYS_HTHUMB_X:
173 return 16;
174
175 // TODO case wxSYS_ICON_X:
176 // TODO case wxSYS_ICON_Y:
177 // TODO case wxSYS_ICONSPACING_X:
178 // TODO case wxSYS_ICONSPACING_Y:
179 // TODO case wxSYS_WINDOWMIN_X:
180 // TODO case wxSYS_WINDOWMIN_Y:
181
182 case wxSYS_SCREEN_X:
183 wxDisplaySize(&value, NULL);
184 return value;
185 case wxSYS_SCREEN_Y:
186 wxDisplaySize(NULL, &value);
187 return value;
188
189 // TODO case wxSYS_FRAMESIZE_X:
190 // TODO case wxSYS_FRAMESIZE_Y:
191 // TODO case wxSYS_SMALLICON_X:
192 // TODO case wxSYS_SMALLICON_Y:
193
194 case wxSYS_HSCROLL_Y:
195 return 16;
196 case wxSYS_VSCROLL_X:
197 return 16;
198 case wxSYS_VSCROLL_ARROW_X:
199 return 16;
200 case wxSYS_VSCROLL_ARROW_Y:
201 return 16;
202 case wxSYS_VTHUMB_Y:
203 return 16;
204
205 // TODO case wxSYS_CAPTION_Y:
206 // TODO case wxSYS_MENU_Y:
207 // TODO case wxSYS_NETWORK_PRESENT:
208
209 case wxSYS_PENWINDOWS_PRESENT:
210 return 0;
211
212 // TODO case wxSYS_SHOW_SOUNDS:
213
214 case wxSYS_SWAP_BUTTONS:
215 return 0;
216
217 default:
218 break; // unsupported metric
219 }
220 return -1;
221 }
222
223 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
224 {
225 switch (index)
226 {
227 case wxSYS_CAN_ICONIZE_FRAME:
228 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
229 return true;
230
231 default:
232 return false;
233 }
234 }