mac cleanup, pure cgcolor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50183 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
850df2d788
commit
a01d9a255c
@ -23,62 +23,70 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
||||
|
||||
class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
|
||||
{
|
||||
friend class wxBrush;
|
||||
|
||||
public:
|
||||
wxBrushRefData();
|
||||
wxBrushRefData(const wxColour& colour = wxNullColour, int style = wxSOLID);
|
||||
wxBrushRefData(const wxBitmap& stipple);
|
||||
wxBrushRefData(const wxBrushRefData& data);
|
||||
virtual ~wxBrushRefData();
|
||||
|
||||
bool operator == ( const wxBrushRefData& brush ) const
|
||||
{
|
||||
return m_style == brush.m_style &&
|
||||
m_stipple.IsSameAs(brush.m_stipple) &&
|
||||
m_colour == brush.m_colour &&
|
||||
m_macBrushKind == brush.m_macBrushKind &&
|
||||
m_macThemeBrush == brush.m_macThemeBrush &&
|
||||
m_macThemeBackground == brush.m_macThemeBackground &&
|
||||
EqualRect(&m_macThemeBackgroundExtent, &brush.m_macThemeBackgroundExtent);
|
||||
}
|
||||
|
||||
bool operator==(const wxBrushRefData& data) const;
|
||||
|
||||
const wxColour& GetColour() const { return m_colour; }
|
||||
int GetStyle() const { return m_style; }
|
||||
wxBitmap *GetStipple() { return &m_stipple; }
|
||||
|
||||
void SetColour(const wxColour& colour) { m_colour = colour; }
|
||||
void SetStyle(int style) { m_style = style; }
|
||||
void SetStipple(const wxBitmap& stipple) { DoSetStipple(stipple); }
|
||||
|
||||
protected:
|
||||
wxMacBrushKind m_macBrushKind ;
|
||||
int m_style;
|
||||
void DoSetStipple(const wxBitmap& stipple);
|
||||
|
||||
wxBitmap m_stipple ;
|
||||
wxColour m_colour;
|
||||
|
||||
ThemeBrush m_macThemeBrush ;
|
||||
|
||||
ThemeBackgroundKind m_macThemeBackground ;
|
||||
Rect m_macThemeBackgroundExtent ;
|
||||
int m_style;
|
||||
};
|
||||
|
||||
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
|
||||
|
||||
|
||||
wxBrushRefData::wxBrushRefData()
|
||||
: m_style(wxSOLID)
|
||||
wxBrushRefData::wxBrushRefData(const wxColour& colour, int style)
|
||||
: m_colour(colour), m_style( style )
|
||||
{
|
||||
m_macBrushKind = kwxMacBrushColour ;
|
||||
}
|
||||
|
||||
wxBrushRefData::wxBrushRefData(const wxBitmap& stipple)
|
||||
{
|
||||
DoSetStipple( stipple );
|
||||
}
|
||||
|
||||
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
||||
: wxGDIRefData()
|
||||
, m_style(data.m_style)
|
||||
: wxGDIRefData() ,
|
||||
m_stipple(data.m_stipple),
|
||||
m_colour(data.m_colour),
|
||||
m_style(data.m_style)
|
||||
{
|
||||
m_stipple = data.m_stipple;
|
||||
m_colour = data.m_colour;
|
||||
m_macBrushKind = data.m_macBrushKind ;
|
||||
m_macThemeBrush = data.m_macThemeBrush ;
|
||||
m_macThemeBackground = data.m_macThemeBackground ;
|
||||
m_macThemeBackgroundExtent = data.m_macThemeBackgroundExtent ;
|
||||
}
|
||||
|
||||
wxBrushRefData::~wxBrushRefData()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxBrushRefData::operator==(const wxBrushRefData& data) const
|
||||
{
|
||||
return m_style == data.m_style &&
|
||||
m_colour == data.m_colour &&
|
||||
m_stipple.IsSameAs(data.m_stipple);
|
||||
}
|
||||
|
||||
void wxBrushRefData::DoSetStipple(const wxBitmap& stipple)
|
||||
{
|
||||
m_stipple = stipple;
|
||||
m_style = stipple.GetMask() ? wxSTIPPLE_MASK_OPAQUE : wxSTIPPLE;
|
||||
}
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
wxBrush::wxBrush()
|
||||
{
|
||||
}
|
||||
@ -87,189 +95,91 @@ wxBrush::~wxBrush()
|
||||
{
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxColour& col, int Style)
|
||||
wxBrush::wxBrush(const wxColour& col, int style)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
m_refData = new wxBrushRefData( col, style );
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxBitmap& stipple)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_colour = *wxBLACK;
|
||||
M_BRUSHDATA->m_stipple = stipple;
|
||||
|
||||
if (M_BRUSHDATA->m_stipple.GetMask())
|
||||
M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE;
|
||||
else
|
||||
M_BRUSHDATA->m_style = wxSTIPPLE;
|
||||
|
||||
RealizeResource();
|
||||
m_refData = new wxBrushRefData( stipple );
|
||||
}
|
||||
|
||||
wxBrush::wxBrush( ThemeBrush macThemeBrush )
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush house keeping stuff
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBrush::operator==(const wxBrush& brush) const
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
|
||||
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||
|
||||
RealizeResource();
|
||||
const wxBrushRefData *brushData = (wxBrushRefData *)brush.m_refData;
|
||||
|
||||
// an invalid brush is considered to be only equal to another invalid brush
|
||||
return m_refData ? (brushData && *M_BRUSHDATA == *brushData) : !brushData;
|
||||
}
|
||||
|
||||
void wxBrush::Unshare()
|
||||
wxObjectRefData *wxBrush::CreateRefData() const
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
return new wxBrushRefData;
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(const wxColour& col)
|
||||
wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
|
||||
{
|
||||
Unshare();
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
return new wxBrushRefData(*(const wxBrushRefData *)data);
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const wxColour& wxBrush::GetColour() const
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetStyle(int Style)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
|
||||
M_BRUSHDATA->m_stipple = Stipple;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
|
||||
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||
|
||||
RGBColor color = { 0,0,0 } ;
|
||||
#ifdef __LP64__
|
||||
CGColorRef colorref = 0;
|
||||
HIThemeBrushCreateCGColor( macThemeBrush, &colorref );
|
||||
size_t noComp = CGColorGetNumberOfComponents( colorref );
|
||||
if ( noComp >=3 && noComp <= 4 )
|
||||
{
|
||||
// TODO verify whether we really are on a RGB color space
|
||||
const CGFloat *components = CGColorGetComponents( colorref );
|
||||
color.red = (int)(components[0]*255+0.5);
|
||||
color.green = (int)(components[1]*255+0.5);
|
||||
color.blue = (int)(components[2]*255+0.5);
|
||||
}
|
||||
CFRelease( colorref );
|
||||
#else
|
||||
GetThemeBrushAsColor( macThemeBrush , 32, true, &color );
|
||||
#endif
|
||||
M_BRUSHDATA->m_colour = color;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
/* TODO REMOVE
|
||||
void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRECTPTR extent)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
|
||||
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
|
||||
M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
*/
|
||||
|
||||
bool wxBrush::RealizeResource()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
unsigned long wxBrush::MacGetThemeBackground(WXRECTPTR extent) const
|
||||
{
|
||||
if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
|
||||
{
|
||||
if ( extent )
|
||||
*(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent;
|
||||
|
||||
return M_BRUSHDATA->m_macThemeBackground;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
short wxBrush::MacGetTheme() const
|
||||
{
|
||||
return (M_BRUSHDATA ? ((M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme) ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
|
||||
}
|
||||
|
||||
wxColour& wxBrush::GetColour() const
|
||||
{
|
||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
|
||||
wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->GetColour();
|
||||
}
|
||||
|
||||
int wxBrush::GetStyle() const
|
||||
{
|
||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->GetStyle();
|
||||
}
|
||||
|
||||
wxBitmap *wxBrush::GetStipple() const
|
||||
{
|
||||
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
|
||||
wxCHECK_MSG( Ok(), NULL, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->GetStipple();
|
||||
}
|
||||
|
||||
wxMacBrushKind wxBrush::MacGetBrushKind() const
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush setters
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxBrush::SetColour(const wxColour& col)
|
||||
{
|
||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
|
||||
AllocExclusive();
|
||||
|
||||
M_BRUSHDATA->SetColour(col);
|
||||
}
|
||||
|
||||
bool wxBrush::operator == ( const wxBrush& brush ) const
|
||||
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
if (m_refData == brush.m_refData) return true;
|
||||
|
||||
if (!m_refData || !brush.m_refData) return false;
|
||||
|
||||
return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData );
|
||||
AllocExclusive();
|
||||
|
||||
M_BRUSHDATA->SetColour(wxColour(r, g, b));
|
||||
}
|
||||
|
||||
void wxBrush::SetStyle(int style)
|
||||
{
|
||||
AllocExclusive();
|
||||
|
||||
M_BRUSHDATA->SetStyle(style);
|
||||
}
|
||||
|
||||
void wxBrush::SetStipple(const wxBitmap& stipple)
|
||||
{
|
||||
AllocExclusive();
|
||||
|
||||
M_BRUSHDATA->SetStipple(stipple);
|
||||
}
|
||||
|
@ -48,11 +48,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
|
||||
#include "wx/tabctrl.h"
|
||||
|
||||
|
||||
static wxBrush MacGetBackgroundBrush( wxWindow* window )
|
||||
{
|
||||
wxBrush bkdBrush = window->MacGetBackgroundBrush() ;
|
||||
return bkdBrush ;
|
||||
}
|
||||
|
||||
wxWindowDC::wxWindowDC()
|
||||
{
|
||||
@ -89,7 +84,7 @@ wxWindowDC::wxWindowDC(wxWindow *window)
|
||||
}
|
||||
SetClippingRegion( 0 , 0 , m_width , m_height ) ;
|
||||
|
||||
SetBackground(MacGetBackgroundBrush(window));
|
||||
SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID));
|
||||
|
||||
SetFont( window->GetFont() ) ;
|
||||
}
|
||||
|
@ -79,9 +79,8 @@ bool wxDrawerWindow::Create(wxWindow *parent,
|
||||
if (success)
|
||||
{
|
||||
// Use drawer brush.
|
||||
m_macBackgroundBrush.MacSetTheme(kThemeBrushDrawerBackground);
|
||||
::SetThemeWindowBackground((WindowRef)m_macWindow,
|
||||
m_macBackgroundBrush.MacGetTheme(), false);
|
||||
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
|
||||
::SetThemeWindowBackground((WindowRef)m_macWindow, kThemeBrushDrawerBackground, false);
|
||||
|
||||
// Leading and trailing offset are gaps from parent window edges
|
||||
// to where the drawer starts.
|
||||
|
@ -483,6 +483,26 @@ static const char *gs_stripedback_xpm[] = {
|
||||
|
||||
wxBitmap gs_stripedback_bmp( wxImage( (const char* const* ) gs_stripedback_xpm ), -1 ) ;
|
||||
|
||||
// make sure we all use one class for all conversions from wx to native colour
|
||||
|
||||
class wxMacCoreGraphicsColour
|
||||
{
|
||||
public:
|
||||
wxMacCoreGraphicsColour();
|
||||
wxMacCoreGraphicsColour(const wxBrush &brush);
|
||||
~wxMacCoreGraphicsColour();
|
||||
|
||||
void Apply( CGContextRef cgContext );
|
||||
protected:
|
||||
void Init();
|
||||
wxMacCFRefHolder<CGColorRef> m_color;
|
||||
wxMacCFRefHolder<CGColorSpaceRef> m_colorSpace;
|
||||
|
||||
bool m_isPattern;
|
||||
wxMacCFRefHolder<CGPatternRef> m_pattern;
|
||||
CGFloat* m_patternColorComponents;
|
||||
} ;
|
||||
|
||||
wxMacCoreGraphicsColour::~wxMacCoreGraphicsColour()
|
||||
{
|
||||
delete[] m_patternColorComponents;
|
||||
@ -519,18 +539,7 @@ wxMacCoreGraphicsColour::wxMacCoreGraphicsColour( const wxBrush &brush )
|
||||
Init();
|
||||
if ( brush.GetStyle() == wxSOLID )
|
||||
{
|
||||
if ( brush.MacGetBrushKind() == kwxMacBrushTheme )
|
||||
{
|
||||
CGColorRef color ;
|
||||
HIThemeBrushCreateCGColor( brush.MacGetTheme(), &color );
|
||||
m_color.Set( color ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
CGFloat components[4] = { brush.GetColour().Red() / 255.0 , brush.GetColour().Green() / 255.0 ,
|
||||
brush.GetColour().Blue() / 255.0 , brush.GetColour().Alpha() / 255.0 } ;
|
||||
m_color.Set( CGColorCreate( wxMacGetGenericRGBColorSpace() , components ) ) ;
|
||||
}
|
||||
m_color.Set( brush.GetColour().CreateCGColor() );
|
||||
}
|
||||
else if ( brush.IsHatch() )
|
||||
{
|
||||
|
@ -30,12 +30,9 @@
|
||||
|
||||
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
{
|
||||
int major, minor;
|
||||
wxColour resultColor;
|
||||
ThemeBrush colorBrushID;
|
||||
|
||||
wxGetOsVersion( &major, &minor );
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case wxSYS_COLOUR_WINDOW:
|
||||
@ -55,17 +52,11 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
break ;
|
||||
|
||||
case wxSYS_COLOUR_LISTBOX :
|
||||
if (major >= 10)
|
||||
resultColor = *wxWHITE ;
|
||||
else
|
||||
resultColor = wxColor( 0xEE, 0xEE, 0xEE );
|
||||
resultColor = *wxWHITE ;
|
||||
break ;
|
||||
|
||||
case wxSYS_COLOUR_BTNSHADOW:
|
||||
if (major >= 10)
|
||||
resultColor = wxColor( 0xBE, 0xBE, 0xBE );
|
||||
else
|
||||
resultColor = wxColor( 0x44, 0x44, 0x44 );
|
||||
resultColor = wxColor( 0xBE, 0xBE, 0xBE );
|
||||
break ;
|
||||
|
||||
case wxSYS_COLOUR_BTNTEXT:
|
||||
@ -85,9 +76,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
#else
|
||||
colorBrushID = kThemeBrushPrimaryHighlightColor;
|
||||
#endif
|
||||
CGColorRef color ;
|
||||
HIThemeBrushCreateCGColor( colorBrushID, &color );
|
||||
resultColor = wxColor( color );
|
||||
resultColor = wxColor( wxMacCreateCGColorFromHITheme(colorBrushID) );
|
||||
}
|
||||
break ;
|
||||
|
||||
@ -110,9 +99,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
resultColor = *wxWHITE ;
|
||||
#else
|
||||
{
|
||||
CGColorRef color ;
|
||||
HIThemeBrushCreateCGColor( kThemeBrushPrimaryHighlightColor, &color );
|
||||
wxColour highlightcolor( color );
|
||||
wxColour highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor) );
|
||||
if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0)
|
||||
resultColor = *wxWHITE ;
|
||||
else
|
||||
|
@ -59,7 +59,7 @@ bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
|
||||
return false;
|
||||
|
||||
if ( parent->MacGetTopLevelWindow()->MacGetMetalAppearance() )
|
||||
MacSetBackgroundBrush( wxNullBrush );
|
||||
SetBackgroundStyle( wxBG_STYLE_TRANSPARENT );
|
||||
|
||||
// normal system font is too tall for fitting into the standard height
|
||||
SetWindowVariant( wxWINDOW_VARIANT_SMALL );
|
||||
|
@ -961,7 +961,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
|
||||
|
||||
DoMacCreateRealWindow( parent, title, pos , size , style , name ) ;
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
SetBackgroundColour(wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)));
|
||||
|
||||
if (GetExtraStyle() & wxFRAME_EX_METAL)
|
||||
MacSetMetalAppearance(true);
|
||||
@ -1063,15 +1063,18 @@ wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
|
||||
return wxPoint(0, 0) ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::MacSetBackgroundBrush( const wxBrush &brush )
|
||||
bool wxTopLevelWindowMac::SetBackgroundColour(const wxColour& col )
|
||||
{
|
||||
wxTopLevelWindowBase::MacSetBackgroundBrush( brush ) ;
|
||||
|
||||
if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT && m_macBackgroundBrush.MacGetBrushKind() == kwxMacBrushTheme )
|
||||
{
|
||||
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macBackgroundBrush.MacGetTheme() , false ) ;
|
||||
}
|
||||
}
|
||||
if ( !wxTopLevelWindowBase::SetBackgroundColour(col) && m_hasBgCol )
|
||||
return false ;
|
||||
|
||||
if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) )
|
||||
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDocumentWindowBackground, false ) ;
|
||||
else if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) )
|
||||
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDialogBackgroundActive, false ) ;
|
||||
// TODO BETTER THEME SUPPORT
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMacInstallTopLevelWindowEventHandler(WindowRef window, EventHandlerRef* handler, void *ref)
|
||||
{
|
||||
|
@ -687,7 +687,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxMacControl::SetBackground( const wxBrush &WXUNUSED(brush) )
|
||||
void wxMacControl::SetBackgroundColour( const wxColour &WXUNUSED(col) )
|
||||
{
|
||||
// TODO
|
||||
// setting up a color proc is not recommended anymore
|
||||
@ -1895,37 +1895,6 @@ OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable )
|
||||
// Quartz Support
|
||||
//
|
||||
|
||||
// snippets from Sketch Sample from Apple :
|
||||
|
||||
#define kGenericRGBProfilePathStr "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
|
||||
|
||||
/*
|
||||
This function locates, opens, and returns the profile reference for the calibrated
|
||||
Generic RGB color space. It is up to the caller to call CMCloseProfile when done
|
||||
with the profile reference this function returns.
|
||||
*/
|
||||
CMProfileRef wxMacOpenGenericProfile()
|
||||
{
|
||||
static CMProfileRef cachedRGBProfileRef = NULL;
|
||||
|
||||
// we only create the profile reference once
|
||||
if (cachedRGBProfileRef == NULL)
|
||||
{
|
||||
CMProfileLocation loc;
|
||||
|
||||
loc.locType = cmPathBasedProfile;
|
||||
strcpy(loc.u.pathLoc.path, kGenericRGBProfilePathStr);
|
||||
|
||||
verify_noerr( CMOpenProfile(&cachedRGBProfileRef, &loc) );
|
||||
}
|
||||
|
||||
// clone the profile reference so that the caller has their own reference, not our cached one
|
||||
if (cachedRGBProfileRef)
|
||||
CMCloneProfileRef(cachedRGBProfileRef);
|
||||
|
||||
return cachedRGBProfileRef;
|
||||
}
|
||||
|
||||
/*
|
||||
Return the generic RGB color space. This is a 'get' function and the caller should
|
||||
not release the returned value unless the caller retains it first. Usually callers
|
||||
@ -1948,6 +1917,13 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace()
|
||||
return genericRGBColorSpace;
|
||||
}
|
||||
|
||||
CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush )
|
||||
{
|
||||
CGColorRef color ;
|
||||
HIThemeBrushCreateCGColor( brush, &color );
|
||||
return color;
|
||||
}
|
||||
|
||||
#ifndef __LP64__
|
||||
|
||||
wxMacPortSaver::wxMacPortSaver( GrafPtr port )
|
||||
|
@ -924,8 +924,6 @@ void wxWindowMac::Init()
|
||||
m_hScrollBarAlwaysShown = false;
|
||||
m_vScrollBarAlwaysShown = false;
|
||||
|
||||
m_macBackgroundBrush = wxNullBrush ;
|
||||
|
||||
m_macIsUserPane = true;
|
||||
m_clipChildren = false ;
|
||||
m_cachedClippedRectValid = false ;
|
||||
@ -1200,28 +1198,11 @@ bool wxWindowMac::SetBackgroundColour(const wxColour& col )
|
||||
if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol )
|
||||
return false ;
|
||||
|
||||
wxBrush brush ;
|
||||
wxColour newCol(GetBackgroundColour());
|
||||
|
||||
if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) )
|
||||
brush.MacSetTheme( kThemeBrushDocumentWindowBackground ) ;
|
||||
else if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) )
|
||||
brush.MacSetTheme( kThemeBrushDialogBackgroundActive ) ;
|
||||
else
|
||||
brush.SetColour( newCol ) ;
|
||||
|
||||
MacSetBackgroundBrush( brush ) ;
|
||||
MacUpdateControlFont() ;
|
||||
m_peer->SetBackgroundColour( col ) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
void wxWindowMac::MacSetBackgroundBrush( const wxBrush &brush )
|
||||
{
|
||||
m_macBackgroundBrush = brush ;
|
||||
m_peer->SetBackground( brush ) ;
|
||||
}
|
||||
|
||||
bool wxWindowMac::MacCanFocus() const
|
||||
{
|
||||
// TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so
|
||||
@ -2315,8 +2296,7 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
|
||||
return ;
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
if ( !m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT
|
||||
|| GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
|
||||
if ( !m_backgroundColour.Ok() || GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
|
||||
{
|
||||
event.Skip() ;
|
||||
}
|
||||
@ -2441,10 +2421,9 @@ void wxWindowMac::MacPaintGrowBox()
|
||||
CGPoint cgpoint = CGPointMake( rect.right - size , rect.bottom - size ) ;
|
||||
CGContextSaveGState( cgContext );
|
||||
|
||||
if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT )
|
||||
if ( m_backgroundColour.Ok() )
|
||||
{
|
||||
wxMacCoreGraphicsColour bkgnd( m_macBackgroundBrush ) ;
|
||||
bkgnd.Apply( cgContext );
|
||||
CGContextSetFillColorWithColor( cgContext, m_backgroundColour.GetCGColor() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user