]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: colour.cpp | |
01b2eeec KB |
3 | // Purpose: wxColour class |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
7c78e7c7 RR |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
7c78e7c7 RR |
12 | #ifdef __GNUG__ |
13 | #pragma implementation "colour.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/gdicmn.h" | |
01b2eeec | 17 | #include "wx/colour.h" |
7c78e7c7 | 18 | |
01b2eeec | 19 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) |
7c78e7c7 | 20 | |
01b2eeec | 21 | // Colour |
7c78e7c7 | 22 | |
01b2eeec | 23 | wxColour::wxColour () |
7c78e7c7 | 24 | { |
01b2eeec KB |
25 | m_isInit = FALSE; |
26 | m_red = m_blue = m_green = 0; | |
27 | /* TODO | |
28 | m_pixel = 0; | |
29 | */ | |
30 | } | |
31 | ||
32 | wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b) | |
7c78e7c7 | 33 | { |
01b2eeec KB |
34 | m_red = r; |
35 | m_green = g; | |
36 | m_blue = b; | |
37 | m_isInit = TRUE; | |
38 | /* TODO | |
39 | m_pixel = PALETTERGB (m_red, m_green, m_blue); | |
40 | */ | |
41 | } | |
42 | ||
43 | wxColour::wxColour (const wxColour& col) | |
7c78e7c7 | 44 | { |
01b2eeec KB |
45 | m_red = col.m_red; |
46 | m_green = col.m_green; | |
47 | m_blue = col.m_blue; | |
48 | m_isInit = col.m_isInit; | |
49 | /* TODO | |
50 | m_pixel = col.m_pixel; | |
51 | */ | |
52 | } | |
53 | ||
54 | wxColour& wxColour::operator =(const wxColour& col) | |
7c78e7c7 | 55 | { |
01b2eeec KB |
56 | m_red = col.m_red; |
57 | m_green = col.m_green; | |
58 | m_blue = col.m_blue; | |
59 | m_isInit = col.m_isInit; | |
60 | /* TODO | |
61 | m_pixel = col.m_pixel; | |
62 | */ | |
63 | return *this; | |
64 | } | |
65 | ||
66 | wxColour::wxColour (const wxString& col) | |
7c78e7c7 | 67 | { |
01b2eeec KB |
68 | wxColour *the_colour = wxTheColourDatabase->FindColour (col); |
69 | if (the_colour) | |
70 | { | |
71 | m_red = the_colour->Red (); | |
72 | m_green = the_colour->Green (); | |
73 | m_blue = the_colour->Blue (); | |
74 | m_isInit = TRUE; | |
75 | } | |
76 | else | |
77 | { | |
78 | m_red = 0; | |
79 | m_green = 0; | |
80 | m_blue = 0; | |
81 | m_isInit = FALSE; | |
82 | } | |
83 | /* TODO | |
84 | m_pixel = PALETTERGB (m_red, m_green, m_blue); | |
85 | */ | |
86 | } | |
87 | ||
88 | wxColour::~wxColour () | |
7c78e7c7 | 89 | { |
01b2eeec | 90 | } |
7c78e7c7 | 91 | |
01b2eeec | 92 | wxColour& wxColour::operator = (const wxString& col) |
7c78e7c7 | 93 | { |
01b2eeec KB |
94 | wxColour *the_colour = wxTheColourDatabase->FindColour (col); |
95 | if (the_colour) | |
96 | { | |
97 | m_red = the_colour->Red (); | |
98 | m_green = the_colour->Green (); | |
99 | m_blue = the_colour->Blue (); | |
100 | m_isInit = TRUE; | |
101 | } | |
102 | else | |
103 | { | |
104 | m_red = 0; | |
105 | m_green = 0; | |
106 | m_blue = 0; | |
107 | m_isInit = FALSE; | |
108 | } | |
109 | /* TODO | |
110 | m_pixel = PALETTERGB (m_red, m_green, m_blue); | |
111 | */ | |
112 | return (*this); | |
113 | } | |
114 | ||
115 | void wxColour::Set (unsigned char r, unsigned char g, unsigned char b) | |
7c78e7c7 | 116 | { |
01b2eeec KB |
117 | m_red = r; |
118 | m_green = g; | |
119 | m_blue = b; | |
120 | m_isInit = TRUE; | |
121 | /* TODO | |
122 | m_pixel = PALETTERGB (m_red, m_green, m_blue); | |
123 | */ | |
124 | } |