| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/msw/colour.h |
| 3 | // Purpose: wxColour class |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 01/02/97 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_COLOUR_H_ |
| 13 | #define _WX_COLOUR_H_ |
| 14 | |
| 15 | #include "wx/object.h" |
| 16 | |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | // Colour |
| 19 | // ---------------------------------------------------------------------------- |
| 20 | |
| 21 | class WXDLLIMPEXP_CORE wxColour : public wxColourBase |
| 22 | { |
| 23 | public: |
| 24 | // constructors |
| 25 | // ------------ |
| 26 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
| 27 | |
| 28 | // accessors |
| 29 | // --------- |
| 30 | |
| 31 | virtual bool IsOk() const { return m_isInit; } |
| 32 | |
| 33 | unsigned char Red() const { return m_red; } |
| 34 | unsigned char Green() const { return m_green; } |
| 35 | unsigned char Blue() const { return m_blue; } |
| 36 | unsigned char Alpha() const { return m_alpha ; } |
| 37 | |
| 38 | // comparison |
| 39 | bool operator==(const wxColour& colour) const |
| 40 | { |
| 41 | return m_isInit == colour.m_isInit |
| 42 | && m_red == colour.m_red |
| 43 | && m_green == colour.m_green |
| 44 | && m_blue == colour.m_blue |
| 45 | && m_alpha == colour.m_alpha; |
| 46 | } |
| 47 | |
| 48 | bool operator!=(const wxColour& colour) const { return !(*this == colour); } |
| 49 | |
| 50 | WXCOLORREF GetPixel() const { return m_pixel; } |
| 51 | |
| 52 | public: |
| 53 | WXCOLORREF m_pixel; |
| 54 | |
| 55 | protected: |
| 56 | // Helper function |
| 57 | void Init(); |
| 58 | |
| 59 | virtual void |
| 60 | InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); |
| 61 | |
| 62 | private: |
| 63 | bool m_isInit; |
| 64 | unsigned char m_red; |
| 65 | unsigned char m_blue; |
| 66 | unsigned char m_green; |
| 67 | unsigned char m_alpha; |
| 68 | |
| 69 | private: |
| 70 | DECLARE_DYNAMIC_CLASS(wxColour) |
| 71 | }; |
| 72 | |
| 73 | #endif // _WX_COLOUR_H_ |