]>
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 |
65571936 | 9 | // Licence: wxWindows licence |
32b8ec41 VZ |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
32b8ec41 VZ |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifdef __BORLANDC__ | |
16 | #pragma hdrstop | |
17 | #endif | |
18 | ||
19 | #include "wx/gdicmn.h" | |
c3d15542 | 20 | #include "wx/colour.h" |
32b8ec41 VZ |
21 | |
22 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) | |
23 | ||
24 | // Colour | |
25 | ||
564a150b | 26 | void wxColour::Init() |
32b8ec41 | 27 | { |
564a150b VZ |
28 | m_red = |
29 | m_blue = | |
30 | m_green = 0; | |
aad6765c | 31 | m_isInit = false; |
32b8ec41 VZ |
32 | } |
33 | ||
1c53456f VS |
34 | wxColour::wxColour() |
35 | { | |
36 | Init(); | |
37 | } | |
38 | ||
32b8ec41 VZ |
39 | wxColour::wxColour(const wxColour& col) |
40 | { | |
564a150b | 41 | *this = col; |
32b8ec41 VZ |
42 | } |
43 | ||
44 | wxColour& wxColour::operator =(const wxColour& col) | |
45 | { | |
564a150b VZ |
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 | return *this; | |
32b8ec41 VZ |
51 | } |
52 | ||
564a150b | 53 | void wxColour::InitFromName(const wxString& name) |
32b8ec41 | 54 | { |
aad6765c | 55 | if ( wxTheColourDatabase ) |
32b8ec41 | 56 | { |
aad6765c JS |
57 | wxColour col = wxTheColourDatabase->Find(name); |
58 | if ( col.Ok() ) | |
59 | { | |
60 | *this = col; | |
61 | return; | |
62 | } | |
32b8ec41 | 63 | } |
aad6765c JS |
64 | |
65 | // leave invalid | |
66 | Init(); | |
32b8ec41 VZ |
67 | } |
68 | ||
69 | wxColour::~wxColour() | |
70 | { | |
71 | } | |
72 | ||
73 | void wxColour::Set(unsigned char r, unsigned char g, unsigned char b) | |
74 | { | |
564a150b VZ |
75 | m_red = r; |
76 | m_green = g; | |
77 | m_blue = b; | |
aad6765c | 78 | m_isInit = true; |
32b8ec41 | 79 | } |