]> git.saurik.com Git - wxWidgets.git/blob - src/qt/colour.cpp
More configure fixes
[wxWidgets.git] / src / qt / colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: colour.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11
12 #ifdef __GNUG__
13 #pragma implementation "colour.h"
14 #endif
15
16 #include "wx/gdicmn.h"
17
18 //-----------------------------------------------------------------------------
19 // wxColour
20 //-----------------------------------------------------------------------------
21
22 class wxColourRefData: public wxObjectRefData
23 {
24 public:
25
26 wxColourRefData(void);
27 ~wxColourRefData(void);
28 void FreeColour(void);
29
30 bool m_hasPixel;
31
32 friend wxColour;
33 };
34
35 wxColourRefData::wxColourRefData(void)
36 {
37 m_hasPixel = FALSE;
38 };
39
40 wxColourRefData::~wxColourRefData(void)
41 {
42 FreeColour();
43 };
44
45 void wxColourRefData::FreeColour(void)
46 {
47 };
48
49 //-----------------------------------------------------------------------------
50
51 #define M_COLDATA ((wxColourRefData *)m_refData)
52
53 #define SHIFT (8*(sizeof(short int)-sizeof(char)))
54
55 IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
56
57 wxColour::wxColour(void)
58 {
59 };
60
61 wxColour::wxColour( char WXUNUSED(red), char WXUNUSED(green), char WXUNUSED(blue) )
62 {
63 m_refData = new wxColourRefData();
64 };
65
66 wxColour::wxColour( const wxString &colourName )
67 {
68 wxNode *node = NULL;
69 if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
70 {
71 wxColour *col = (wxColour*)node->Data();
72 UnRef();
73 if (col) Ref( *col );
74 }
75 else
76 {
77 m_refData = new wxColourRefData();
78 };
79 };
80
81 wxColour::wxColour( const wxColour& col )
82 {
83 Ref( col );
84 };
85
86 wxColour::wxColour( const wxColour* col )
87 {
88 if (col) Ref( *col );
89 };
90
91 wxColour::~wxColour(void)
92 {
93 };
94
95 wxColour& wxColour::operator = ( const wxColour& col )
96 {
97 if (*this == col) return (*this);
98 Ref( col );
99 return *this;
100 };
101
102 wxColour& wxColour::operator = ( const wxString& colourName )
103 {
104 UnRef();
105 wxNode *node = NULL;
106 if ((wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
107 {
108 wxColour *col = (wxColour*)node->Data();
109 if (col) Ref( *col );
110 }
111 else
112 {
113 m_refData = new wxColourRefData();
114 };
115 return *this;
116 };
117
118 bool wxColour::operator == ( const wxColour& col )
119 {
120 return m_refData == col.m_refData;
121 };
122
123 bool wxColour::operator != ( const wxColour& col)
124 {
125 return m_refData != col.m_refData;
126 };
127
128 void wxColour::Set( const unsigned char WXUNUSED(red), const unsigned char WXUNUSED(green),
129 const unsigned char WXUNUSED(blue) )
130 {
131 UnRef();
132 m_refData = new wxColourRefData();
133 };
134
135 unsigned char wxColour::Red(void) const
136 {
137 if (!Ok()) return 0;
138 return 0;
139 };
140
141 unsigned char wxColour::Green(void) const
142 {
143 if (!Ok()) return 0;
144 return 0;
145 };
146
147 unsigned char wxColour::Blue(void) const
148 {
149 if (!Ok()) return 0;
150 return 0;
151 };
152
153 bool wxColour::Ok(void) const
154 {
155 return (m_refData);
156 return 0;
157 };
158
159 int wxColour::GetPixel(void)
160 {
161 if (!Ok()) return 0;
162 return 0;
163 };
164