]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/palette.h | |
3 | // Purpose: wxPalette class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/12/99 | |
7 | // Copyright: (c) David Webster | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_PALETTE_H_ | |
12 | #define _WX_PALETTE_H_ | |
13 | ||
14 | #include "wx/gdiobj.h" | |
15 | #include "wx/os2/private.h" | |
16 | ||
17 | class WXDLLIMPEXP_FWD_CORE wxPalette; | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData | |
20 | { | |
21 | friend class WXDLLIMPEXP_FWD_CORE wxPalette; | |
22 | public: | |
23 | wxPaletteRefData(); | |
24 | virtual ~wxPaletteRefData(); | |
25 | // protected: | |
26 | WXHPALETTE m_hPalette; | |
27 | HPS m_hPS; | |
28 | }; // end of CLASS wxPaletteRefData | |
29 | ||
30 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
31 | ||
32 | class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase | |
33 | { | |
34 | public: | |
35 | wxPalette(); | |
36 | ||
37 | wxPalette( int n | |
38 | ,const unsigned char* pRed | |
39 | ,const unsigned char* pGreen | |
40 | ,const unsigned char* pBlue | |
41 | ); | |
42 | virtual ~wxPalette(); | |
43 | ||
44 | bool Create( int n | |
45 | ,const unsigned char* pRed | |
46 | ,const unsigned char* pGreen | |
47 | ,const unsigned char* pBlue | |
48 | ); | |
49 | int GetPixel( unsigned char cRed | |
50 | ,unsigned char cGreen | |
51 | ,unsigned char cBlue | |
52 | ) const; | |
53 | bool GetRGB( int nPixel | |
54 | ,unsigned char* pRed | |
55 | ,unsigned char* pGreen | |
56 | ,unsigned char* pBlue | |
57 | ) const; | |
58 | ||
59 | virtual bool FreeResource(bool bForce = false); | |
60 | ||
61 | inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } | |
62 | void SetHPALETTE(WXHPALETTE hPalette); | |
63 | void SetPS(HPS hPS); | |
64 | ||
65 | protected: | |
66 | virtual wxGDIRefData *CreateGDIRefData() const; | |
67 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
68 | ||
69 | private: | |
70 | DECLARE_DYNAMIC_CLASS(wxPalette) | |
71 | }; // end of CLASS wxPalette | |
72 | ||
73 | #endif | |
74 | // _WX_PALETTE_H_ |