]> git.saurik.com Git - wxWidgets.git/blob - src/msw/colour.cpp
fixed size of the log dialog details drop down
[wxWidgets.git] / src / msw / colour.cpp
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"
24 #include "wx/msw/private.h"
25
26 #include <string.h>
27 #include <windows.h>
28
29 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
30
31 // Colour
32
33 wxColour::wxColour ()
34 {
35 m_isInit = FALSE;
36 m_pixel = 0;
37 m_red = m_blue = m_green = 0;
38 }
39
40 wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
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
49 wxColour::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
58 wxColour& 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
68 void wxColour::InitFromName(const wxString& col)
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
88 wxColour::~wxColour()
89 {
90 }
91
92 void 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
103 void 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