X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aea95b1c3a8ae221cc3aade5ce49a3cf848fd56a..472eec8a0391538e4dcf7f7c6c4f4d44c8383616:/include/wx/colour.h diff --git a/include/wx/colour.h b/include/wx/colour.h index 7bba397dc2..afe6371475 100644 --- a/include/wx/colour.h +++ b/include/wx/colour.h @@ -16,6 +16,8 @@ #include "wx/gdiobj.h" +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 @@ -25,8 +27,9 @@ ChannelType alpha = wxALPHA_OPAQUE ) \ { Set(red, green, blue, alpha); } \ wxColour( unsigned long colRGB ) { Set(colRGB); } \ - wxColour(const wxString &colourName) { Set(colourName); } \ - wxColour(const wxChar *colourName) { Set(colourName); } + wxColour(const wxString& colourName) { Set(colourName); } \ + wxColour(const char *colourName) { Set(colourName); } \ + wxColour(const wchar_t *colourName) { Set(colourName); } // flags for wxColour -> wxString conversion (see wxColour::GetAsString) @@ -35,11 +38,18 @@ #define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax -class WXDLLEXPORT wxColour; - const unsigned char wxALPHA_TRANSPARENT = 0; const unsigned char wxALPHA_OPAQUE = 0xff; +// ---------------------------------------------------------------------------- +// wxVariant support +// ---------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) +#endif + //----------------------------------------------------------------------------- // wxColourBase: this class has no data members, just some functions to avoid // code redundancy in all native wxColour implementations @@ -65,9 +75,6 @@ public: { InitRGBA(red,green,blue, alpha); } // implemented in colourcmn.cpp - bool Set(const wxChar *str) - { return FromString(str); } - bool Set(const wxString &str) { return FromString(str); } @@ -75,9 +82,9 @@ 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((ChannelType)colRGB, - (ChannelType)(colRGB >> 8), - (ChannelType)(colRGB >> 16)); + Set((ChannelType)(0xFF & colRGB), + (ChannelType)(0xFF & (colRGB >> 8)), + (ChannelType)(0xFF & (colRGB >> 16))); } @@ -85,7 +92,8 @@ public: // accessors // --------- - virtual bool Ok() const = 0; + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; virtual ChannelType Red() const = 0; virtual ChannelType Green() const = 0; @@ -110,10 +118,15 @@ protected: virtual void InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0; - virtual bool FromString(const wxChar *s); + virtual bool FromString(const wxString& s); }; +// wxColour <-> wxString utilities, used by wxConfig, defined in colourcmn.cpp +WXDLLIMPEXP_CORE wxString wxToString(const wxColourBase& col); +WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col); + + #if defined(__WXPALMOS__) #include "wx/generic/colour.h"