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