added wxColourBase::Init() and use DEFINE_STD_WXCOLOUR_CONSTRUCTORS() in all ports now (patch 1851600)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c8d380be4d
commit
9ef6890f0b
@ -24,25 +24,11 @@ class WXDLLEXPORT wxColour : public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour() { Init(); }
|
||||
|
||||
// the other standard ones: notice that we can't use
|
||||
// DEFINE_STD_WXCOLOUR_CONSTRUCTORS here because we need to call Init() to
|
||||
// initialize m_cocoaNSColor and the macro doesn't do it
|
||||
wxColour( ChannelType red, ChannelType green, ChannelType blue,
|
||||
ChannelType alpha = wxALPHA_OPAQUE )
|
||||
{ Init(); Set(red, green, blue, alpha); }
|
||||
wxColour(unsigned long colRGB) { Init(); Set(colRGB); }
|
||||
wxColour(const wxString& colourName) { Init(); Set(colourName); }
|
||||
wxColour(const char *colourName) { Init(); Set(colourName); }
|
||||
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// initialization using existing NSColor
|
||||
wxColour( WX_NSColor aColor );
|
||||
|
||||
|
||||
// copy ctors and assignment operators
|
||||
wxColour( const wxColour& col );
|
||||
wxColour& operator = ( const wxColour& col );
|
||||
|
@ -18,18 +18,21 @@
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxColour;
|
||||
|
||||
// the standard wxColour constructors;
|
||||
// this macro avoids to repeat these lines across all colour.h files, since
|
||||
// Set() is a virtual function and thus cannot be called by wxColourBase
|
||||
// constructors
|
||||
// A macro to define the standard wxColour constructors:
|
||||
//
|
||||
// It avoids the need to repeat these lines across all colour.h files, since
|
||||
// Set() is a virtual function and thus cannot be called by wxColourBase ctors
|
||||
#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
|
||||
wxColour( ChannelType red, ChannelType green, ChannelType blue, \
|
||||
ChannelType alpha = wxALPHA_OPAQUE ) \
|
||||
{ Set(red, green, blue, alpha); } \
|
||||
wxColour( unsigned long colRGB ) { Set(colRGB); } \
|
||||
wxColour(const wxString& colourName) { Set(colourName); } \
|
||||
wxColour(const char *colourName) { Set(colourName); } \
|
||||
wxColour(const wchar_t *colourName) { Set(colourName); }
|
||||
wxColour() { Init(); } \
|
||||
wxColour(ChannelType red, \
|
||||
ChannelType green, \
|
||||
ChannelType blue, \
|
||||
ChannelType alpha = wxALPHA_OPAQUE) \
|
||||
{ Init(); Set(red, green, blue, alpha); } \
|
||||
wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
|
||||
wxColour(const wxString& colourName) { Init(); Set(colourName); } \
|
||||
wxColour(const char *colourName) { Init(); Set(colourName); } \
|
||||
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
|
||||
|
||||
|
||||
// flags for wxColour -> wxString conversion (see wxColour::GetAsString)
|
||||
@ -129,6 +132,10 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Some ports need Init() and while we don't, provide a stub so that the
|
||||
// ports which don't need it are not forced to define it
|
||||
void Init() { }
|
||||
|
||||
virtual void
|
||||
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0;
|
||||
|
||||
|
@ -20,9 +20,6 @@ class WXDLLEXPORT wxColour: public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour();
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// copy ctors and assignment operators
|
||||
|
@ -19,9 +19,6 @@ class WXDLLIMPEXP_CORE wxColour : public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour() {}
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
wxColour(const GdkColor& gdkColor);
|
||||
|
||||
|
@ -36,9 +36,6 @@ class WXDLLIMPEXP_CORE wxColour : public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour() { }
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
virtual ~wxColour();
|
||||
|
@ -25,14 +25,9 @@ class WXDLLEXPORT wxColour: public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour() { }
|
||||
wxColour( const wxColour& col );
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// dtor
|
||||
virtual ~wxColour();
|
||||
// default copy ctor and dtor are ok
|
||||
|
||||
// accessors
|
||||
virtual bool IsOk() const { return m_cgColour; }
|
||||
@ -44,14 +39,14 @@ public:
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxColour& colour) const;
|
||||
|
||||
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
CGColorRef GetPixel() const { return m_cgColour; };
|
||||
|
||||
|
||||
CGColorRef GetCGColor() const { return m_cgColour; };
|
||||
CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); };
|
||||
|
||||
|
||||
void GetRGBColor( RGBColor *col ) const;
|
||||
|
||||
// Mac-specific ctor and assignment operator from the native colour
|
||||
@ -63,8 +58,6 @@ public:
|
||||
wxColour& operator=(const wxColour& col);
|
||||
|
||||
protected :
|
||||
|
||||
|
||||
virtual void
|
||||
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
|
||||
void InitRGBColor( const RGBColor& col );
|
||||
|
@ -22,9 +22,6 @@ class WXDLLEXPORT wxColour : public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour() { Init(); }
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// copy ctors and assignment operators
|
||||
|
@ -23,16 +23,8 @@ class WXDLLEXPORT wxColour : public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour() { Init(); }
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
|
||||
// dtor
|
||||
virtual ~wxColour();
|
||||
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
@ -53,11 +45,10 @@ public:
|
||||
&& m_alpha == colour.m_alpha;
|
||||
}
|
||||
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
bool operator!=(const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
WXCOLORREF GetPixel() const { return m_pixel; }
|
||||
|
||||
|
||||
public:
|
||||
WXCOLORREF m_pixel;
|
||||
|
||||
@ -79,5 +70,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_COLOUR_H_
|
||||
#endif // _WX_COLOUR_H_
|
||||
|
@ -20,9 +20,6 @@ class WXDLLEXPORT wxColour: public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
// default
|
||||
wxColour();
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// Copy ctors and assignment operators
|
||||
|
@ -38,8 +38,6 @@ class WXDLLEXPORT wxColour : public wxColourBase
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
|
||||
wxColour() {}
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
virtual ~wxColour();
|
||||
|
@ -26,15 +26,6 @@ wxColour::wxColour(const RGBColor& col)
|
||||
InitRGBColor(col);
|
||||
}
|
||||
|
||||
wxColour::wxColour( const wxColour& col )
|
||||
{
|
||||
m_red = col.m_red;
|
||||
m_green = col.m_green;
|
||||
m_blue = col.m_blue;
|
||||
m_alpha = col.m_alpha;
|
||||
m_cgColour = col.m_cgColour;
|
||||
}
|
||||
|
||||
wxColour::wxColour(CGColorRef col)
|
||||
{
|
||||
InitCGColorRef(col);
|
||||
@ -47,10 +38,6 @@ void wxColour::GetRGBColor( RGBColor *col ) const
|
||||
col->green = (m_green << 8) + m_green;
|
||||
}
|
||||
|
||||
wxColour::~wxColour ()
|
||||
{
|
||||
}
|
||||
|
||||
wxColour& wxColour::operator=(const RGBColor& col)
|
||||
{
|
||||
InitRGBColor(col);
|
||||
|
@ -74,10 +74,6 @@ void wxColour::Init()
|
||||
m_green = 0;
|
||||
}
|
||||
|
||||
wxColour::~wxColour()
|
||||
{
|
||||
}
|
||||
|
||||
void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b,
|
||||
unsigned char a)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user