Implement using NSColor class methods for system colors.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,22 +1,26 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: settings.cpp
|
// Name: src/cocoa/settings.mm
|
||||||
// Purpose: wxSettings
|
// Purpose: wxSettings
|
||||||
// Author: AUTHOR
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: ??/??/98
|
// Created: 2005/01/11
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) AUTHOR
|
// Copyright: (c) 2005 David Elliott
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#include <wx/wxprec.h>
|
||||||
#pragma implementation "settings.h"
|
#ifndef WX_PRECOMP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/autorelease.h"
|
||||||
|
|
||||||
|
#import <AppKit/NSColor.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxSystemSettingsNative
|
// wxSystemSettingsNative
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -27,93 +31,72 @@
|
|||||||
|
|
||||||
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||||
{
|
{
|
||||||
return wxColour();
|
wxAutoNSAutoreleasePool pool;
|
||||||
#if 0
|
|
||||||
int major,minor;
|
|
||||||
wxGetOsVersion( &major, &minor );
|
|
||||||
|
|
||||||
switch( index )
|
switch( index )
|
||||||
{
|
{
|
||||||
case wxSYS_COLOUR_SCROLLBAR:
|
case wxSYS_COLOUR_SCROLLBAR:
|
||||||
case wxSYS_COLOUR_BACKGROUND:
|
return wxColour([NSColor scrollBarColor]); // color of slot
|
||||||
case wxSYS_COLOUR_ACTIVECAPTION:
|
case wxSYS_COLOUR_BACKGROUND: // No idea how to get desktop background
|
||||||
case wxSYS_COLOUR_INACTIVECAPTION:
|
break; // break so we return an invalid colour.
|
||||||
|
case wxSYS_COLOUR_ACTIVECAPTION: // No idea how to get this
|
||||||
|
// fall through, window background is reasonable
|
||||||
|
case wxSYS_COLOUR_INACTIVECAPTION: // No idea how to get this
|
||||||
|
// fall through, window background is reasonable
|
||||||
case wxSYS_COLOUR_MENU:
|
case wxSYS_COLOUR_MENU:
|
||||||
|
case wxSYS_COLOUR_MENUBAR:
|
||||||
case wxSYS_COLOUR_WINDOW:
|
case wxSYS_COLOUR_WINDOW:
|
||||||
case wxSYS_COLOUR_WINDOWFRAME:
|
case wxSYS_COLOUR_WINDOWFRAME:
|
||||||
case wxSYS_COLOUR_ACTIVEBORDER:
|
case wxSYS_COLOUR_ACTIVEBORDER:
|
||||||
case wxSYS_COLOUR_INACTIVEBORDER:
|
case wxSYS_COLOUR_INACTIVEBORDER:
|
||||||
|
return wxColour([NSColor windowFrameColor]);
|
||||||
case wxSYS_COLOUR_BTNFACE:
|
case wxSYS_COLOUR_BTNFACE:
|
||||||
case wxSYS_COLOUR_MENUBAR:
|
return wxColour([NSColor knobColor]); // close enough?
|
||||||
return wxColor( 0xDD , 0xDD , 0xDD ) ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case wxSYS_COLOUR_LISTBOX:
|
case wxSYS_COLOUR_LISTBOX:
|
||||||
{
|
return wxColour([NSColor controlBackgroundColor]);
|
||||||
if (major >= 10)
|
|
||||||
return *wxWHITE ;
|
|
||||||
else
|
|
||||||
return wxColor( 0xEE , 0xEE , 0xEE ) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_BTNSHADOW:
|
case wxSYS_COLOUR_BTNSHADOW:
|
||||||
return wxColor( 0x44 , 0x44 , 0x44 ) ;
|
return wxColour([NSColor controlShadowColor]);
|
||||||
break ;
|
|
||||||
|
|
||||||
case wxSYS_COLOUR_BTNTEXT:
|
case wxSYS_COLOUR_BTNTEXT:
|
||||||
case wxSYS_COLOUR_MENUTEXT:
|
case wxSYS_COLOUR_MENUTEXT:
|
||||||
case wxSYS_COLOUR_WINDOWTEXT:
|
case wxSYS_COLOUR_WINDOWTEXT:
|
||||||
case wxSYS_COLOUR_CAPTIONTEXT:
|
case wxSYS_COLOUR_CAPTIONTEXT:
|
||||||
case wxSYS_COLOUR_INFOTEXT:
|
case wxSYS_COLOUR_INFOTEXT:
|
||||||
case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
|
case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
|
||||||
return *wxBLACK;
|
return wxColour([NSColor controlTextColor]);
|
||||||
break ;
|
|
||||||
case wxSYS_COLOUR_HIGHLIGHT:
|
case wxSYS_COLOUR_HIGHLIGHT:
|
||||||
{
|
return wxColour([NSColor selectedControlColor]);
|
||||||
RGBColor hilite ;
|
|
||||||
LMGetHiliteRGB(&hilite) ;
|
|
||||||
return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
||||||
|
return wxColour([NSColor controlHighlightColor]);
|
||||||
case wxSYS_COLOUR_GRAYTEXT:
|
case wxSYS_COLOUR_GRAYTEXT:
|
||||||
return wxColor( 0xCC , 0xCC , 0xCC ) ;
|
return wxColour([NSColor disabledControlTextColor]);
|
||||||
break ;
|
|
||||||
|
|
||||||
case wxSYS_COLOUR_3DDKSHADOW:
|
case wxSYS_COLOUR_3DDKSHADOW:
|
||||||
return wxColor( 0x44 , 0x44 , 0x44 ) ;
|
return wxColour([NSColor controlShadowColor]);
|
||||||
break ;
|
|
||||||
case wxSYS_COLOUR_3DLIGHT:
|
case wxSYS_COLOUR_3DLIGHT:
|
||||||
return wxColor( 0xCC , 0xCC , 0xCC ) ;
|
return wxColour([NSColor controlHighlightColor]);
|
||||||
break ;
|
|
||||||
case wxSYS_COLOUR_HIGHLIGHTTEXT:
|
case wxSYS_COLOUR_HIGHLIGHTTEXT:
|
||||||
{
|
return wxColour([NSColor selectedControlTextColor]);
|
||||||
RGBColor hilite ;
|
|
||||||
LMGetHiliteRGB(&hilite) ;
|
|
||||||
if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
|
|
||||||
return *wxWHITE ;
|
|
||||||
else
|
|
||||||
return *wxBLACK ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxSYS_COLOUR_INFOBK:
|
case wxSYS_COLOUR_INFOBK:
|
||||||
|
// tooltip (bogus)
|
||||||
|
return wxColour([NSColor controlBackgroundColor]);
|
||||||
case wxSYS_COLOUR_APPWORKSPACE:
|
case wxSYS_COLOUR_APPWORKSPACE:
|
||||||
return *wxWHITE ;
|
// MDI window color (bogus)
|
||||||
break ;
|
return wxColour([NSColor windowBackgroundColor]);
|
||||||
|
|
||||||
case wxSYS_COLOUR_HOTLIGHT:
|
case wxSYS_COLOUR_HOTLIGHT:
|
||||||
|
break; // what is this?
|
||||||
case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
|
case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
|
||||||
case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
|
case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
|
||||||
|
break; // Doesn't really apply to Cocoa.
|
||||||
case wxSYS_COLOUR_MENUHILIGHT:
|
case wxSYS_COLOUR_MENUHILIGHT:
|
||||||
// TODO
|
return wxColour([NSColor selectedMenuItemColor]);
|
||||||
return *wxBLACK;
|
|
||||||
|
|
||||||
case wxSYS_COLOUR_MAX:
|
case wxSYS_COLOUR_MAX:
|
||||||
wxFAIL_MSG( _T("unknown system colour index") );
|
default:
|
||||||
break ;
|
if(index>=wxSYS_COLOUR_MAX)
|
||||||
|
{
|
||||||
|
wxFAIL_MSG(wxT("Invalid system colour index"));
|
||||||
|
return wxColour();
|
||||||
}
|
}
|
||||||
return *wxWHITE;
|
}
|
||||||
#endif
|
wxFAIL_MSG(wxT("Unimplemented system colour index"));
|
||||||
|
return wxColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user