]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: colour.h | |
01b2eeec KB |
3 | // Purpose: wxColour class |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
7c78e7c7 RR |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
01b2eeec KB |
12 | #ifndef _WX_COLOUR_H_ |
13 | #define _WX_COLOUR_H_ | |
7c78e7c7 RR |
14 | |
15 | #ifdef __GNUG__ | |
01b2eeec | 16 | #pragma interface "colour.h" |
7c78e7c7 RR |
17 | #endif |
18 | ||
01b2eeec KB |
19 | // Colour |
20 | class WXDLLEXPORT wxColour: public wxObject | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxColour) | |
23 | public: | |
24 | wxColour(); | |
25 | wxColour(unsigned char r, unsigned char g, unsigned char b); | |
26 | wxColour(unsigned long colRGB) { Set(colRGB); } | |
27 | wxColour(const wxColour& col); | |
28 | wxColour(const wxString& col); | |
29 | ~wxColour() ; | |
30 | wxColour& operator =(const wxColour& src) ; | |
31 | wxColour& operator =(const wxString& src) ; | |
32 | inline int Ok() const { return (m_isInit) ; } | |
7c78e7c7 | 33 | |
01b2eeec KB |
34 | void Set(unsigned char r, unsigned char g, unsigned char b); |
35 | void Set(unsigned long colRGB) | |
36 | { | |
37 | // we don't need to know sizeof(long) here because we assume that the three | |
38 | // least significant bytes contain the R, G and B values | |
39 | Set((unsigned char)colRGB, | |
40 | (unsigned char)(colRGB >> 8), | |
41 | (unsigned char)(colRGB >> 16)); | |
42 | } | |
7c78e7c7 | 43 | |
01b2eeec KB |
44 | inline unsigned char Red() const { return m_red; } |
45 | inline unsigned char Green() const { return m_green; } | |
46 | inline unsigned char Blue() const { return m_blue; } | |
7c78e7c7 | 47 | |
01b2eeec | 48 | inline bool operator == (const wxColour& colour) { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); } |
7c78e7c7 | 49 | |
01b2eeec | 50 | inline bool operator != (const wxColour& colour) { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); } |
7c78e7c7 | 51 | |
01b2eeec | 52 | WXCOLORREF GetPixel() const { return m_pixel; }; |
7c78e7c7 | 53 | |
01b2eeec KB |
54 | private: |
55 | bool m_isInit; | |
56 | unsigned char m_red; | |
57 | unsigned char m_blue; | |
58 | unsigned char m_green; | |
59 | public: | |
60 | /* TODO: implementation | |
61 | WXCOLORREF m_pixel ; | |
62 | */ | |
63 | }; | |
7c78e7c7 | 64 | |
01b2eeec | 65 | #define wxColor wxColour |
7c78e7c7 | 66 | |
01b2eeec KB |
67 | #endif |
68 | // _WX_COLOUR_H_ |