]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/colour.cpp
[ 835171 ] Show hidden files in wxGenericDirCtrl
[wxWidgets.git] / src / mgl / colour.cpp
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$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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"
24 #include "wx/colour.h"
25
26 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
27
28 // Colour
29
30 void wxColour::Init()
31 {
32 m_red =
33 m_blue =
34 m_green = 0;
35 m_isInit = false;
36 }
37
38 wxColour::wxColour(const wxColour& col)
39 {
40 *this = col;
41 }
42
43 wxColour& wxColour::operator =(const wxColour& col)
44 {
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 return *this;
50 }
51
52 void wxColour::InitFromName(const wxString& name)
53 {
54 if ( wxTheColourDatabase )
55 {
56 wxColour col = wxTheColourDatabase->Find(name);
57 if ( col.Ok() )
58 {
59 *this = col;
60 return;
61 }
62 }
63
64 // leave invalid
65 Init();
66 }
67
68 wxColour::~wxColour()
69 {
70 }
71
72 void wxColour::Set(unsigned char r, unsigned char g, unsigned char b)
73 {
74 m_red = r;
75 m_green = g;
76 m_blue = b;
77 m_isInit = true;
78 }