colour.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/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_GENERIC_COLOUR_H_
  11. #define _WX_GENERIC_COLOUR_H_
  12. #include "wx/object.h"
  13. // Colour
  14. class WXDLLIMPEXP_CORE wxColour: public wxColourBase
  15. {
  16. public:
  17. // constructors
  18. // ------------
  19. DEFINE_STD_WXCOLOUR_CONSTRUCTORS
  20. // copy ctors and assignment operators
  21. wxColour(const wxColour& col)
  22. {
  23. *this = col;
  24. }
  25. wxColour& operator=(const wxColour& col);
  26. // accessors
  27. virtual bool IsOk() const { return m_isInit; }
  28. unsigned char Red() const { return m_red; }
  29. unsigned char Green() const { return m_green; }
  30. unsigned char Blue() const { return m_blue; }
  31. unsigned char Alpha() const { return m_alpha; }
  32. // comparison
  33. bool operator==(const wxColour& colour) const
  34. {
  35. return (m_red == colour.m_red &&
  36. m_green == colour.m_green &&
  37. m_blue == colour.m_blue &&
  38. m_alpha == colour.m_alpha &&
  39. m_isInit == colour.m_isInit);
  40. }
  41. bool operator!=(const wxColour& colour) const { return !(*this == colour); }
  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_GENERIC_COLOUR_H_