]> git.saurik.com Git - wxWidgets.git/blame - src/os2/colour.cpp
fixed incorrect GetTextExtent for wxTELETYPE font
[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
DW
14
15#include "wx/gdicmn.h"
37f214d5
DW
16#define INCL_GPI
17#define INCL_PM
18#include<os2.h>
0e320a79 19
0e320a79 20IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
0e320a79
DW
21
22// Colour
23
24wxColour::wxColour ()
25{
a0606634
DW
26 m_bIsInit = FALSE;
27 m_vPixel = 0;
28 m_cRed = m_cBlue = m_cGreen = 0;
29} // end of wxColour::wxColour
0e320a79 30
a0606634
DW
31wxColour::wxColour (
32 unsigned char cRed
33, unsigned char cGreen
34, unsigned char cBlue
35)
0e320a79 36{
a0606634
DW
37 m_cRed = cRed;
38 m_cGreen = cGreen;
39 m_cBlue = cBlue;
40 m_bIsInit = TRUE;
41 m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
42} // end of wxColour::wxColour
0e320a79 43
a0606634
DW
44wxColour::wxColour (
45 const wxColour& rCol
46)
0e320a79 47{
a0606634
DW
48 m_cRed = rCol.m_cRed;
49 m_cGreen = rCol.m_cGreen;
50 m_cBlue = rCol.m_cBlue;
51 m_bIsInit = rCol.m_bIsInit;
52 m_vPixel = rCol.m_vPixel;
53} // end of wxColour::wxColour
0e320a79 54
a0606634
DW
55wxColour& wxColour::operator =(
56 const wxColour& rCol
57)
0e320a79 58{
a0606634
DW
59 m_cRed = rCol.m_cRed;
60 m_cGreen = rCol.m_cGreen;
61 m_cBlue = rCol.m_cBlue;
62 m_bIsInit = rCol.m_bIsInit;
63 m_vPixel = rCol.m_vPixel;
64 return *this;
65} // end of wxColour& wxColour::operator =
0e320a79 66
a0606634
DW
67void wxColour::InitFromName(
68 const wxString& sCol
69)
0e320a79 70{
a0606634
DW
71 wxColour* pTheColour = wxTheColourDatabase->FindColour(sCol);
72
73 if (pTheColour)
0e320a79 74 {
a0606634
DW
75 m_cRed = pTheColour->Red();
76 m_cGreen = pTheColour->Green();
77 m_cBlue = pTheColour->Blue();
78 m_bIsInit = TRUE;
0e320a79
DW
79 }
80 else
81 {
a0606634
DW
82 m_cRed = 0;
83 m_cGreen = 0;
84 m_cBlue = 0;
85 m_bIsInit = FALSE;
0e320a79 86 }
a0606634
DW
87 m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
88} // end of wxColour::InitFromName
0e320a79
DW
89
90wxColour::~wxColour ()
91{
a0606634 92} // end of wxColour::~wxColour
0e320a79 93
a0606634
DW
94void wxColour::Set (
95 unsigned char cRed
96, unsigned char cGreen
97, unsigned char cBlue
98)
0e320a79 99{
a0606634
DW
100 m_cRed = cRed;
101 m_cGreen = cGreen;
102 m_cBlue = cBlue;
103 m_bIsInit = TRUE;
104 m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
105} // end of wxColour::Set
37f214d5 106
a0606634 107//
37f214d5 108// Obsolete
a0606634 109//
37f214d5 110#if WXWIN_COMPATIBILITY
a0606634
DW
111void wxColour::Get (
112 unsigned char* pRed
113, unsigned char* pGreen
114, unsigned char* pBlue
115) const
37f214d5 116{
a0606634
DW
117 *Red = m_cRed;
118 *Green = m_cGreen;
119 *Blue = m_cBlue;
120} // end of wxColour::Get
37f214d5
DW
121#endif
122