]> git.saurik.com Git - wxWidgets.git/blame - src/os2/colour.cpp
[gtk] fixed bug that caused segfaults in wxYield when wxToolBar has non-button contr...
[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
DW
19
20#if !USE_SHARED_LIBRARY
21IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
22#endif
23
24// Colour
25
26wxColour::wxColour ()
27{
28 m_isInit = FALSE;
0e320a79 29 m_pixel = 0;
37f214d5 30 m_red = m_blue = m_green = 0;
0e320a79
DW
31}
32
33wxColour::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;
37f214d5 39// m_pixel = PALETTERGB (m_red, m_green, m_blue);
0e320a79
DW
40}
41
42wxColour::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;
0e320a79 48 m_pixel = col.m_pixel;
0e320a79
DW
49}
50
51wxColour& 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;
0e320a79 57 m_pixel = col.m_pixel;
0e320a79
DW
58 return *this;
59}
60
61void 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
83wxColour::~wxColour ()
84{
85}
86
87void 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}
37f214d5
DW
97
98// Obsolete
99#if WXWIN_COMPATIBILITY
100void 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