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