]> git.saurik.com Git - wxWidgets.git/blob - src/os2/colour.cpp
makefile enhancements for dll, ne wxwindll.ics for VA 4.0 dll
[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_isInit = FALSE;
27 m_pixel = 0;
28 m_red = m_blue = m_green = 0;
29 }
30
31 wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
32 {
33 m_red = r;
34 m_green = g;
35 m_blue = b;
36 m_isInit = TRUE;
37 // m_pixel = PALETTERGB (m_red, m_green, m_blue);
38 }
39
40 wxColour::wxColour (const wxColour& col)
41 {
42 m_red = col.m_red;
43 m_green = col.m_green;
44 m_blue = col.m_blue;
45 m_isInit = col.m_isInit;
46 m_pixel = col.m_pixel;
47 }
48
49 wxColour& wxColour::operator =(const wxColour& col)
50 {
51 m_red = col.m_red;
52 m_green = col.m_green;
53 m_blue = col.m_blue;
54 m_isInit = col.m_isInit;
55 m_pixel = col.m_pixel;
56 return *this;
57 }
58
59 void wxColour::InitFromName(const wxString& col)
60 {
61 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
62 if (the_colour)
63 {
64 m_red = the_colour->Red ();
65 m_green = the_colour->Green ();
66 m_blue = the_colour->Blue ();
67 m_isInit = TRUE;
68 }
69 else
70 {
71 m_red = 0;
72 m_green = 0;
73 m_blue = 0;
74 m_isInit = FALSE;
75 }
76 /* TODO
77 m_pixel = PALETTERGB (m_red, m_green, m_blue);
78 */
79 }
80
81 wxColour::~wxColour ()
82 {
83 }
84
85 void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
86 {
87 m_red = r;
88 m_green = g;
89 m_blue = b;
90 m_isInit = TRUE;
91 /* TODO
92 m_pixel = PALETTERGB (m_red, m_green, m_blue);
93 */
94 }
95
96 // Obsolete
97 #if WXWIN_COMPATIBILITY
98 void wxColour::Get (unsigned char *r, unsigned char *g, unsigned char *b) const
99 {
100 *r = m_red;
101 *g = m_green;
102 *b = m_blue;
103 }
104 #endif
105