]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/colour.h
Changed the wxPlatform syntax as per Vadim's suggestions
[wxWidgets.git] / include / wx / x11 / colour.h
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: wx/x11/colour.h
83df96d6 3// Purpose: wxColour class
3cd0b8c5 4// Author: Julian Smart, Robert Roebling
83df96d6
JS
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
3cd0b8c5 8// Copyright: (c) Julian Smart, Robert Roebling
edc536d3 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_COLOUR_H_
13#define _WX_COLOUR_H_
14
3cd0b8c5 15#include "wx/defs.h"
83df96d6
JS
16#include "wx/object.h"
17#include "wx/string.h"
3cd0b8c5
RR
18#include "wx/gdiobj.h"
19#include "wx/palette.h"
83df96d6 20
3cd0b8c5
RR
21//-----------------------------------------------------------------------------
22// classes
23//-----------------------------------------------------------------------------
24
968eb2ef
MW
25class WXDLLIMPEXP_CORE wxDC;
26class WXDLLIMPEXP_CORE wxPaintDC;
27class WXDLLIMPEXP_CORE wxBitmap;
28class WXDLLIMPEXP_CORE wxWindow;
3cd0b8c5 29
968eb2ef 30class WXDLLIMPEXP_CORE wxColour;
3cd0b8c5
RR
31
32//-----------------------------------------------------------------------------
33// wxColour
34//-----------------------------------------------------------------------------
35
aad6765c 36class WXDLLEXPORT wxColour: public wxGDIObject
83df96d6 37{
83df96d6 38public:
edc536d3
WS
39 // constructors
40 // ------------
41
42 // default
3cd0b8c5 43 wxColour() { }
aad6765c 44
edc536d3 45 // from separate RGB
83df96d6 46 wxColour( unsigned char red, unsigned char green, unsigned char blue );
edc536d3
WS
47
48 // from packed RGB
83df96d6 49 wxColour( unsigned long colRGB ) { Set(colRGB); }
3cd0b8c5
RR
50
51 // Implicit conversion from the colour name
83df96d6 52 wxColour( const wxString &colourName ) { InitFromName(colourName); }
2b5f62a0
VZ
53 wxColour( const char *colourName ) { InitFromName( wxString::FromAscii(colourName) ); }
54#if wxUSE_UNICODE
55 wxColour( const wxChar *colourName ) { InitFromName( wxString(colourName) ); }
56#endif
3cd0b8c5 57
564a150b
VZ
58 // Get colour from name or wxNullColour
59 static wxColour CreateByName(const wxString& name);
60
83df96d6 61 ~wxColour();
3cd0b8c5
RR
62
63 bool Ok() const { return m_refData != NULL; }
aad6765c 64
3cd0b8c5
RR
65 bool operator == ( const wxColour& col ) const;
66 bool operator != ( const wxColour& col ) const { return !(*this == col); }
67
83df96d6
JS
68 void Set( unsigned char red, unsigned char green, unsigned char blue );
69 void Set( unsigned long colRGB )
70 {
3cd0b8c5 71 // We don't need to know sizeof(long) here because we assume that the three
83df96d6
JS
72 // least significant bytes contain the R, G and B values
73 Set((unsigned char)colRGB,
74 (unsigned char)(colRGB >> 8),
75 (unsigned char)(colRGB >> 16));
76 }
3cd0b8c5
RR
77
78 unsigned char Red() const;
79 unsigned char Green() const;
80 unsigned char Blue() const;
81
82 // Implementation part
aad6765c 83
3cd0b8c5
RR
84 void CalcPixel( WXColormap cmap );
85 unsigned long GetPixel() const;
86 WXColor *GetColor() const;
87
aad6765c
JS
88 void InitFromName(const wxString& colourName);
89
3cd0b8c5
RR
90protected:
91 // ref counting code
92 virtual wxObjectRefData *CreateRefData() const;
93 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
aad6765c 94
3cd0b8c5 95
83df96d6 96private:
3cd0b8c5 97 DECLARE_DYNAMIC_CLASS(wxColour)
83df96d6
JS
98};
99
100#endif
3cd0b8c5 101
e5053ade 102// _WX_COLOUR_H_