]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/classic/settings.cpp
Should return wxImage not bool
[wxWidgets.git] / src / mac / classic / settings.cpp
... / ...
CommitLineData
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#ifdef __GNUG__
13#pragma implementation "settings.h"
14#endif
15
16#include "wx/settings.h"
17#include "wx/gdicmn.h"
18#include "wx/utils.h"
19
20#include "wx/mac/uma.h"
21
22// ----------------------------------------------------------------------------
23// wxSystemSettingsNative
24// ----------------------------------------------------------------------------
25
26// ----------------------------------------------------------------------------
27// colours
28// ----------------------------------------------------------------------------
29
30wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
31{
32 int major,minor;
33 wxGetOsVersion( &major, &minor );
34
35 switch( index )
36 {
37 case wxSYS_COLOUR_SCROLLBAR :
38 case wxSYS_COLOUR_BACKGROUND:
39 case wxSYS_COLOUR_ACTIVECAPTION:
40 case wxSYS_COLOUR_INACTIVECAPTION:
41 case wxSYS_COLOUR_MENU:
42 case wxSYS_COLOUR_WINDOW:
43 case wxSYS_COLOUR_WINDOWFRAME:
44 case wxSYS_COLOUR_ACTIVEBORDER:
45 case wxSYS_COLOUR_INACTIVEBORDER:
46 case wxSYS_COLOUR_BTNFACE:
47 case wxSYS_COLOUR_MENUBAR:
48 return wxColor( 0xDD , 0xDD , 0xDD ) ;
49 break ;
50
51 case wxSYS_COLOUR_LISTBOX :
52 {
53 if (major >= 10)
54 return *wxWHITE ;
55 else
56 return wxColor( 0xEE , 0xEE , 0xEE ) ;
57 break ;
58 }
59 case wxSYS_COLOUR_BTNSHADOW:
60 if (major >= 10)
61 return wxColor( 0xBE , 0xBE , 0xBE ) ;
62 else
63 return wxColor( 0x44 , 0x44 , 0x44 ) ;
64 break ;
65
66 case wxSYS_COLOUR_BTNTEXT:
67 case wxSYS_COLOUR_MENUTEXT:
68 case wxSYS_COLOUR_WINDOWTEXT:
69 case wxSYS_COLOUR_CAPTIONTEXT:
70 case wxSYS_COLOUR_INFOTEXT:
71 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
72 return *wxBLACK;
73 break ;
74 case wxSYS_COLOUR_HIGHLIGHT:
75 {
76 RGBColor hilite ;
77 LMGetHiliteRGB(&hilite) ;
78 return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
79 }
80 break ;
81 case wxSYS_COLOUR_BTNHIGHLIGHT:
82 case wxSYS_COLOUR_GRAYTEXT:
83 return wxColor( 0xCC , 0xCC , 0xCC ) ;
84 break ;
85
86 case wxSYS_COLOUR_3DDKSHADOW:
87 return wxColor( 0x44 , 0x44 , 0x44 ) ;
88 break ;
89 case wxSYS_COLOUR_3DLIGHT:
90 return wxColor( 0xCC , 0xCC , 0xCC ) ;
91 break ;
92 case wxSYS_COLOUR_HIGHLIGHTTEXT :
93 {
94 RGBColor hilite ;
95 LMGetHiliteRGB(&hilite) ;
96 if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
97 return *wxWHITE ;
98 else
99 return *wxBLACK ;
100 }
101 break ;
102 case wxSYS_COLOUR_INFOBK :
103 case wxSYS_COLOUR_APPWORKSPACE:
104 return *wxWHITE ;
105 break ;
106
107 case wxSYS_COLOUR_HOTLIGHT:
108 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
109 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
110 case wxSYS_COLOUR_MENUHILIGHT:
111 // TODO
112 return *wxBLACK;
113
114 case wxSYS_COLOUR_MAX:
115 wxFAIL_MSG( _T("unknown system colour index") );
116 break ;
117 }
118 return *wxWHITE;
119}
120
121// ----------------------------------------------------------------------------
122// fonts
123// ----------------------------------------------------------------------------
124
125wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
126{
127 switch (index)
128 {
129 case wxSYS_ANSI_VAR_FONT :
130 case wxSYS_SYSTEM_FONT :
131 case wxSYS_DEVICE_DEFAULT_FONT :
132 case wxSYS_DEFAULT_GUI_FONT :
133 {
134 return *wxSMALL_FONT ;
135 } ;
136 break ;
137 case wxSYS_OEM_FIXED_FONT :
138 case wxSYS_ANSI_FIXED_FONT :
139 case wxSYS_SYSTEM_FIXED_FONT :
140 default :
141 {
142 return *wxNORMAL_FONT ;
143 } ;
144 break ;
145
146 }
147 return *wxNORMAL_FONT;
148}
149
150// ----------------------------------------------------------------------------
151// system metrics/features
152// ----------------------------------------------------------------------------
153
154// Get a system metric, e.g. scrollbar size
155int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
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;
164
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:
175
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;
182
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:
189
190 case wxSYS_SCREEN_X:
191 wxDisplaySize(&value, NULL);
192 return value;
193 case wxSYS_SCREEN_Y:
194 wxDisplaySize(NULL, &value);
195 return value;
196
197 // TODO case wxSYS_FRAMESIZE_X:
198 // TODO case wxSYS_FRAMESIZE_Y:
199 // TODO case wxSYS_SMALLICON_X:
200 // TODO case wxSYS_SMALLICON_Y:
201
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;
212
213 // TODO case wxSYS_CAPTION_Y:
214 // TODO case wxSYS_MENU_Y:
215 // TODO case wxSYS_NETWORK_PRESENT:
216
217 case wxSYS_PENWINDOWS_PRESENT:
218 return 0;
219
220 // TODO case wxSYS_SHOW_SOUNDS:
221
222 case wxSYS_SWAP_BUTTONS:
223 return 0;
224
225 default:
226 return -1; // unsupported metric
227 }
228 return 0;
229}
230
231bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
232{
233 switch (index)
234 {
235 case wxSYS_CAN_ICONIZE_FRAME:
236 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
237 return TRUE;
238
239 default:
240 return FALSE;
241 }
242}