// Created: 2003/08/02
// RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#include "wx/colour.h"
#endif //WX_PRECOMP
+#include "wx/cocoa/ObjcRef.h"
+
#import <AppKit/NSColor.h>
// ========================================================================
// ========================================================================
class WXDLLEXPORT wxPenRefData: public wxGDIRefData
{
- friend class WXDLLEXPORT wxPen;
public:
wxPenRefData(const wxColour& colour = wxNullColour,
int width = 1, int style = wxSOLID,
static const CGFloat scm_patternShortDash[];
static const int scm_countDotDash;
static const CGFloat scm_patternDotDash[];
+
+ friend class WXDLLIMPEXP_FWD_CORE wxPen;
+
private:
// Don't allow assignment
wxPenRefData& operator=(const wxPenRefData& data);
m_nbDash = data.m_nbDash;
m_dash = data.m_dash;
m_stipple = data.m_stipple;
- m_cocoaNSColor = [data.m_cocoaNSColor retain];
+ m_cocoaNSColor = wxGCSafeRetain(data.m_cocoaNSColor);
m_cocoaDash = NULL;
}
inline void wxPenRefData::FreeCocoaNSColor()
{
- [m_cocoaNSColor release];
+ wxGCSafeRelease(m_cocoaNSColor);
m_cocoaNSColor = nil;
}
switch( m_style )
{
case wxTRANSPARENT:
- m_cocoaNSColor = [[NSColor clearColor] retain];
+ m_cocoaNSColor = wxGCSafeRetain([NSColor clearColor]);
break;
case wxSTIPPLE:
// wxBitmap isn't implemented yet
if(!colour_NSColor)
colour_NSColor = [NSColor clearColor];
m_cocoaNSColor = [colour_NSColor copyWithZone:nil];
+ [wxGCSafeRetain(m_cocoaNSColor) release]; // retain in GC. no change in RR.
break;
}
}
m_refData = new wxPenRefData(wxNullColour,width,wxSTIPPLE,stipple);
}
-wxObjectRefData *wxPen::CreateRefData() const
+wxGDIRefData *wxPen::CreateGDIRefData() const
{
return new wxPenRefData;
}
-wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const
+wxGDIRefData *wxPen::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxPenRefData(*(wxPenRefData *)data);
}
M_PENDATA->SetStipple(Stipple);
}
-wxColour& wxPen::GetColour() const
+wxColour wxPen::GetColour() const
{
return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour);
}