1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxColour class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #import <AppKit/NSColor.h>
14 #include "wx/gdicmn.h"
15 #include "wx/colour.h"
17 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
20 : m_cocoaNSColor(NULL)
22 m_red = m_blue = m_green = 0;
25 wxColour::wxColour (const wxColour& col)
26 : m_cocoaNSColor(col.m_cocoaNSColor)
28 , m_green(col.m_green)
31 [m_cocoaNSColor retain];
34 wxColour& wxColour::operator =(const wxColour& col)
36 m_cocoaNSColor = col.m_cocoaNSColor;
38 m_green = col.m_green;
40 [m_cocoaNSColor retain];
44 void wxColour::InitFromName(const wxString& col)
46 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
53 [m_cocoaNSColor release];
54 m_cocoaNSColor = NULL;
61 wxColour::~wxColour ()
63 [m_cocoaNSColor release];
66 void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
68 [m_cocoaNSColor release];
69 m_cocoaNSColor = [[NSColor colorWithCalibratedRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] retain];