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