]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/settings.cpp
crush compiler warnings and handle out of memory errors slightly better
[wxWidgets.git] / src / cocoa / settings.cpp
CommitLineData
a24aff65
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: settings.cpp
3// Purpose: wxSettings
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
65571936 9// Licence: wxWindows licence
a24aff65
DE
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// ----------------------------------------------------------------------------
21// wxSystemSettingsNative
22// ----------------------------------------------------------------------------
23
24// ----------------------------------------------------------------------------
25// colours
26// ----------------------------------------------------------------------------
27
28wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
29{
30 return wxColour();
31#if 0
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 return wxColor( 0x44 , 0x44 , 0x44 ) ;
61 break ;
62
63 case wxSYS_COLOUR_BTNTEXT:
64 case wxSYS_COLOUR_MENUTEXT:
65 case wxSYS_COLOUR_WINDOWTEXT:
66 case wxSYS_COLOUR_CAPTIONTEXT:
67 case wxSYS_COLOUR_INFOTEXT:
68 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
69 return *wxBLACK;
70 break ;
71 case wxSYS_COLOUR_HIGHLIGHT:
72 {
73 RGBColor hilite ;
74 LMGetHiliteRGB(&hilite) ;
75 return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
76 }
77 break ;
78 case wxSYS_COLOUR_BTNHIGHLIGHT:
79 case wxSYS_COLOUR_GRAYTEXT:
80 return wxColor( 0xCC , 0xCC , 0xCC ) ;
81 break ;
82
83 case wxSYS_COLOUR_3DDKSHADOW:
84 return wxColor( 0x44 , 0x44 , 0x44 ) ;
85 break ;
86 case wxSYS_COLOUR_3DLIGHT:
87 return wxColor( 0xCC , 0xCC , 0xCC ) ;
88 break ;
89 case wxSYS_COLOUR_HIGHLIGHTTEXT :
90 {
91 RGBColor hilite ;
92 LMGetHiliteRGB(&hilite) ;
93 if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
94 return *wxWHITE ;
95 else
96 return *wxBLACK ;
97 }
98 break ;
99 case wxSYS_COLOUR_INFOBK :
100 case wxSYS_COLOUR_APPWORKSPACE:
101 return *wxWHITE ;
102 break ;
103
104 case wxSYS_COLOUR_HOTLIGHT:
105 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
106 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
107 case wxSYS_COLOUR_MENUHILIGHT:
108 // TODO
109 return *wxBLACK;
110
111 case wxSYS_COLOUR_MAX:
112 wxFAIL_MSG( _T("unknown system colour index") );
113 break ;
114 }
115 return *wxWHITE;
116#endif
117}
118
119// ----------------------------------------------------------------------------
120// fonts
121// ----------------------------------------------------------------------------
122
123wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
124{
125// return a nonworking font object, crash from wxInitializeStockObjects
126 return wxFont();
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)
156{
157 switch ( index)
158 {
159 case wxSYS_MOUSE_BUTTONS:
160 return 2; // we emulate a two button mouse (ctrl + click = right button )
1d451c5b
RD
161
162 // TODO case wxSYS_BORDER_X:
163 // TODO case wxSYS_BORDER_Y:
164 // TODO case wxSYS_CURSOR_X:
165 // TODO case wxSYS_CURSOR_Y:
166 // TODO case wxSYS_DCLICK_X:
167 // TODO case wxSYS_DCLICK_Y:
168 // TODO case wxSYS_DRAG_X:
169 // TODO case wxSYS_DRAG_Y:
170 // TODO case wxSYS_EDGE_X:
171 // TODO case wxSYS_EDGE_Y:
172
a24aff65
DE
173 case wxSYS_HSCROLL_ARROW_X:
174 return 16;
175 case wxSYS_HSCROLL_ARROW_Y:
176 return 16;
177 case wxSYS_HTHUMB_X:
178 return 16;
1d451c5b
RD
179
180 // TODO case wxSYS_ICON_X:
181 // TODO case wxSYS_ICON_Y:
182 // TODO case wxSYS_ICONSPACING_X:
183 // TODO case wxSYS_ICONSPACING_Y:
184 // TODO case wxSYS_WINDOWMIN_X:
185 // TODO case wxSYS_WINDOWMIN_Y:
186 // TODO case wxSYS_SCREEN_X:
187 // TODO case wxSYS_SCREEN_Y:
188 // TODO case wxSYS_FRAMESIZE_X:
189 // TODO case wxSYS_FRAMESIZE_Y:
190 // TODO case wxSYS_SMALLICON_X:
191 // TODO case wxSYS_SMALLICON_Y:
192
a24aff65
DE
193 case wxSYS_HSCROLL_Y:
194 return 16;
195 case wxSYS_VSCROLL_X:
196 return 16;
197 case wxSYS_VSCROLL_ARROW_X:
198 return 16;
199 case wxSYS_VSCROLL_ARROW_Y:
200 return 16;
201 case wxSYS_VTHUMB_Y:
202 return 16;
1d451c5b
RD
203
204 // TODO case wxSYS_CAPTION_Y:
205 // TODO case wxSYS_MENU_Y:
206 // TODO case wxSYS_NETWORK_PRESENT:
207
a24aff65
DE
208 case wxSYS_PENWINDOWS_PRESENT:
209 return 0;
1d451c5b
RD
210
211 // TODO case wxSYS_SHOW_SOUNDS:
212
a24aff65
DE
213 case wxSYS_SWAP_BUTTONS:
214 return 0;
1d451c5b 215
a24aff65 216 default:
1d451c5b 217 return -1; // unsupported metric
a24aff65
DE
218 }
219 return 0;
220}
221
222bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
223{
224 switch (index)
225 {
226 case wxSYS_CAN_ICONIZE_FRAME:
227 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
228 return TRUE;
229
230 default:
231 return FALSE;
232 }
233}