]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/mgl/colour.cpp | |
3 | // Purpose: wxColour class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
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" | |
20 | #include "wx/colour.h" | |
21 | ||
22 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) | |
23 | ||
24 | // Colour | |
25 | ||
26 | void wxColour::Init() | |
27 | { | |
28 | m_red = | |
29 | m_blue = | |
30 | m_green = 0; | |
31 | m_isInit = false; | |
32 | } | |
33 | ||
34 | wxColour::wxColour() | |
35 | { | |
36 | Init(); | |
37 | } | |
38 | ||
39 | wxColour::wxColour(const wxColour& col) | |
40 | { | |
41 | *this = col; | |
42 | } | |
43 | ||
44 | wxColour& wxColour::operator =(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 | return *this; | |
51 | } | |
52 | ||
53 | void wxColour::InitFromName(const wxString& name) | |
54 | { | |
55 | if ( wxTheColourDatabase ) | |
56 | { | |
57 | wxColour col = wxTheColourDatabase->Find(name); | |
58 | if ( col.Ok() ) | |
59 | { | |
60 | *this = col; | |
61 | return; | |
62 | } | |
63 | } | |
64 | ||
65 | // leave invalid | |
66 | Init(); | |
67 | } | |
68 | ||
69 | wxColour::~wxColour() | |
70 | { | |
71 | } | |
72 | ||
73 | void wxColour::Set(unsigned char r, unsigned char g, unsigned char b) | |
74 | { | |
75 | m_red = r; | |
76 | m_green = g; | |
77 | m_blue = b; | |
78 | m_isInit = true; | |
79 | } |