]> git.saurik.com Git - wxWidgets.git/blame - src/os2/colour.cpp
Removing makegen and projgen, part #1: removing references
[wxWidgets.git] / src / os2 / colour.cpp
CommitLineData
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 24IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
0e320a79
DW
25
26// Colour
27
28wxColour::wxColour ()
29{
a0606634
DW
30 m_bIsInit = FALSE;
31 m_vPixel = 0;
32 m_cRed = m_cBlue = m_cGreen = 0;
33} // end of wxColour::wxColour
0e320a79 34
a0606634
DW
35wxColour::wxColour (
36 unsigned char cRed
37, unsigned char cGreen
38, unsigned char cBlue
39)
0e320a79 40{
a0606634
DW
41 m_cRed = cRed;
42 m_cGreen = cGreen;
43 m_cBlue = cBlue;
44 m_bIsInit = TRUE;
26ac77db 45 m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue);
a0606634 46} // end of wxColour::wxColour
0e320a79 47
a0606634
DW
48wxColour::wxColour (
49 const wxColour& rCol
50)
0e320a79 51{
a0606634
DW
52 m_cRed = rCol.m_cRed;
53 m_cGreen = rCol.m_cGreen;
54 m_cBlue = rCol.m_cBlue;
55 m_bIsInit = rCol.m_bIsInit;
56 m_vPixel = rCol.m_vPixel;
57} // end of wxColour::wxColour
0e320a79 58
a0606634
DW
59wxColour& wxColour::operator =(
60 const wxColour& rCol
61)
0e320a79 62{
a0606634
DW
63 m_cRed = rCol.m_cRed;
64 m_cGreen = rCol.m_cGreen;
65 m_cBlue = rCol.m_cBlue;
66 m_bIsInit = rCol.m_bIsInit;
67 m_vPixel = rCol.m_vPixel;
68 return *this;
69} // end of wxColour& wxColour::operator =
0e320a79 70
a0606634
DW
71void wxColour::InitFromName(
72 const wxString& sCol
73)
0e320a79 74{
a0606634
DW
75 wxColour* pTheColour = wxTheColourDatabase->FindColour(sCol);
76
77 if (pTheColour)
0e320a79 78 {
a0606634
DW
79 m_cRed = pTheColour->Red();
80 m_cGreen = pTheColour->Green();
81 m_cBlue = pTheColour->Blue();
82 m_bIsInit = TRUE;
0e320a79
DW
83 }
84 else
85 {
a0606634
DW
86 m_cRed = 0;
87 m_cGreen = 0;
88 m_cBlue = 0;
89 m_bIsInit = FALSE;
0e320a79 90 }
26ac77db 91 m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue);
a0606634 92} // end of wxColour::InitFromName
0e320a79
DW
93
94wxColour::~wxColour ()
95{
a0606634 96} // end of wxColour::~wxColour
0e320a79 97
a0606634
DW
98void wxColour::Set (
99 unsigned char cRed
100, unsigned char cGreen
101, unsigned char cBlue
102)
0e320a79 103{
a0606634
DW
104 m_cRed = cRed;
105 m_cGreen = cGreen;
106 m_cBlue = cBlue;
107 m_bIsInit = TRUE;
26ac77db 108 m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue);
a0606634 109} // end of wxColour::Set