*** empty log message ***
[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 #if !USE_SHARED_LIBRARY
21 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
22 #endif
23
24 // Colour
25
26 wxColour::wxColour ()
27 {
28 m_isInit = FALSE;
29 m_pixel = 0;
30 m_red = m_blue = m_green = 0;
31 }
32
33 wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
34 {
35 m_red = r;
36 m_green = g;
37 m_blue = b;
38 m_isInit = TRUE;
39 // m_pixel = PALETTERGB (m_red, m_green, m_blue);
40 }
41
42 wxColour::wxColour (const wxColour& col)
43 {
44 m_red = col.m_red;
45 m_green = col.m_green;
46 m_blue = col.m_blue;
47 m_isInit = col.m_isInit;
48 m_pixel = col.m_pixel;
49 }
50
51 wxColour& wxColour::operator =(const wxColour& col)
52 {
53 m_red = col.m_red;
54 m_green = col.m_green;
55 m_blue = col.m_blue;
56 m_isInit = col.m_isInit;
57 m_pixel = col.m_pixel;
58 return *this;
59 }
60
61 void wxColour::InitFromName(const wxString& col)
62 {
63 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
64 if (the_colour)
65 {
66 m_red = the_colour->Red ();
67 m_green = the_colour->Green ();
68 m_blue = the_colour->Blue ();
69 m_isInit = TRUE;
70 }
71 else
72 {
73 m_red = 0;
74 m_green = 0;
75 m_blue = 0;
76 m_isInit = FALSE;
77 }
78 /* TODO
79 m_pixel = PALETTERGB (m_red, m_green, m_blue);
80 */
81 }
82
83 wxColour::~wxColour ()
84 {
85 }
86
87 void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
88 {
89 m_red = r;
90 m_green = g;
91 m_blue = b;
92 m_isInit = TRUE;
93 /* TODO
94 m_pixel = PALETTERGB (m_red, m_green, m_blue);
95 */
96 }
97
98 // Obsolete
99 #if WXWIN_COMPATIBILITY
100 void wxColour::Get (unsigned char *r, unsigned char *g, unsigned char *b) const
101 {
102 *r = m_red;
103 *g = m_green;
104 *b = m_blue;
105 }
106 #endif
107