]>
Commit | Line | Data |
---|---|---|
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 | // 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) ; } | |
33 | ||
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 | } | |
43 | ||
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; } | |
47 | ||
48 | inline bool operator == (const wxColour& colour) { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); } | |
49 | ||
50 | inline bool operator != (const wxColour& colour) { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); } | |
51 | ||
52 | WXCOLORREF GetPixel() const { return m_pixel; }; | |
53 | ||
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 | }; | |
64 | ||
65 | #define wxColor wxColour | |
66 | ||
67 | #endif | |
68 | // _WX_COLOUR_H_ |