colour.h 1.8 KB

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