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