Added wxColour::wxColour(unsigned long)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 1999-02-04 19:03:55 +00:00
parent 566b84d2ad
commit 5f83a4540d
4 changed files with 30 additions and 3 deletions

View File

@ -44,6 +44,8 @@ public:
wxColour();
// from RGB
wxColour( unsigned char red, unsigned char green, unsigned char blue );
wxColour( unsigned long colRGB ) { Set(colRGB); }
// implicit conversion from the colour name
wxColour( const wxString &colourName ) { InitFromName(colourName); }
wxColour( const char *colourName ) { InitFromName(colourName); }
@ -61,6 +63,15 @@ public:
// accessors
void Set( unsigned char red, unsigned char green, unsigned char blue );
void Set( unsigned long colRGB )
{
// we don't need to know sizeof(long) here because we assume that the three
// least significant bytes contain the R, G and B values
Set((unsigned char)colRGB,
(unsigned char)(colRGB >> 8),
(unsigned char)(colRGB >> 16));
}
unsigned char Red() const;
unsigned char Green() const;
unsigned char Blue() const;

View File

@ -44,6 +44,8 @@ public:
wxColour();
// from RGB
wxColour( unsigned char red, unsigned char green, unsigned char blue );
wxColour( unsigned long colRGB ) { Set(colRGB); }
// implicit conversion from the colour name
wxColour( const wxString &colourName ) { InitFromName(colourName); }
wxColour( const char *colourName ) { InitFromName(colourName); }
@ -61,6 +63,15 @@ public:
// accessors
void Set( unsigned char red, unsigned char green, unsigned char blue );
void Set( unsigned long colRGB )
{
// we don't need to know sizeof(long) here because we assume that the three
// least significant bytes contain the R, G and B values
Set((unsigned char)colRGB,
(unsigned char)(colRGB >> 8),
(unsigned char)(colRGB >> 16));
}
unsigned char Red() const;
unsigned char Green() const;
unsigned char Blue() const;

View File

@ -29,6 +29,8 @@ public:
wxColour();
// from RGB
wxColour( unsigned char red, unsigned char green, unsigned char blue );
wxColour( unsigned long colRGB ) { Set(colRGB); }
// implicit conversion from the colour name
wxColour( const wxString &colourName ) { InitFromName(colourName); }
wxColour( const char *colourName ) { InitFromName(colourName); }

View File

@ -25,13 +25,16 @@ public:
wxColour();
// from RGB
wxColour( unsigned char red, unsigned char green, unsigned char blue );
wxColour( unsigned long colRGB ) { Set(colRGB); }
// implicit conversion from the colour name
wxColour( const wxString &colourName ) { InitFromName(colourName); }
wxColour( const char *colourName ) { InitFromName(colourName); }
// copy ctors and assignment operators
wxColour( const wxColour& col );
// wxColour( const wxColour* col );
wxColour( const wxColour* col );
wxColour& operator = ( const wxColour& col );
// dtor
@ -63,8 +66,8 @@ public:
// comparison
bool operator == (const wxColour& colour)
{
return (m_red == colour.m_red &&
m_green == colour.m_green &&
return (m_red == colour.m_red &&
m_green == colour.m_green &&
m_blue == colour.m_blue);
}
bool operator != (const wxColour& colour) { return !(*this == colour); }