]>
Commit | Line | Data |
---|---|---|
32b8ec41 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: colour.cpp | |
3 | // Purpose: wxColour class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
e3a1e3e0 | 8 | // Copyright: (c) Julian Smart |
32b8ec41 VZ |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "colour.h" | |
14 | #endif | |
15 | ||
16 | // For compilers that support precompilation, includes "wx.h". | |
17 | #include "wx/wxprec.h" | |
18 | ||
19 | #ifdef __BORLANDC__ | |
20 | #pragma hdrstop | |
21 | #endif | |
22 | ||
23 | #include "wx/gdicmn.h" | |
c3d15542 | 24 | #include "wx/colour.h" |
32b8ec41 VZ |
25 | |
26 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) | |
27 | ||
28 | // Colour | |
29 | ||
30 | wxColour::wxColour() | |
31 | { | |
32 | m_red = m_blue = m_green = 0; | |
33 | m_isInit = FALSE; | |
34 | } | |
35 | ||
36 | wxColour::wxColour(unsigned char r, unsigned char g, unsigned char b) | |
37 | { | |
38 | m_red = r; | |
39 | m_green = g; | |
40 | m_blue = b; | |
41 | m_isInit = TRUE; | |
42 | } | |
43 | ||
44 | wxColour::wxColour(const wxColour& col) | |
45 | { | |
46 | m_red = col.m_red; | |
47 | m_green = col.m_green; | |
48 | m_blue = col.m_blue; | |
49 | m_isInit = col.m_isInit; | |
50 | } | |
51 | ||
52 | wxColour& wxColour::operator =(const wxColour& col) | |
53 | { | |
54 | m_red = col.m_red; | |
55 | m_green = col.m_green; | |
56 | m_blue = col.m_blue; | |
57 | m_isInit = col.m_isInit; | |
58 | return *this; | |
59 | } | |
60 | ||
61 | void wxColour::InitFromName(const wxString& col) | |
62 | { | |
63 | wxColour *the_colour = wxTheColourDatabase->FindColour (col); | |
64 | if (the_colour) | |
65 | { | |
66 | m_red = the_colour->Red(); | |
67 | m_green = the_colour->Green(); | |
68 | m_blue = the_colour->Blue(); | |
69 | m_isInit = TRUE; | |
70 | } | |
71 | else | |
72 | { | |
73 | m_red = 0; | |
74 | m_green = 0; | |
75 | m_blue = 0; | |
76 | m_isInit = FALSE; | |
77 | } | |
78 | } | |
79 | ||
80 | wxColour::~wxColour() | |
81 | { | |
82 | } | |
83 | ||
84 | void wxColour::Set(unsigned char r, unsigned char g, unsigned char b) | |
85 | { | |
86 | m_red = r; | |
87 | m_green = g; | |
88 | m_blue = b; | |
89 | m_isInit = TRUE; | |
90 | } | |
91 | ||
92 | // Obsolete | |
93 | #if WXWIN_COMPATIBILITY | |
94 | void wxColour::Get(unsigned char *r, unsigned char *g, unsigned char *b) const | |
95 | { | |
96 | *r = m_red; | |
97 | *g = m_green; | |
98 | *b = m_blue; | |
99 | } | |
100 | #endif | |
101 |