]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "colour.h"
16 #include "wx/gdicmn.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class wxColourRefData
: public wxObjectRefData
26 wxColourRefData(void);
27 ~wxColourRefData(void);
28 void FreeColour(void);
35 wxColourRefData::wxColourRefData(void)
40 wxColourRefData::~wxColourRefData(void)
45 void wxColourRefData::FreeColour(void)
49 //-----------------------------------------------------------------------------
51 #define M_COLDATA ((wxColourRefData *)m_refData)
53 #define SHIFT (8*(sizeof(short int)-sizeof(char)))
55 IMPLEMENT_DYNAMIC_CLASS(wxColour
,wxGDIObject
)
57 wxColour::wxColour(void)
61 wxColour::wxColour( char WXUNUSED(red
), char WXUNUSED(green
), char WXUNUSED(blue
) )
63 m_refData
= new wxColourRefData();
66 wxColour::wxColour( const wxString
&colourName
)
69 if ( (wxTheColourDatabase
) && (node
= wxTheColourDatabase
->Find(colourName
)) )
71 wxColour
*col
= (wxColour
*)node
->Data();
77 m_refData
= new wxColourRefData();
81 wxColour::wxColour( const wxColour
& col
)
86 wxColour::wxColour( const wxColour
* col
)
91 wxColour::~wxColour(void)
95 wxColour
& wxColour::operator = ( const wxColour
& col
)
97 if (*this == col
) return (*this);
102 wxColour
& wxColour::operator = ( const wxString
& colourName
)
106 if ((wxTheColourDatabase
) && (node
= wxTheColourDatabase
->Find(colourName
)) )
108 wxColour
*col
= (wxColour
*)node
->Data();
109 if (col
) Ref( *col
);
113 m_refData
= new wxColourRefData();
118 bool wxColour::operator == ( const wxColour
& col
)
120 return m_refData
== col
.m_refData
;
123 bool wxColour::operator != ( const wxColour
& col
)
125 return m_refData
!= col
.m_refData
;
128 void wxColour::Set( const unsigned char WXUNUSED(red
), const unsigned char WXUNUSED(green
),
129 const unsigned char WXUNUSED(blue
) )
132 m_refData
= new wxColourRefData();
135 unsigned char wxColour::Red(void) const
141 unsigned char wxColour::Green(void) const
147 unsigned char wxColour::Blue(void) const
153 bool wxColour::Ok(void) const
159 int wxColour::GetPixel(void)