]> git.saurik.com Git - wxWidgets.git/blame - src/msw/colour.cpp
don't log erroneous error messages when writing an empty string to a wxTE_RICH2 control
[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$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
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>
27#include <windows.h>
28
2bda0e17 29IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
2bda0e17
KB
30
31// Colour
32
68dda785 33wxColour::wxColour ()
2bda0e17
KB
34{
35 m_isInit = FALSE;
36 m_pixel = 0;
37 m_red = m_blue = m_green = 0;
38}
39
e4a81a2e 40wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
2bda0e17
KB
41{
42 m_red = r;
43 m_green = g;
44 m_blue = b;
45 m_isInit = TRUE;
46 m_pixel = PALETTERGB (m_red, m_green, m_blue);
47}
48
49wxColour::wxColour (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}
57
58wxColour& wxColour::operator =(const wxColour& col)
59{
60 m_red = col.m_red;
61 m_green = col.m_green;
62 m_blue = col.m_blue;
63 m_isInit = col.m_isInit;
64 m_pixel = col.m_pixel;
65 return *this;
66}
67
68dda785 68void wxColour::InitFromName(const wxString& col)
2bda0e17
KB
69{
70 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
71 if (the_colour)
72 {
73 m_red = the_colour->Red ();
74 m_green = the_colour->Green ();
75 m_blue = the_colour->Blue ();
76 m_isInit = TRUE;
77 }
78 else
79 {
80 m_red = 0;
81 m_green = 0;
82 m_blue = 0;
83 m_isInit = FALSE;
84 }
85 m_pixel = PALETTERGB (m_red, m_green, m_blue);
86}
87
68dda785 88wxColour::~wxColour()
2bda0e17
KB
89{
90}
91
2bda0e17
KB
92void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
93{
94 m_red = r;
95 m_green = g;
96 m_blue = b;
97 m_isInit = TRUE;
98 m_pixel = PALETTERGB (m_red, m_green, m_blue);
99}
100
101// Obsolete
102#if WXWIN_COMPATIBILITY
103void wxColour::Get (unsigned char *r, unsigned char *g, unsigned char *b) const
104{
105 *r = m_red;
106 *g = m_green;
107 *b = m_blue;
108}
109#endif
110