]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxColour class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "colour.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
23 #include "wx/gdicmn.h"
28 #if !USE_SHARED_LIBRARY
29 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
34 wxColour::wxColour (void)
38 m_red
= m_blue
= m_green
= 0;
41 wxColour::wxColour (const unsigned char r
, const unsigned char g
, const unsigned char b
)
47 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
50 wxColour::wxColour (const wxColour
& col
)
53 m_green
= col
.m_green
;
55 m_isInit
= col
.m_isInit
;
56 m_pixel
= col
.m_pixel
;
59 wxColour
& wxColour::operator =(const wxColour
& col
)
62 m_green
= col
.m_green
;
64 m_isInit
= col
.m_isInit
;
65 m_pixel
= col
.m_pixel
;
69 wxColour::wxColour (const wxString
& col
)
71 wxColour
*the_colour
= wxTheColourDatabase
->FindColour (col
);
74 m_red
= the_colour
->Red ();
75 m_green
= the_colour
->Green ();
76 m_blue
= the_colour
->Blue ();
86 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
89 wxColour::~wxColour (void)
93 wxColour
& wxColour::operator = (const wxString
& col
)
95 wxColour
*the_colour
= wxTheColourDatabase
->FindColour (col
);
98 m_red
= the_colour
->Red ();
99 m_green
= the_colour
->Green ();
100 m_blue
= the_colour
->Blue ();
110 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
114 void wxColour::Set (unsigned char r
, unsigned char g
, unsigned char b
)
120 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
124 #if WXWIN_COMPATIBILITY
125 void wxColour::Get (unsigned char *r
, unsigned char *g
, unsigned char *b
) const