]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/colour.cpp
Warning fix.
[wxWidgets.git] / src / mgl / colour.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: src/mgl/colour.cpp
32b8ec41
VZ
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
edc536d3 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
22IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
23
24// Colour
25
564a150b 26void 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
34wxColour::wxColour()
35{
36 Init();
37}
38
32b8ec41
VZ
39wxColour::wxColour(const wxColour& col)
40{
564a150b 41 *this = col;
32b8ec41
VZ
42}
43
44wxColour& 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 53void 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
69wxColour::~wxColour()
70{
71}
72
73void 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}