]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/colour.cpp
Clean up indentation / tabs from previous patch
[wxWidgets.git] / src / mgl / colour.cpp
CommitLineData
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
14f355c2 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
32b8ec41
VZ
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
26IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
27
28// Colour
29
564a150b 30void wxColour::Init()
32b8ec41 31{
564a150b
VZ
32 m_red =
33 m_blue =
34 m_green = 0;
aad6765c 35 m_isInit = false;
32b8ec41
VZ
36}
37
1c53456f
VS
38wxColour::wxColour()
39{
40 Init();
41}
42
32b8ec41
VZ
43wxColour::wxColour(const wxColour& col)
44{
564a150b 45 *this = col;
32b8ec41
VZ
46}
47
48wxColour& wxColour::operator =(const wxColour& col)
49{
564a150b
VZ
50 m_red = col.m_red;
51 m_green = col.m_green;
52 m_blue = col.m_blue;
53 m_isInit = col.m_isInit;
54 return *this;
32b8ec41
VZ
55}
56
564a150b 57void wxColour::InitFromName(const wxString& name)
32b8ec41 58{
aad6765c 59 if ( wxTheColourDatabase )
32b8ec41 60 {
aad6765c
JS
61 wxColour col = wxTheColourDatabase->Find(name);
62 if ( col.Ok() )
63 {
64 *this = col;
65 return;
66 }
32b8ec41 67 }
aad6765c
JS
68
69 // leave invalid
70 Init();
32b8ec41
VZ
71}
72
73wxColour::~wxColour()
74{
75}
76
77void wxColour::Set(unsigned char r, unsigned char g, unsigned char b)
78{
564a150b
VZ
79 m_red = r;
80 m_green = g;
81 m_blue = b;
aad6765c 82 m_isInit = true;
32b8ec41 83}