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