]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/colour.h
move Read/Write() to common code, there was almost nothing platform-specific in it
[wxWidgets.git] / include / wx / cocoa / colour.h
CommitLineData
a24aff65 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: wx/cocoa/colour.h
a24aff65 3// Purpose: wxColour class
683b185d 4// Author: David Elliott
a24aff65 5// Modified by:
683b185d 6// Created: 2003/06/17
a24aff65 7// RCS-ID: $Id$
683b185d 8// Copyright: (c) 2003 David Elliott
65571936 9// Licence: wxWindows licence
a24aff65
DE
10/////////////////////////////////////////////////////////////////////////////
11
683b185d
DE
12#ifndef __WX_COCOA_COLOUR_H__
13#define __WX_COCOA_COLOUR_H__
a24aff65
DE
14
15#include "wx/object.h"
16#include "wx/string.h"
17
683b185d
DE
18// ========================================================================
19// wxColour
20// ========================================================================
40989e46 21
53a2db12 22class WXDLLIMPEXP_CORE wxColour : public wxColourBase
a24aff65
DE
23{
24public:
edc536d3
WS
25 // constructors
26 // ------------
9ef6890f 27 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
aad6765c 28
d8fdd58f
DE
29 // initialization using existing NSColor
30 wxColour( WX_NSColor aColor );
31
a24aff65 32 // copy ctors and assignment operators
683b185d
DE
33 wxColour( const wxColour& col );
34 wxColour& operator = ( const wxColour& col );
a24aff65 35
211436b6 36 virtual ~wxColour();
a24aff65 37
683b185d 38 // accessors
8f884a0d 39 virtual bool IsOk() const { return m_cocoaNSColor; }
211436b6 40 WX_NSColor GetNSColor() { return m_cocoaNSColor; }
ef0e9220 41 WX_NSColor GetNSColor() const { return m_cocoaNSColor; }
a24aff65 42
683b185d
DE
43 unsigned char Red() const { return m_red; }
44 unsigned char Green() const { return m_green; }
45 unsigned char Blue() const { return m_blue; }
71064979 46 unsigned char Alpha() const { return m_alpha; }
a24aff65 47
683b185d
DE
48 // comparison
49 bool operator == (const wxColour& colour) const
50 {
71064979
VZ
51 return m_cocoaNSColor == colour.m_cocoaNSColor ||
52 (m_red == colour.m_red &&
53 m_green == colour.m_green &&
54 m_blue == colour.m_blue &&
55 m_alpha == colour.m_alpha);
683b185d
DE
56 }
57 bool operator != (const wxColour& colour) const
71064979 58 { return !(*this == colour); }
a24aff65 59
683b185d 60 // Set() functions
d8fdd58f 61 void Set( WX_NSColor aColor );
71064979 62
747592e7 63 // reroute the inherited ones
71064979
VZ
64 void Set(unsigned char red,
65 unsigned char green,
66 unsigned char blue,
67 unsigned char alpha = wxALPHA_OPAQUE)
68 { wxColourBase::Set(red, green, blue, alpha); }
69
747592e7 70 bool Set(const wxString &str)
71064979
VZ
71 { return wxColourBase::Set(str); }
72
747592e7 73 void Set(unsigned long colRGB)
71064979
VZ
74 { wxColourBase::Set(colRGB); }
75
211436b6
VZ
76protected:
77 // puts the object in an invalid, uninitialized state
78 void Init();
79
aea95b1c
VZ
80 virtual void
81 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
a24aff65
DE
82
83private:
683b185d
DE
84 WX_NSColor m_cocoaNSColor;
85 unsigned char m_red;
86 unsigned char m_green;
87 unsigned char m_blue;
71064979 88 unsigned char m_alpha;
211436b6
VZ
89
90 DECLARE_DYNAMIC_CLASS(wxColour)
a24aff65
DE
91};
92
683b185d 93#endif // __WX_COCOA_COLOUR_H__