]>
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "colour.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
23 #include "wx/gdicmn.h"
24 #include "wx/msw/private.h"
28 #if wxUSE_EXTENDED_RTTI
29 IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( wxColour
, wxObject
, "wx/colour.h" )
31 WX_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 )
35 WX_END_PROPERTIES_TABLE()
37 WX_CONSTRUCTOR_3( wxColour
, unsigned char , Red
, unsigned char , Green
, unsigned char , Blue
)
39 WX_BEGIN_HANDLERS_TABLE(wxColour
)
40 WX_END_HANDLERS_TABLE()
42 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
51 m_red
= m_blue
= m_green
= 0;
54 wxColour::wxColour (unsigned char r
, unsigned char g
, unsigned char b
)
60 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
63 wxColour::wxColour (const wxColour
& col
)
66 m_green
= col
.m_green
;
68 m_isInit
= col
.m_isInit
;
69 m_pixel
= col
.m_pixel
;
72 wxColour
& wxColour::operator =(const wxColour
& col
)
75 m_green
= col
.m_green
;
77 m_isInit
= col
.m_isInit
;
78 m_pixel
= col
.m_pixel
;
82 void wxColour::InitFromName(const wxString
& col
)
84 wxColour
*the_colour
= wxTheColourDatabase
->FindColour (col
);
87 m_red
= the_colour
->Red ();
88 m_green
= the_colour
->Green ();
89 m_blue
= the_colour
->Blue ();
99 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
102 wxColour::~wxColour()
106 void wxColour::Set (unsigned char r
, unsigned char g
, unsigned char b
)
112 m_pixel
= PALETTERGB (m_red
, m_green
, m_blue
);
116 #if WXWIN_COMPATIBILITY
117 void wxColour::Get (unsigned char *r
, unsigned char *g
, unsigned char *b
) const