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