]> git.saurik.com Git - wxWidgets.git/blob - src/os2/colour.cpp
fix for generating set/kill focus events for wxRadioBox (also fixes TABbing in a...
[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 wxColour::wxColour ()
29 {
30 m_bIsInit = FALSE;
31 m_vPixel = 0;
32 m_cRed = m_cBlue = m_cGreen = 0;
33 } // end of wxColour::wxColour
34
35 wxColour::wxColour (
36 unsigned char cRed
37 , unsigned char cGreen
38 , unsigned char cBlue
39 )
40 {
41 m_cRed = cRed;
42 m_cGreen = cGreen;
43 m_cBlue = cBlue;
44 m_bIsInit = TRUE;
45 m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue);
46 } // end of wxColour::wxColour
47
48 wxColour::wxColour (
49 const wxColour& rCol
50 )
51 {
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
58
59 wxColour& wxColour::operator =(
60 const wxColour& rCol
61 )
62 {
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 =
70
71 void wxColour::InitFromName(
72 const wxString& sCol
73 )
74 {
75 wxColour* pTheColour = wxTheColourDatabase->FindColour(sCol);
76
77 if (pTheColour)
78 {
79 m_cRed = pTheColour->Red();
80 m_cGreen = pTheColour->Green();
81 m_cBlue = pTheColour->Blue();
82 m_bIsInit = TRUE;
83 }
84 else
85 {
86 m_cRed = 0;
87 m_cGreen = 0;
88 m_cBlue = 0;
89 m_bIsInit = FALSE;
90 }
91 m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue);
92 } // end of wxColour::InitFromName
93
94 wxColour::~wxColour ()
95 {
96 } // end of wxColour::~wxColour
97
98 void wxColour::Set (
99 unsigned char cRed
100 , unsigned char cGreen
101 , unsigned char cBlue
102 )
103 {
104 m_cRed = cRed;
105 m_cGreen = cGreen;
106 m_cBlue = cBlue;
107 m_bIsInit = TRUE;
108 m_vPixel = OS2RGB (m_cRed, m_cGreen, m_cBlue);
109 } // end of wxColour::Set