]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: palette.h | |
3 | // Purpose: wxPalette class | |
cdf1e714 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
cdf1e714 | 6 | // Created: 10/12/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
cdf1e714 | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_PALETTE_H_ | |
13 | #define _WX_PALETTE_H_ | |
14 | ||
0e320a79 | 15 | #include "wx/gdiobj.h" |
48c82007 | 16 | #include "wx/os2/private.h" |
0e320a79 DW |
17 | |
18 | class WXDLLEXPORT wxPalette; | |
19 | ||
20 | class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData | |
21 | { | |
22 | friend class WXDLLEXPORT wxPalette; | |
23 | public: | |
24 | wxPaletteRefData(); | |
25 | ~wxPaletteRefData(); | |
65029152 | 26 | // protected: |
deb63b95 DW |
27 | WXHPALETTE m_hPalette; |
28 | HPS m_hPS; | |
29 | }; // end of CLASS wxPaletteRefData | |
0e320a79 DW |
30 | |
31 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
32 | ||
33 | class WXDLLEXPORT wxPalette: public wxGDIObject | |
34 | { | |
deb63b95 | 35 | DECLARE_DYNAMIC_CLASS(wxPalette) |
0e320a79 DW |
36 | |
37 | public: | |
deb63b95 DW |
38 | wxPalette(); |
39 | inline wxPalette(const wxPalette& rPalette) { Ref(rPalette); } | |
0e320a79 | 40 | |
deb63b95 DW |
41 | wxPalette( int n |
42 | ,const unsigned char* pRed | |
43 | ,const unsigned char* pGreen | |
44 | ,const unsigned char* pBlue | |
45 | ); | |
46 | ~wxPalette(); | |
0e320a79 | 47 | |
deb63b95 DW |
48 | bool Create( int n |
49 | ,const unsigned char* pRed | |
50 | ,const unsigned char* pGreen | |
51 | ,const unsigned char* pBlue | |
52 | ); | |
53 | int GetPixel( const unsigned char cRed | |
54 | ,const unsigned char cGreen | |
55 | ,const unsigned char cBlue | |
56 | ) const; | |
57 | bool GetRGB( int nPixel | |
58 | ,unsigned char* pRed | |
59 | ,unsigned char* pGreen | |
60 | ,unsigned char* pBlue | |
61 | ) const; | |
0e320a79 | 62 | |
deb63b95 | 63 | virtual bool Ok(void) const { return (m_refData != NULL) ; } |
0e320a79 | 64 | |
deb63b95 | 65 | inline wxPalette& operator = (const wxPalette& rPalette) { if (*this == rPalette) return (*this); Ref(rPalette); return *this; } |
0e70f525 SN |
66 | inline bool operator == (const wxPalette& rPalette) const |
67 | { return m_refData == rPalette.m_refData; } | |
68 | inline bool operator != (const wxPalette& rPalette) const | |
69 | { return m_refData != rPalette.m_refData; } | |
cdf1e714 | 70 | |
deb63b95 DW |
71 | virtual bool FreeResource(bool bForce = FALSE); |
72 | ||
73 | inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } | |
74 | void SetHPALETTE(WXHPALETTE hPalette); | |
75 | void SetPS(HPS hPS); | |
76 | }; // end of CLASS wxPalette | |
0e320a79 | 77 | |
cdf1e714 DW |
78 | #define wxColorMap wxPalette |
79 | #define wxColourMap wxPalette | |
80 | ||
0e320a79 DW |
81 | #endif |
82 | // _WX_PALETTE_H_ | |
cdf1e714 | 83 |