]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/colour.h
Spelling correction.
[wxWidgets.git] / include / wx / cocoa / colour.h
CommitLineData
a24aff65
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: colour.h
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
a24aff65
DE
9// Licence: wxWindows licence
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// ========================================================================
a24aff65
DE
21class WXDLLEXPORT wxColour: public wxObject
22{
23public:
683b185d
DE
24 DECLARE_DYNAMIC_CLASS(wxColour)
25// ------------------------------------------------------------------------
26// initialization
27// ------------------------------------------------------------------------
28 wxColour();
a24aff65 29 // from RGB
683b185d
DE
30 wxColour( unsigned char red, unsigned char green, unsigned char blue )
31 : m_cocoaNSColor(NULL)
32 { Set(red,green,blue); }
33 wxColour( unsigned long colRGB )
34 : m_cocoaNSColor(NULL)
35 { Set(colRGB); }
a24aff65
DE
36
37 // implicit conversion from the colour name
683b185d
DE
38 wxColour( const wxString &colourName )
39 : m_cocoaNSColor(NULL)
40 { InitFromName(colourName); }
41 wxColour( const char *colourName )
42 : m_cocoaNSColor(NULL)
43 { InitFromName(wxString::FromAscii(colourName)); }
a24aff65
DE
44
45 // copy ctors and assignment operators
683b185d
DE
46 wxColour( const wxColour& col );
47 wxColour& operator = ( const wxColour& col );
a24aff65 48
683b185d 49 ~wxColour();
a24aff65 50
683b185d
DE
51// ------------------------------------------------------------------------
52// Implementation
53// ------------------------------------------------------------------------
54 // accessors
55 bool Ok() const { return m_cocoaNSColor; }
a24aff65 56
683b185d
DE
57 unsigned char Red() const { return m_red; }
58 unsigned char Green() const { return m_green; }
59 unsigned char Blue() const { return m_blue; }
a24aff65 60
683b185d
DE
61 // comparison
62 bool operator == (const wxColour& colour) const
63 {
64 return (m_cocoaNSColor == colour.m_cocoaNSColor &&
a24aff65
DE
65 m_red == colour.m_red &&
66 m_green == colour.m_green &&
67 m_blue == colour.m_blue);
683b185d
DE
68 }
69 bool operator != (const wxColour& colour) const
70 { return !(*this == colour); }
a24aff65
DE
71
72// const WXCOLORREF& GetPixel() const { return m_pixel; };
73
683b185d
DE
74 // Set() functions
75 void Set( unsigned char red, unsigned char green, unsigned char blue );
76 void Set( unsigned long colRGB )
77 {
78 // we don't need to know sizeof(long) here because we assume that the three
79 // least significant bytes contain the R, G and B values
80 Set((unsigned char)colRGB,
81 (unsigned char)(colRGB >> 8),
82 (unsigned char)(colRGB >> 16));
83 }
a24aff65 84
683b185d
DE
85protected:
86 void InitFromName(const wxString& col);
a24aff65
DE
87
88private:
683b185d
DE
89 WX_NSColor m_cocoaNSColor;
90 unsigned char m_red;
91 unsigned char m_green;
92 unsigned char m_blue;
a24aff65
DE
93};
94
683b185d 95#endif // __WX_COCOA_COLOUR_H__