]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/colour.cpp
added test for writing empty value to the config
[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 and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
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
25 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
26
27 // Colour
28
29 wxColour::wxColour()
30 {
31 m_red = m_blue = m_green = 0;
32 m_isInit = FALSE;
33 }
34
35 wxColour::wxColour(unsigned char r, unsigned char g, unsigned char b)
36 {
37 m_red = r;
38 m_green = g;
39 m_blue = b;
40 m_isInit = TRUE;
41 }
42
43 wxColour::wxColour(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 }
50
51 wxColour& wxColour::operator =(const wxColour& col)
52 {
53 m_red = col.m_red;
54 m_green = col.m_green;
55 m_blue = col.m_blue;
56 m_isInit = col.m_isInit;
57 return *this;
58 }
59
60 void wxColour::InitFromName(const wxString& col)
61 {
62 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
63 if (the_colour)
64 {
65 m_red = the_colour->Red();
66 m_green = the_colour->Green();
67 m_blue = the_colour->Blue();
68 m_isInit = TRUE;
69 }
70 else
71 {
72 m_red = 0;
73 m_green = 0;
74 m_blue = 0;
75 m_isInit = FALSE;
76 }
77 }
78
79 wxColour::~wxColour()
80 {
81 }
82
83 void wxColour::Set(unsigned char r, unsigned char g, unsigned char b)
84 {
85 m_red = r;
86 m_green = g;
87 m_blue = b;
88 m_isInit = TRUE;
89 }
90
91 // Obsolete
92 #if WXWIN_COMPATIBILITY
93 void wxColour::Get(unsigned char *r, unsigned char *g, unsigned char *b) const
94 {
95 *r = m_red;
96 *g = m_green;
97 *b = m_blue;
98 }
99 #endif
100