]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/colour.h
Added possibility of 2-step initialisation, and wxWIZARD_EX_HELPBUTTON style.
[wxWidgets.git] / include / wx / mac / colour.h
CommitLineData
0dbd6262
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: colour.h
3// Purpose: wxColour class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_COLOUR_H_
13#define _WX_COLOUR_H_
14
15#ifdef __GNUG__
16#pragma interface "colour.h"
17#endif
18
19#include "wx/object.h"
20#include "wx/string.h"
21
22// Colour
23class WXDLLEXPORT wxColour: public wxObject
24{
25public:
26 // ctors
27 // default
28 wxColour();
29 // from RGB
30 wxColour( unsigned char red, unsigned char green, unsigned char blue );
a789c01d
GD
31 wxColour( unsigned long colRGB ) { Set(colRGB); }
32
0dbd6262
SC
33 // implicit conversion from the colour name
34 wxColour( const wxString &colourName ) { InitFromName(colourName); }
35 wxColour( const char *colourName ) { InitFromName(colourName); }
36
37 // copy ctors and assignment operators
38 wxColour( const wxColour& col );
39 wxColour( const wxColour* col );
40 wxColour& operator = ( const wxColour& col );
41
42 // dtor
43 ~wxColour();
44
45 // Set() functions
46 void Set( unsigned char red, unsigned char green, unsigned char blue );
47 void Set( unsigned long colRGB )
48 {
49 // we don't need to know sizeof(long) here because we assume that the three
50 // least significant bytes contain the R, G and B values
51 Set((unsigned char)colRGB,
52 (unsigned char)(colRGB >> 8),
53 (unsigned char)(colRGB >> 16));
54 }
55
56 // accessors
57 bool Ok() const {return m_isInit; }
58
59 // Let's remove this inelegant function
60#if WXWIN_COMPATIBILITY
61 void Get(unsigned char *r, unsigned char *g, unsigned char *b) const;
62#endif
63
64 unsigned char Red() const { return m_red; }
65 unsigned char Green() const { return m_green; }
66 unsigned char Blue() const { return m_blue; }
67
68 // comparison
e7549107 69 bool operator == (const wxColour& colour) const
0dbd6262
SC
70 {
71 return (m_red == colour.m_red &&
72 m_green == colour.m_green &&
73 m_blue == colour.m_blue);
74 }
75 bool operator != (const wxColour& colour) { return !(*this == colour); }
76
77 void InitFromName(const wxString& col);
78
519cb848 79 const WXCOLORREF GetPixel() const { return m_pixel; };
0dbd6262
SC
80
81private:
82 bool m_isInit;
83 unsigned char m_red;
84 unsigned char m_blue;
85 unsigned char m_green;
86
87public:
519cb848
SC
88 WXCOLORREF m_pixel ;
89 void Set( WXCOLORREF color ) { m_pixel = color ; m_red = m_pixel.red>>8 ;m_blue = m_pixel.blue>>8 ;m_green = m_pixel.green>>8 ;}
0dbd6262
SC
90
91private:
92 DECLARE_DYNAMIC_CLASS(wxColour)
93};
94
95#endif
96 // _WX_COLOUR_H_