// 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
- @wxheader{colour.h}
A colour is an object representing a combination of Red, Green, and Blue
(RGB) intensity values, and is used to determine drawing colours. See the
Returns the alpha value, on platforms where alpha is not yet supported, this
always returns wxALPHA_OPAQUE.
*/
- unsigned char Alpha() const;
+ virtual unsigned char Alpha() const;
/**
Returns the blue intensity.
*/
- unsigned char Blue() const;
+ virtual unsigned char Blue() const;
/**
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.
*/
- unsigned char Green() const;
+ virtual unsigned char Green() const;
/**
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.
*/
- unsigned char Red() const;
+ virtual unsigned char Red() const;
//@{
/**
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;
};
// Global functions/macros
// ============================================================================
-/** @ingroup group_funcmacro_misc */
+/** @addtogroup group_funcmacro_misc */
//@{
/**