]> git.saurik.com Git - wxWidgets.git/blame - src/msw/colour.cpp
added configtool, helpview and emulator makefiles
[wxWidgets.git] / src / msw / colour.cpp
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: colour.cpp
3// Purpose: wxColour class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
6c9a19aa 8// Copyright: (c) Julian Smart
2bda0e17
KB
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
14f355c2 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
2bda0e17
KB
13#pragma implementation "colour.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#include "wx/gdicmn.h"
8cb172b4 24#include "wx/msw/private.h"
2bda0e17
KB
25
26#include <string.h>
2bda0e17 27
066f1b7a
SC
28#if wxUSE_EXTENDED_RTTI
29IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( wxColour , wxObject , "wx/colour.h" )
30
31WX_BEGIN_PROPERTIES_TABLE(wxColour)
32 WX_READONLY_PROPERTY( Red, unsigned char , Red , 0 )
33 WX_READONLY_PROPERTY( Green, unsigned char , Green , 0 )
34 WX_READONLY_PROPERTY( Blue, unsigned char , Blue , 0 )
35WX_END_PROPERTIES_TABLE()
36
37WX_CONSTRUCTOR_3( wxColour , unsigned char , Red , unsigned char , Green , unsigned char , Blue )
38
39WX_BEGIN_HANDLERS_TABLE(wxColour)
40WX_END_HANDLERS_TABLE()
41#else
2bda0e17 42IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
066f1b7a 43#endif
2bda0e17
KB
44
45// Colour
46
68dda785 47wxColour::wxColour ()
2bda0e17
KB
48{
49 m_isInit = FALSE;
50 m_pixel = 0;
51 m_red = m_blue = m_green = 0;
52}
53
e4a81a2e 54wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
2bda0e17
KB
55{
56 m_red = r;
57 m_green = g;
58 m_blue = b;
59 m_isInit = TRUE;
60 m_pixel = PALETTERGB (m_red, m_green, m_blue);
61}
62
63wxColour::wxColour (const wxColour& col)
64{
65 m_red = col.m_red;
66 m_green = col.m_green;
67 m_blue = col.m_blue;
68 m_isInit = col.m_isInit;
69 m_pixel = col.m_pixel;
70}
71
72wxColour& wxColour::operator =(const wxColour& col)
73{
74 m_red = col.m_red;
75 m_green = col.m_green;
76 m_blue = col.m_blue;
77 m_isInit = col.m_isInit;
78 m_pixel = col.m_pixel;
79 return *this;
80}
81
68dda785 82void wxColour::InitFromName(const wxString& col)
2bda0e17
KB
83{
84 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
85 if (the_colour)
86 {
87 m_red = the_colour->Red ();
88 m_green = the_colour->Green ();
89 m_blue = the_colour->Blue ();
90 m_isInit = TRUE;
91 }
92 else
93 {
94 m_red = 0;
95 m_green = 0;
96 m_blue = 0;
97 m_isInit = FALSE;
98 }
99 m_pixel = PALETTERGB (m_red, m_green, m_blue);
100}
101
68dda785 102wxColour::~wxColour()
2bda0e17
KB
103{
104}
105
2bda0e17
KB
106void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
107{
108 m_red = r;
109 m_green = g;
110 m_blue = b;
111 m_isInit = TRUE;
112 m_pixel = PALETTERGB (m_red, m_green, m_blue);
113}
114
115// Obsolete
116#if WXWIN_COMPATIBILITY
117void wxColour::Get (unsigned char *r, unsigned char *g, unsigned char *b) const
118{
119 *r = m_red;
120 *g = m_green;
121 *b = m_blue;
122}
123#endif
124