]> git.saurik.com Git - wxWidgets.git/blame - src/os2/colour.cpp
*** empty log message ***
[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{
26 m_isInit = FALSE;
0e320a79 27 m_pixel = 0;
37f214d5 28 m_red = m_blue = m_green = 0;
0e320a79
DW
29}
30
31wxColour::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;
37f214d5 37// m_pixel = PALETTERGB (m_red, m_green, m_blue);
0e320a79
DW
38}
39
40wxColour::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;
0e320a79 46 m_pixel = col.m_pixel;
0e320a79
DW
47}
48
49wxColour& 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;
0e320a79 55 m_pixel = col.m_pixel;
0e320a79
DW
56 return *this;
57}
58
59void 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
81wxColour::~wxColour ()
82{
83}
84
85void 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}
37f214d5
DW
95
96// Obsolete
97#if WXWIN_COMPATIBILITY
98void 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