]>
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 DW |
8 | // Copyright: (c) David Webster |
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 DW |
65 | inline wxPalette& operator = (const wxPalette& rPalette) { if (*this == rPalette) return (*this); Ref(rPalette); return *this; } |
66 | inline bool operator == (const wxPalette& rPalette) { return m_refData == rPalette.m_refData; } | |
67 | inline bool operator != (const wxPalette& rPalette) { return m_refData != rPalette.m_refData; } | |
cdf1e714 | 68 | |
deb63b95 DW |
69 | virtual bool FreeResource(bool bForce = FALSE); |
70 | ||
71 | inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } | |
72 | void SetHPALETTE(WXHPALETTE hPalette); | |
73 | void SetPS(HPS hPS); | |
74 | }; // end of CLASS wxPalette | |
0e320a79 | 75 | |
cdf1e714 DW |
76 | #define wxColorMap wxPalette |
77 | #define wxColourMap wxPalette | |
78 | ||
0e320a79 DW |
79 | #endif |
80 | // _WX_PALETTE_H_ | |
cdf1e714 | 81 |