Applied patch [ 828303 ] Slight wxColour cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
||||
wxColour( unsigned long colRGB )
|
||||
: m_cocoaNSColor(NULL)
|
||||
{ Set(colRGB); }
|
||||
|
||||
|
||||
// implicit conversion from the colour name
|
||||
wxColour( const wxString &colourName )
|
||||
: m_cocoaNSColor(NULL)
|
||||
@@ -62,10 +62,10 @@ public:
|
||||
// comparison
|
||||
bool operator == (const wxColour& colour) const
|
||||
{
|
||||
return (m_cocoaNSColor == colour.m_cocoaNSColor &&
|
||||
m_red == colour.m_red &&
|
||||
m_green == colour.m_green &&
|
||||
m_blue == colour.m_blue);
|
||||
return (m_cocoaNSColor == colour.m_cocoaNSColor
|
||||
&& m_red == colour.m_red
|
||||
&& m_green == colour.m_green
|
||||
&& m_blue == colour.m_blue);
|
||||
}
|
||||
bool operator != (const wxColour& colour) const
|
||||
{ return !(*this == colour); }
|
||||
@@ -83,7 +83,6 @@ public:
|
||||
(unsigned char)(colRGB >> 16));
|
||||
}
|
||||
|
||||
protected:
|
||||
void InitFromName(const wxString& col);
|
||||
|
||||
private:
|
||||
|
@@ -40,7 +40,7 @@ class wxColour: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxColour() { }
|
||||
|
||||
|
||||
// Construct from RGB
|
||||
wxColour( unsigned char red, unsigned char green, unsigned char blue );
|
||||
wxColour( unsigned long colRGB ) { Set(colRGB); }
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
~wxColour();
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
|
||||
bool operator == ( const wxColour& col ) const;
|
||||
bool operator != ( const wxColour& col ) const { return !(*this == col); }
|
||||
|
||||
@@ -88,13 +88,13 @@ public:
|
||||
int GetPixel() const;
|
||||
GdkColor *GetColor() const;
|
||||
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
// Helper functions
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
|
@@ -40,7 +40,7 @@ class wxColour: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxColour() { }
|
||||
|
||||
|
||||
// Construct from RGB
|
||||
wxColour( unsigned char red, unsigned char green, unsigned char blue );
|
||||
wxColour( unsigned long colRGB ) { Set(colRGB); }
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
~wxColour();
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
|
||||
bool operator == ( const wxColour& col ) const;
|
||||
bool operator != ( const wxColour& col ) const { return !(*this == col); }
|
||||
|
||||
@@ -88,13 +88,13 @@ public:
|
||||
int GetPixel() const;
|
||||
GdkColor *GetColor() const;
|
||||
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
// Helper functions
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
{ Set(red, green, blue); }
|
||||
wxColour( unsigned long colRGB )
|
||||
{ Set(colRGB); }
|
||||
|
||||
|
||||
// implicit conversion from the colour name
|
||||
wxColour( const wxString &colourName )
|
||||
{ InitFromName(colourName); }
|
||||
@@ -67,25 +67,28 @@ public:
|
||||
// comparison
|
||||
bool operator == (const wxColour& colour) const
|
||||
{
|
||||
return (m_isInit == colour.m_isInit &&
|
||||
m_red == colour.m_red &&
|
||||
m_green == colour.m_green &&
|
||||
m_blue == colour.m_blue);
|
||||
return (m_isInit == colour.m_isInit
|
||||
&& m_red == colour.m_red
|
||||
&& m_green == colour.m_green
|
||||
&& m_blue == colour.m_blue);
|
||||
}
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
void InitFromName(const wxString& col);
|
||||
|
||||
const WXCOLORREF& GetPixel() const { return m_pixel; };
|
||||
|
||||
void InitFromName(const wxString& col);
|
||||
|
||||
protected :
|
||||
|
||||
// Helper function
|
||||
void Init();
|
||||
|
||||
private:
|
||||
bool m_isInit;
|
||||
unsigned char m_red;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_green;
|
||||
|
||||
void Init();
|
||||
|
||||
public:
|
||||
WXCOLORREF m_pixel ;
|
||||
void Set( const WXCOLORREF* color ) ;
|
||||
|
@@ -69,16 +69,19 @@ public:
|
||||
}
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
protected:
|
||||
|
||||
// Helper function
|
||||
void Init();
|
||||
|
||||
private:
|
||||
bool m_isInit;
|
||||
unsigned char m_red;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_green;
|
||||
|
||||
// ctors helpers
|
||||
void Init();
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
};
|
||||
|
@@ -31,18 +31,18 @@ public:
|
||||
wxColour( unsigned char red, unsigned char green, unsigned char blue )
|
||||
{ Set(red, green, 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& operator = ( const wxColour& col );
|
||||
|
||||
|
||||
// dtor
|
||||
~wxColour();
|
||||
|
||||
|
||||
// Set() functions
|
||||
void Set( unsigned char red, unsigned char green, unsigned char blue );
|
||||
void Set( unsigned long colRGB )
|
||||
@@ -53,41 +53,45 @@ public:
|
||||
(unsigned char)(colRGB >> 8),
|
||||
(unsigned char)(colRGB >> 16));
|
||||
}
|
||||
|
||||
|
||||
// accessors
|
||||
bool Ok() const {return m_isInit; }
|
||||
unsigned char Red() const { return m_red; }
|
||||
unsigned char Green() const { return m_green; }
|
||||
unsigned char Blue() const { return m_blue; }
|
||||
|
||||
|
||||
int GetPixel() const { return m_pixel; };
|
||||
void SetPixel(int pixel) { m_pixel = pixel; m_isInit = TRUE; };
|
||||
|
||||
void SetPixel(int pixel) { m_pixel = pixel; m_isInit = true; };
|
||||
|
||||
inline bool operator == (const wxColour& colour) const { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); }
|
||||
|
||||
|
||||
inline bool operator != (const wxColour& colour) const { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); }
|
||||
|
||||
// Get colour from name or wxNullColour
|
||||
static wxColour CreateByName(const wxString& name);
|
||||
|
||||
// Allocate a colour, or nearest colour, using the given display.
|
||||
// If realloc is TRUE, ignore the existing pixel, otherwise just return
|
||||
// If realloc is true, ignore the existing pixel, otherwise just return
|
||||
// the existing one.
|
||||
// Returns the allocated pixel.
|
||||
|
||||
|
||||
// TODO: can this handle mono displays? If not, we should have an extra
|
||||
// flag to specify whether this should be black or white by default.
|
||||
|
||||
int AllocColour(WXDisplay* display, bool realloc = FALSE);
|
||||
|
||||
|
||||
int AllocColour(WXDisplay* display, bool realloc = false);
|
||||
|
||||
void InitFromName(const wxString& col);
|
||||
|
||||
|
||||
protected:
|
||||
// Helper function
|
||||
void Init();
|
||||
|
||||
private:
|
||||
bool m_isInit;
|
||||
unsigned char m_red;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_green;
|
||||
|
||||
|
||||
public:
|
||||
int m_pixel;
|
||||
};
|
||||
|
@@ -54,9 +54,9 @@ public:
|
||||
// other methods
|
||||
// -------------
|
||||
|
||||
// to have the matching Create also for this class
|
||||
// to have the matching Create also for this class
|
||||
void Create( unsigned char red, unsigned char green, unsigned char blue )
|
||||
{ Set(red, green, blue); }
|
||||
{ Set(red, green, blue); }
|
||||
|
||||
// Set() functions
|
||||
void Set(unsigned char red, unsigned char green, unsigned char blue);
|
||||
@@ -65,14 +65,14 @@ public:
|
||||
// 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)(colRGB >> 8),
|
||||
(unsigned char)(colRGB >> 16));
|
||||
}
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
bool Ok() const {return m_isInit; }
|
||||
bool Ok() const { return m_isInit; }
|
||||
|
||||
unsigned char Red() const { return m_red; }
|
||||
unsigned char Green() const { return m_green; }
|
||||
@@ -81,29 +81,31 @@ public:
|
||||
// comparison
|
||||
bool operator==(const wxColour& colour) const
|
||||
{
|
||||
return m_isInit == colour.m_isInit &&
|
||||
m_red == colour.m_red &&
|
||||
m_green == colour.m_green &&
|
||||
m_blue == colour.m_blue;
|
||||
return m_isInit == colour.m_isInit
|
||||
&& m_red == colour.m_red
|
||||
&& m_green == colour.m_green
|
||||
&& m_blue == colour.m_blue;
|
||||
}
|
||||
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
WXCOLORREF GetPixel() const { return m_pixel; };
|
||||
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
public:
|
||||
WXCOLORREF m_pixel;
|
||||
|
||||
protected:
|
||||
// Helper function
|
||||
void Init();
|
||||
|
||||
private:
|
||||
bool m_isInit;
|
||||
unsigned char m_red;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_green;
|
||||
|
||||
// ctors helpers
|
||||
void Init();
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
};
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
// Implicit conversion from the colour name
|
||||
//
|
||||
wxColour(const wxString& rColourName) { InitFromName(rColourName); }
|
||||
wxColour(const char* zColourName) { InitFromName(zColourName); }
|
||||
wxColour(const wxChar *zColourName) { InitFromName(zColourName); }
|
||||
|
||||
//
|
||||
// Copy ctors and assignment operators
|
||||
@@ -92,17 +92,24 @@ public:
|
||||
//
|
||||
bool operator == (const wxColour& rColour) const
|
||||
{
|
||||
return (m_cRed == rColour.m_cRed &&
|
||||
m_cGreen == rColour.m_cGreen &&
|
||||
m_cBlue == rColour.m_cBlue
|
||||
return (m_isInit == rColour.m_isInit
|
||||
&& m_cRed == rColour.m_cRed
|
||||
&& m_cGreen == rColour.m_cGreen
|
||||
&& m_cBlue == rColour.m_cBlue
|
||||
);
|
||||
}
|
||||
|
||||
bool operator != (const wxColour& rColour) const { return !(*this == rColour); }
|
||||
|
||||
void InitFromName(const wxString& rCol);
|
||||
WXCOLORREF GetPixel(void) const { return m_vPixel; };
|
||||
|
||||
void InitFromName(const wxString& rCol);
|
||||
|
||||
private:
|
||||
|
||||
// Helper function
|
||||
void Init();
|
||||
|
||||
bool m_bIsInit;
|
||||
unsigned char m_cRed;
|
||||
unsigned char m_cBlue;
|
||||
|
@@ -37,11 +37,11 @@ class wxColour;
|
||||
// wxColour
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxColour: public wxGDIObject
|
||||
class WXDLLEXPORT wxColour: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxColour() { }
|
||||
|
||||
|
||||
// Construct from RGB
|
||||
wxColour( unsigned char red, unsigned char green, unsigned char blue );
|
||||
wxColour( unsigned long colRGB ) { Set(colRGB); }
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
~wxColour();
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
|
||||
bool operator == ( const wxColour& col ) const;
|
||||
bool operator != ( const wxColour& col ) const { return !(*this == col); }
|
||||
|
||||
@@ -81,18 +81,18 @@ public:
|
||||
unsigned char Blue() const;
|
||||
|
||||
// Implementation part
|
||||
|
||||
|
||||
void CalcPixel( WXColormap cmap );
|
||||
unsigned long GetPixel() const;
|
||||
WXColor *GetColor() const;
|
||||
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
// Helper functions
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
|
Reference in New Issue
Block a user