X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b7e94bd7ebc205ffba5e2729b0d465778d4e48c6..b5fe7ca67bf3121959a0b5a59afd00c1708f2f03:/interface/wx/colour.h diff --git a/interface/wx/colour.h b/interface/wx/colour.h index 209929c39a..2a2193d9ff 100644 --- a/interface/wx/colour.h +++ b/interface/wx/colour.h @@ -6,6 +6,20 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// + + +/** + Flags for wxColour -> wxString conversion (see wxColour::GetAsString). + + @{ +*/ +#define wxC2S_NAME 1 //!< Return colour name, when possible. +#define wxC2S_CSS_SYNTAX 2 //!< Return colour in "rgb(r,g,b)" syntax. +#define wxC2S_HTML_SYNTAX 4 //!< Return colour in "#rrggbb" syntax. + +//@} + + /** @class wxColour @@ -81,29 +95,29 @@ public: /** Converts this colour to a wxString using the given flags. - The supported flags are wxC2S_NAME, to obtain the colour name (e.g. - wxColour(255,0,0) == "red"), wxC2S_CSS_SYNTAX, to obtain the colour in - the "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax (e.g. - wxColour(255,0,0,85) == "rgba(255,0,0,0.333)"), and wxC2S_HTML_SYNTAX, - to obtain the colour as "#" followed by 6 hexadecimal digits (e.g. - wxColour(255,0,0) == "#FF0000"). + The supported flags are @c wxC2S_NAME, to obtain the colour name + (e.g. wxColour(255,0,0) == "red"), @c wxC2S_CSS_SYNTAX, to obtain + the colour in the "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax + (e.g. wxColour(255,0,0,85) == "rgba(255,0,0,0.333)"), and + @c wxC2S_HTML_SYNTAX, to obtain the colour as "#" followed by 6 + hexadecimal digits (e.g. wxColour(255,0,0) == "#FF0000"). This function never fails and always returns a non-empty string but asserts if the colour has alpha channel (i.e. is non opaque) but - wxC2S_CSS_SYNTAX (which is the only one supporting alpha) is not + @c wxC2S_CSS_SYNTAX (which is the only one supporting alpha) is not specified in flags. @since 2.7.0 */ - wxString GetAsString(long flags); + virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const; /** - Returns a pixel value which is platform-dependent. On Windows, a COLORREF is - returned. + Returns a pixel value which is platform-dependent. + On Windows, a COLORREF is returned. On X, an allocated pixel value is returned. - -1 is returned if the pixel is invalid (on X, unallocated). + If the pixel is invalid (on X, unallocated), @c -1 is returned. */ - long GetPixel() const; + int GetPixel() const; /** Returns the green intensity. @@ -114,7 +128,7 @@ public: Returns @true if the colour object is valid (the colour has been initialised with RGB values). */ - bool IsOk() const; + virtual bool IsOk() const; /** Returns the red intensity. @@ -148,23 +162,20 @@ public: Tests the inequality of two colours by comparing individual red, green, blue colours and alpha values. */ - bool operator !=(const wxColour& colour); + bool operator !=(const wxColour& colour) const; - //@{ /** Assignment operator, using a colour name to be found in the colour database. @see wxColourDatabase */ - wxColour operator =(const wxColour& colour); - wxColour operator =(const wxString& colourName); - //@} + wxColour& operator=(const wxColour& colour); /** Tests the equality of two colours by comparing individual red, green, blue colours and alpha values. */ - bool operator ==(const wxColour& colour); + bool operator ==(const wxColour& colour) const; }; @@ -186,7 +197,7 @@ wxColour* wxWHITE; // Global functions/macros // ============================================================================ -/** @ingroup group_funcmacro_misc */ +/** @addtogroup group_funcmacro_misc */ //@{ /**