1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/mac/carbon/settings.cpp 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) Stefan Csomor 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #include "wx/wxprec.h" 
  14 #include "wx/settings.h" 
  18     #include "wx/gdicmn.h" 
  21 #include "wx/mac/uma.h" 
  23 // ---------------------------------------------------------------------------- 
  24 // wxSystemSettingsNative 
  25 // ---------------------------------------------------------------------------- 
  27 // ---------------------------------------------------------------------------- 
  29 // ---------------------------------------------------------------------------- 
  31 wxColour 
wxSystemSettingsNative::GetColour(wxSystemColour index
) 
  36     ThemeBrush colorBrushID
; 
  38     wxGetOsVersion( &major
, &minor 
); 
  42         case wxSYS_COLOUR_WINDOW
: 
  43             resultColor 
= *wxWHITE 
; 
  45         case wxSYS_COLOUR_SCROLLBAR 
: 
  46         case wxSYS_COLOUR_BACKGROUND
: 
  47         case wxSYS_COLOUR_ACTIVECAPTION
: 
  48         case wxSYS_COLOUR_INACTIVECAPTION
: 
  49         case wxSYS_COLOUR_MENU
: 
  50         case wxSYS_COLOUR_WINDOWFRAME
: 
  51         case wxSYS_COLOUR_ACTIVEBORDER
: 
  52         case wxSYS_COLOUR_INACTIVEBORDER
: 
  53         case wxSYS_COLOUR_BTNFACE
: 
  54         case wxSYS_COLOUR_MENUBAR
: 
  55             resultColor 
= wxColor( 0xDD, 0xDD, 0xDD ); 
  58         case wxSYS_COLOUR_LISTBOX 
: 
  60                 resultColor 
= *wxWHITE 
; 
  62                 resultColor 
= wxColor( 0xEE, 0xEE, 0xEE ); 
  65         case wxSYS_COLOUR_BTNSHADOW
: 
  67                 resultColor 
= wxColor( 0xBE, 0xBE, 0xBE ); 
  69                 resultColor 
= wxColor( 0x44, 0x44, 0x44 ); 
  72         case wxSYS_COLOUR_BTNTEXT
: 
  73         case wxSYS_COLOUR_MENUTEXT
: 
  74         case wxSYS_COLOUR_WINDOWTEXT
: 
  75         case wxSYS_COLOUR_CAPTIONTEXT
: 
  76         case wxSYS_COLOUR_INFOTEXT
: 
  77         case wxSYS_COLOUR_INACTIVECAPTIONTEXT
: 
  78             resultColor 
= *wxBLACK
; 
  81         case wxSYS_COLOUR_HIGHLIGHT
: 
  83 #if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) 
  84             // NB: enable this case as desired 
  85             colorBrushID 
= kThemeBrushAlternatePrimaryHighlightColor
; 
  87             colorBrushID 
= kThemeBrushPrimaryHighlightColor
; 
  90             GetThemeBrushAsColor( colorBrushID
, 32, true, &macRGB 
); 
  91             resultColor 
= wxColor( macRGB
.red 
>> 8, macRGB
.green 
>> 8, macRGB
.blue 
>> 8 ); 
  94         case wxSYS_COLOUR_BTNHIGHLIGHT
: 
  95         case wxSYS_COLOUR_GRAYTEXT
: 
  96             resultColor 
= wxColor( 0xCC, 0xCC, 0xCC ); 
  99         case wxSYS_COLOUR_3DDKSHADOW
: 
 100             resultColor 
= wxColor( 0x44, 0x44, 0x44 ); 
 103         case wxSYS_COLOUR_3DLIGHT
: 
 104             resultColor 
= wxColor( 0xCC, 0xCC, 0xCC ); 
 107         case wxSYS_COLOUR_HIGHLIGHTTEXT 
: 
 108 #if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) 
 109             // NB: enable this case as desired 
 110             resultColor 
= *wxWHITE 
; 
 112             GetThemeBrushAsColor( kThemeBrushPrimaryHighlightColor
, 32, true, &macRGB 
); 
 113             if ((macRGB
.red 
+ macRGB
.green 
+ macRGB
.blue
) == 0) 
 114                 resultColor 
= *wxWHITE 
; 
 116                 resultColor 
= *wxBLACK 
; 
 120         case wxSYS_COLOUR_INFOBK 
: 
 121             resultColor 
= *wxWHITE 
; 
 123         case wxSYS_COLOUR_APPWORKSPACE
: 
 124             resultColor 
=  wxColor( 0x80, 0x80, 0x80 ); ; 
 127         case wxSYS_COLOUR_HOTLIGHT
: 
 128         case wxSYS_COLOUR_GRADIENTACTIVECAPTION
: 
 129         case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
: 
 130         case wxSYS_COLOUR_MENUHILIGHT
: 
 132             resultColor 
= *wxBLACK
; 
 135         // case wxSYS_COLOUR_MAX: 
 137             resultColor 
= *wxWHITE
; 
 138             // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, _T("unknown system colour index") ); 
 145 // ---------------------------------------------------------------------------- 
 147 // ---------------------------------------------------------------------------- 
 149 wxFont 
wxSystemSettingsNative::GetFont(wxSystemFont index
) 
 153         case wxSYS_ANSI_VAR_FONT 
: 
 154         case wxSYS_SYSTEM_FONT 
: 
 155         case wxSYS_DEVICE_DEFAULT_FONT 
: 
 156         case wxSYS_DEFAULT_GUI_FONT 
: 
 157             return *wxSMALL_FONT 
; 
 164     return *wxNORMAL_FONT
; 
 167 // ---------------------------------------------------------------------------- 
 168 // system metrics/features 
 169 // ---------------------------------------------------------------------------- 
 171 // Get a system metric, e.g. scrollbar size 
 172 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
, wxWindow
* WXUNUSED(win
)) 
 178         case wxSYS_MOUSE_BUTTONS
: 
 179             // we emulate a two button mouse (ctrl + click = right button) 
 182         // TODO case wxSYS_BORDER_X: 
 183         // TODO case wxSYS_BORDER_Y: 
 184         // TODO case wxSYS_CURSOR_X: 
 185         // TODO case wxSYS_CURSOR_Y: 
 186         // TODO case wxSYS_DCLICK_X: 
 187         // TODO case wxSYS_DCLICK_Y: 
 188         // TODO case wxSYS_DRAG_X: 
 189         // TODO case wxSYS_DRAG_Y: 
 190         // TODO case wxSYS_EDGE_X: 
 191         // TODO case wxSYS_EDGE_Y: 
 193         case wxSYS_HSCROLL_ARROW_X
: 
 194         case wxSYS_HSCROLL_ARROW_Y
: 
 198         // TODO case wxSYS_ICON_X: 
 199         // TODO case wxSYS_ICON_Y: 
 200         // TODO case wxSYS_ICONSPACING_X: 
 201         // TODO case wxSYS_ICONSPACING_Y: 
 202         // TODO case wxSYS_WINDOWMIN_X: 
 203         // TODO case wxSYS_WINDOWMIN_Y: 
 206             wxDisplaySize( &value
, NULL 
); 
 210             wxDisplaySize( NULL
, &value 
); 
 213         // TODO case wxSYS_FRAMESIZE_X: 
 214         // TODO case wxSYS_FRAMESIZE_Y: 
 215         // TODO case wxSYS_SMALLICON_X: 
 216         // TODO case wxSYS_SMALLICON_Y: 
 218         case wxSYS_HSCROLL_Y
: 
 219         case wxSYS_VSCROLL_X
: 
 220         case wxSYS_VSCROLL_ARROW_X
: 
 221         case wxSYS_VSCROLL_ARROW_Y
: 
 225         case wxSYS_PENWINDOWS_PRESENT
: 
 228         case wxSYS_SWAP_BUTTONS
: 
 231         // TODO: case wxSYS_CAPTION_Y: 
 232         // TODO: case wxSYS_MENU_Y: 
 233         // TODO: case wxSYS_NETWORK_PRESENT: 
 234         // TODO: case wxSYS_SHOW_SOUNDS: 
 237             // unsupported metric 
 244 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
) 
 248         case wxSYS_CAN_ICONIZE_FRAME
: 
 249         case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: