]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/colour.h
remove file containing many obsolete defines, if anyone wants to revive MicroWindows...
[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
WS
21
22class WXDLLEXPORT wxColour : public wxColourBase
a24aff65
DE
23{
24public:
edc536d3
WS
25 // constructors
26 // ------------
27
28 // default
211436b6 29 wxColour() { Init(); }
6304d5b4
VZ
30
31 // the other standard ones: notice that we can't use
32 // DEFINE_STD_WXCOLOUR_CONSTRUCTORS here because we need to call Init() to
33 // initialize m_cocoaNSColor and the macro doesn't do it
34 wxColour( ChannelType red, ChannelType green, ChannelType blue,
35 ChannelType alpha = wxALPHA_OPAQUE )
36 { Init(); Set(red, green, blue, alpha); }
37 wxColour(unsigned long colRGB) { Init(); Set(colRGB); }
e86d4e59 38 wxColour(const wxString& colourName) { Init(); Set(colourName); }
d23bf09c
DE
39 wxColour(const char *colourName) { Init(); Set(colourName); }
40 wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
aad6765c 41
d8fdd58f
DE
42 // initialization using existing NSColor
43 wxColour( WX_NSColor aColor );
44
a24aff65
DE
45
46 // copy ctors and assignment operators
683b185d
DE
47 wxColour( const wxColour& col );
48 wxColour& operator = ( const wxColour& col );
a24aff65 49
211436b6 50 virtual ~wxColour();
a24aff65 51
683b185d 52 // accessors
b7cacb43
VZ
53 bool Ok() const { return IsOk(); }
54 bool IsOk() const { return m_cocoaNSColor; }
211436b6 55 WX_NSColor GetNSColor() { 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; }
71064979 60 unsigned char Alpha() const { return m_alpha; }
a24aff65 61
683b185d
DE
62 // comparison
63 bool operator == (const wxColour& colour) const
64 {
71064979
VZ
65 return m_cocoaNSColor == colour.m_cocoaNSColor ||
66 (m_red == colour.m_red &&
67 m_green == colour.m_green &&
68 m_blue == colour.m_blue &&
69 m_alpha == colour.m_alpha);
683b185d
DE
70 }
71 bool operator != (const wxColour& colour) const
71064979 72 { return !(*this == colour); }
a24aff65 73
683b185d 74 // Set() functions
d8fdd58f 75 void Set( WX_NSColor aColor );
71064979 76
747592e7 77 // reroute the inherited ones
71064979
VZ
78 void Set(unsigned char red,
79 unsigned char green,
80 unsigned char blue,
81 unsigned char alpha = wxALPHA_OPAQUE)
82 { wxColourBase::Set(red, green, blue, alpha); }
83
747592e7 84 bool Set(const wxString &str)
71064979
VZ
85 { return wxColourBase::Set(str); }
86
747592e7 87 void Set(unsigned long colRGB)
71064979
VZ
88 { wxColourBase::Set(colRGB); }
89
211436b6
VZ
90protected:
91 // puts the object in an invalid, uninitialized state
92 void Init();
93
aea95b1c
VZ
94 virtual void
95 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
a24aff65
DE
96
97private:
683b185d
DE
98 WX_NSColor m_cocoaNSColor;
99 unsigned char m_red;
100 unsigned char m_green;
101 unsigned char m_blue;
71064979 102 unsigned char m_alpha;
211436b6
VZ
103
104 DECLARE_DYNAMIC_CLASS(wxColour)
a24aff65
DE
105};
106
683b185d 107#endif // __WX_COCOA_COLOUR_H__