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 );
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)
#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;
public:
// constructors
// ------------
-
- // default
- wxColour();
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
// copy ctors and assignment operators
public:
// constructors
// ------------
-
- // default
- wxColour() {}
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
wxColour(const GdkColor& gdkColor);
public:
// constructors
// ------------
-
- // default
- wxColour() { }
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
virtual ~wxColour();
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; }
// 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
wxColour& operator=(const wxColour& col);
protected :
-
-
virtual void
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
void InitRGBColor( const RGBColor& col );
public:
// constructors
// ------------
-
- // default
- wxColour() { Init(); }
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
// copy ctors and assignment operators
public:
// constructors
// ------------
-
- // default
- wxColour() { Init(); }
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
-
- // dtor
- virtual ~wxColour();
-
-
// accessors
// ---------
&& 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;
DECLARE_DYNAMIC_CLASS(wxColour)
};
-#endif
- // _WX_COLOUR_H_
+#endif // _WX_COLOUR_H_
public:
// constructors
// ------------
-
- // default
- wxColour();
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
// Copy ctors and assignment operators
public:
// constructors
// ------------
-
- wxColour() {}
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
virtual ~wxColour();
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);
col->green = (m_green << 8) + m_green;
}
-wxColour::~wxColour ()
-{
-}
-
wxColour& wxColour::operator=(const RGBColor& col)
{
InitRGBColor(col);
m_green = 0;
}
-wxColour::~wxColour()
-{
-}
-
void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b,
unsigned char a)
{