]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: palette.h | |
3 | // Purpose: wxPalette class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/12/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_PALETTE_H_ | |
13 | #define _WX_PALETTE_H_ | |
14 | ||
15 | #include "wx/gdiobj.h" | |
16 | #include "wx/os2/private.h" | |
17 | ||
18 | class WXDLLEXPORT wxPalette; | |
19 | ||
20 | class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData | |
21 | { | |
22 | friend class WXDLLEXPORT wxPalette; | |
23 | public: | |
24 | wxPaletteRefData(); | |
25 | ~wxPaletteRefData(); | |
26 | // protected: | |
27 | WXHPALETTE m_hPalette; | |
28 | HPS m_hPS; | |
29 | }; // end of CLASS wxPaletteRefData | |
30 | ||
31 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
32 | ||
33 | class WXDLLEXPORT wxPalette: public wxGDIObject | |
34 | { | |
35 | DECLARE_DYNAMIC_CLASS(wxPalette) | |
36 | ||
37 | public: | |
38 | wxPalette(); | |
39 | inline wxPalette(const wxPalette& rPalette) { Ref(rPalette); } | |
40 | ||
41 | wxPalette( int n | |
42 | ,const unsigned char* pRed | |
43 | ,const unsigned char* pGreen | |
44 | ,const unsigned char* pBlue | |
45 | ); | |
46 | ~wxPalette(); | |
47 | ||
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; | |
62 | ||
63 | virtual bool Ok(void) const { return (m_refData != NULL) ; } | |
64 | ||
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; } | |
68 | ||
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 | |
75 | ||
76 | #define wxColorMap wxPalette | |
77 | #define wxColourMap wxPalette | |
78 | ||
79 | #endif | |
80 | // _WX_PALETTE_H_ | |
81 |