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