]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/colour.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/colour.cpp
3 // Purpose: wxColour class
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14 #include "wx/colour.h"
20 #include "wx/gdicmn.h"
24 #if wxUSE_EXTENDED_RTTI
26 template<> void wxStringReadValue(const wxString
&s
, wxColour
&data
)
29 unsigned long tmp
= 0;
31 if (s
.Length() != 7 || s
[0u] != wxT('#')
32 || wxSscanf(s
.c_str(), wxT("#%lX"), &tmp
) != 1)
34 wxLogError(_("String To Colour : Incorrect colour specification : %s"),
40 data
= wxColour((unsigned char) ((tmp
& 0xFF0000) >> 16) ,
41 (unsigned char) ((tmp
& 0x00FF00) >> 8),
42 (unsigned char) ((tmp
& 0x0000FF)));
46 template<> void wxStringWriteValue(wxString
&s
, const wxColour
&data
)
48 s
= wxString::Format(wxT("#%02X%02X%02X"),
49 data
.Red(), data
.Green(), data
.Blue() );
52 wxTO_STRING_IMP( wxColour
)
53 wxFROM_STRING_IMP( wxColour
)
55 IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour
, wxObject
, "wx/colour.h" , &wxTO_STRING( wxColour
) , &wxFROM_STRING( wxColour
))
57 wxBEGIN_PROPERTIES_TABLE(wxColour
)
58 wxREADONLY_PROPERTY( Red
, unsigned char, Red
, EMPTY_MACROVALUE
, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
59 wxREADONLY_PROPERTY( Green
, unsigned char, Green
, EMPTY_MACROVALUE
, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
60 wxREADONLY_PROPERTY( Blue
, unsigned char, Blue
, EMPTY_MACROVALUE
, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
61 wxEND_PROPERTIES_TABLE()
63 wxCONSTRUCTOR_3( wxColour
, unsigned char, Red
, unsigned char, Green
, unsigned char, Blue
)
65 wxBEGIN_HANDLERS_TABLE(wxColour
)
66 wxEND_HANDLERS_TABLE()
68 IMPLEMENT_DYNAMIC_CLASS(wxColour
, wxObject
)
82 wxColour::wxColour(const wxColour
& col
)
87 wxColour
& wxColour::operator=(const wxColour
& col
)
90 m_green
= col
.m_green
;
92 m_isInit
= col
.m_isInit
;
93 m_pixel
= col
.m_pixel
;
97 void wxColour::InitFromName(const wxString
& name
)
103 wxColour::~wxColour()
107 void wxColour::Set(unsigned char r
, unsigned char g
, unsigned char b
)