]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: colour.cpp | |
3 | // Purpose: wxColour class | |
37f214d5 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
37f214d5 | 6 | // Created: 10/13/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
37f214d5 DW |
8 | // Copyright: (c) David Webster |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
37f214d5 DW |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
0e320a79 | 14 | |
4fe9efc1 SN |
15 | #ifndef WX_PRECOMP |
16 | #include "wx/colour.h" | |
17 | #endif | |
18 | ||
0e320a79 | 19 | #include "wx/gdicmn.h" |
37f214d5 DW |
20 | #define INCL_GPI |
21 | #define INCL_PM | |
22 | #include<os2.h> | |
0e320a79 | 23 | |
0e320a79 | 24 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) |
0e320a79 DW |
25 | |
26 | // Colour | |
27 | ||
aad6765c | 28 | void wxColour::Init() |
0e320a79 | 29 | { |
aad6765c | 30 | m_bIsInit = false; |
a0606634 DW |
31 | m_vPixel = 0; |
32 | m_cRed = m_cBlue = m_cGreen = 0; | |
aad6765c JS |
33 | } // end of wxColour::Init |
34 | ||
35 | wxColour::wxColour () | |
36 | { | |
37 | Init(); | |
a0606634 | 38 | } // end of wxColour::wxColour |
0e320a79 | 39 | |
a0606634 DW |
40 | wxColour::wxColour ( |
41 | unsigned char cRed | |
42 | , unsigned char cGreen | |
43 | , unsigned char cBlue | |
44 | ) | |
0e320a79 | 45 | { |
aad6765c | 46 | Set(cRed, cGreen, cBlue); |
a0606634 | 47 | } // end of wxColour::wxColour |
0e320a79 | 48 | |
aad6765c | 49 | wxColour::wxColour( |
a0606634 DW |
50 | const wxColour& rCol |
51 | ) | |
0e320a79 | 52 | { |
6d63b094 | 53 | *this = rCol; |
a0606634 | 54 | } // end of wxColour::wxColour |
0e320a79 | 55 | |
a0606634 DW |
56 | wxColour& wxColour::operator =( |
57 | const wxColour& rCol | |
58 | ) | |
0e320a79 | 59 | { |
a0606634 DW |
60 | m_cRed = rCol.m_cRed; |
61 | m_cGreen = rCol.m_cGreen; | |
62 | m_cBlue = rCol.m_cBlue; | |
63 | m_bIsInit = rCol.m_bIsInit; | |
64 | m_vPixel = rCol.m_vPixel; | |
65 | return *this; | |
66 | } // end of wxColour& wxColour::operator = | |
0e320a79 | 67 | |
a0606634 DW |
68 | void wxColour::InitFromName( |
69 | const wxString& sCol | |
70 | ) | |
0e320a79 | 71 | { |
aad6765c | 72 | if ( wxTheColourDatabase ) |
0e320a79 | 73 | { |
aad6765c JS |
74 | wxColour col = wxTheColourDatabase->Find(sCol); |
75 | if ( col.Ok() ) | |
76 | { | |
77 | *this = col; | |
78 | return; | |
79 | } | |
0e320a79 | 80 | } |
aad6765c JS |
81 | |
82 | // leave invalid | |
83 | Init(); | |
84 | ||
a0606634 | 85 | } // end of wxColour::InitFromName |
0e320a79 | 86 | |
aad6765c | 87 | wxColour::~wxColour() |
0e320a79 | 88 | { |
a0606634 | 89 | } // end of wxColour::~wxColour |
0e320a79 | 90 | |
aad6765c | 91 | void wxColour::Set( |
a0606634 DW |
92 | unsigned char cRed |
93 | , unsigned char cGreen | |
94 | , unsigned char cBlue | |
95 | ) | |
0e320a79 | 96 | { |
a0606634 DW |
97 | m_cRed = cRed; |
98 | m_cGreen = cGreen; | |
99 | m_cBlue = cBlue; | |
aad6765c | 100 | m_bIsInit = true; |
26ac77db | 101 | m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue); |
a0606634 | 102 | } // end of wxColour::Set |