| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/os2/colour.h |
| 3 | // Purpose: wxColour class |
| 4 | // Author: David Webster |
| 5 | // Modified by: |
| 6 | // Created: 10/13/99 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) David Webster |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_COLOUR_H_ |
| 13 | #define _WX_COLOUR_H_ |
| 14 | |
| 15 | #include "wx/object.h" |
| 16 | |
| 17 | // Colour |
| 18 | class WXDLLEXPORT wxColour: public wxColourBase |
| 19 | { |
| 20 | public: |
| 21 | // constructors |
| 22 | // ------------ |
| 23 | |
| 24 | // default |
| 25 | wxColour(); |
| 26 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
| 27 | |
| 28 | // Copy ctors and assignment operators |
| 29 | wxColour(const wxColour& rCol); |
| 30 | wxColour(const wxColour* pCol); |
| 31 | wxColour&operator = (const wxColour& rCol); |
| 32 | |
| 33 | // Dtor |
| 34 | virtual ~wxColour(); |
| 35 | |
| 36 | // Accessors |
| 37 | bool Ok() const { return IsOk(); } |
| 38 | bool IsOk(void) const {return m_bIsInit; } |
| 39 | |
| 40 | unsigned char Red(void) const { return m_cRed; } |
| 41 | unsigned char Green(void) const { return m_cGreen; } |
| 42 | unsigned char Blue(void) const { return m_cBlue; } |
| 43 | |
| 44 | // Comparison |
| 45 | bool operator == (const wxColour& rColour) const |
| 46 | { |
| 47 | return (m_bIsInit == rColour.m_bIsInit |
| 48 | && m_cRed == rColour.m_cRed |
| 49 | && m_cGreen == rColour.m_cGreen |
| 50 | && m_cBlue == rColour.m_cBlue |
| 51 | ); |
| 52 | } |
| 53 | |
| 54 | bool operator != (const wxColour& rColour) const { return !(*this == rColour); } |
| 55 | |
| 56 | WXCOLORREF GetPixel(void) const { return m_vPixel; }; |
| 57 | |
| 58 | |
| 59 | private: |
| 60 | |
| 61 | // Helper function |
| 62 | void Init(); |
| 63 | |
| 64 | bool m_bIsInit; |
| 65 | unsigned char m_cRed; |
| 66 | unsigned char m_cBlue; |
| 67 | unsigned char m_cGreen; |
| 68 | |
| 69 | virtual void |
| 70 | InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); |
| 71 | |
| 72 | public: |
| 73 | WXCOLORREF m_vPixel ; |
| 74 | private: |
| 75 | DECLARE_DYNAMIC_CLASS(wxColour) |
| 76 | }; // end of class wxColour |
| 77 | |
| 78 | #endif |
| 79 | // _WX_COLOUR_H_ |