]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/settings.cpp
correcting DropData behaviour so that preferred format is handled correctly
[wxWidgets.git] / src / mac / carbon / settings.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: settings.cpp
3// Purpose: wxSettings
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
e9576ca5
SC
13#pragma implementation "settings.h"
14#endif
15
3d1a4878
SC
16#include "wx/wxprec.h"
17
e9576ca5 18#include "wx/settings.h"
03e11df5 19#include "wx/gdicmn.h"
00500f40 20#include "wx/utils.h"
e9576ca5 21
76a5e5d2
SC
22#include "wx/mac/uma.h"
23
a174f139
GD
24// ----------------------------------------------------------------------------
25// wxSystemSettingsNative
26// ----------------------------------------------------------------------------
27
28// ----------------------------------------------------------------------------
29// colours
30// ----------------------------------------------------------------------------
31
32wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
e9576ca5 33{
00500f40
RR
34 int major,minor;
35 wxGetOsVersion( &major, &minor );
902725ee 36
00500f40
RR
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:
fc1f7cd5 49 case wxSYS_COLOUR_MENUBAR:
00500f40
RR
50 return wxColor( 0xDD , 0xDD , 0xDD ) ;
51 break ;
519cb848 52
00500f40
RR
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:
11d1adbf
SC
62 if (major >= 10)
63 return wxColor( 0xBE , 0xBE , 0xBE ) ;
64 else
65 return wxColor( 0x44 , 0x44 , 0x44 ) ;
00500f40 66 break ;
519cb848 67
00500f40
RR
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 ;
fff52b19 79 GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor, 32, true, &hilite );
00500f40
RR
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 ;
902725ee 87
00500f40
RR
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 ;
fff52b19 97 GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor, 32, true, &hilite );
00500f40
RR
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 :
902725ee 105 case wxSYS_COLOUR_APPWORKSPACE:
00500f40
RR
106 return *wxWHITE ;
107 break ;
fc1f7cd5
GD
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;
902725ee 115
fc1f7cd5
GD
116 case wxSYS_COLOUR_MAX:
117 wxFAIL_MSG( _T("unknown system colour index") );
118 break ;
00500f40
RR
119 }
120 return *wxWHITE;
e9576ca5
SC
121}
122
a174f139
GD
123// ----------------------------------------------------------------------------
124// fonts
125// ----------------------------------------------------------------------------
126
127wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
e9576ca5 128{
e9576ca5
SC
129 switch (index)
130 {
519cb848
SC
131 case wxSYS_ANSI_VAR_FONT :
132 case wxSYS_SYSTEM_FONT :
133 case wxSYS_DEVICE_DEFAULT_FONT :
134 case wxSYS_DEFAULT_GUI_FONT :
00500f40
RR
135 {
136 return *wxSMALL_FONT ;
902725ee 137 } ;
00500f40 138 break ;
902725ee 139
519cb848 140 default :
00500f40 141 break ;
e9576ca5 142 }
519cb848 143 return *wxNORMAL_FONT;
e9576ca5
SC
144}
145
a174f139
GD
146// ----------------------------------------------------------------------------
147// system metrics/features
148// ----------------------------------------------------------------------------
149
e9576ca5 150// Get a system metric, e.g. scrollbar size
9b0b5ba7 151int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
e9576ca5 152{
e8ca7105
GD
153 int value;
154
00500f40
RR
155 switch ( index)
156 {
e9576ca5 157 case wxSYS_MOUSE_BUTTONS:
e8ca7105
GD
158 // we emulate a two button mouse (ctrl + click = right button )
159 return 2;
902725ee 160
1d451c5b
RD
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:
902725ee 171
e9576ca5 172 case wxSYS_HSCROLL_ARROW_X:
a174f139 173 return 16;
e9576ca5 174 case wxSYS_HSCROLL_ARROW_Y:
a174f139 175 return 16;
e9576ca5 176 case wxSYS_HTHUMB_X:
a174f139 177 return 16;
902725ee 178
1d451c5b
RD
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
e9576ca5 186 case wxSYS_SCREEN_X:
e8ca7105
GD
187 wxDisplaySize(&value, NULL);
188 return value;
e9576ca5 189 case wxSYS_SCREEN_Y:
e8ca7105
GD
190 wxDisplaySize(NULL, &value);
191 return value;
902725ee 192
1d451c5b
RD
193 // TODO case wxSYS_FRAMESIZE_X:
194 // TODO case wxSYS_FRAMESIZE_Y:
195 // TODO case wxSYS_SMALLICON_X:
196 // TODO case wxSYS_SMALLICON_Y:
902725ee 197
e9576ca5 198 case wxSYS_HSCROLL_Y:
a174f139 199 return 16;
e9576ca5 200 case wxSYS_VSCROLL_X:
a174f139 201 return 16;
e9576ca5 202 case wxSYS_VSCROLL_ARROW_X:
a174f139 203 return 16;
e9576ca5 204 case wxSYS_VSCROLL_ARROW_Y:
a174f139 205 return 16;
e9576ca5 206 case wxSYS_VTHUMB_Y:
a174f139 207 return 16;
902725ee 208
1d451c5b
RD
209 // TODO case wxSYS_CAPTION_Y:
210 // TODO case wxSYS_MENU_Y:
211 // TODO case wxSYS_NETWORK_PRESENT:
902725ee 212
e9576ca5 213 case wxSYS_PENWINDOWS_PRESENT:
a174f139 214 return 0;
902725ee 215
1d451c5b 216 // TODO case wxSYS_SHOW_SOUNDS:
902725ee 217
e9576ca5 218 case wxSYS_SWAP_BUTTONS:
a174f139 219 return 0;
1d451c5b 220
a174f139 221 default:
902725ee 222 break; // unsupported metric
00500f40 223 }
902725ee 224 return -1;
e9576ca5
SC
225}
226
a174f139 227bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
228{
229 switch (index)
230 {
902725ee 231 case wxSYS_CAN_ICONIZE_FRAME:
253293c1 232 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
902725ee
WS
233 return true;
234
253293c1 235 default:
902725ee 236 return false;
253293c1
VS
237 }
238}