]>
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 | // 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 | virtual ~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 wxPaletteBase | |
34 | { | |
35 | DECLARE_DYNAMIC_CLASS(wxPalette) | |
36 | ||
37 | public: | |
38 | wxPalette(); | |
39 | ||
40 | wxPalette( int n | |
41 | ,const unsigned char* pRed | |
42 | ,const unsigned char* pGreen | |
43 | ,const unsigned char* pBlue | |
44 | ); | |
45 | virtual ~wxPalette(); | |
46 | ||
47 | bool Create( int n | |
48 | ,const unsigned char* pRed | |
49 | ,const unsigned char* pGreen | |
50 | ,const unsigned char* pBlue | |
51 | ); | |
52 | int GetPixel( unsigned char cRed | |
53 | ,unsigned char cGreen | |
54 | ,unsigned char cBlue | |
55 | ) const; | |
56 | bool GetRGB( int nPixel | |
57 | ,unsigned char* pRed | |
58 | ,unsigned char* pGreen | |
59 | ,unsigned char* pBlue | |
60 | ) const; | |
61 | ||
62 | virtual bool Ok() const { return IsOk(); } | |
63 | virtual bool IsOk(void) const { return (m_refData != NULL) ; } | |
64 | ||
65 | inline bool operator == (const wxPalette& rPalette) const | |
66 | { return m_refData == rPalette.m_refData; } | |
67 | inline bool operator != (const wxPalette& rPalette) const | |
68 | { return m_refData != rPalette.m_refData; } | |
69 | ||
70 | virtual bool FreeResource(bool bForce = false); | |
71 | ||
72 | inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } | |
73 | void SetHPALETTE(WXHPALETTE hPalette); | |
74 | void SetPS(HPS hPS); | |
75 | }; // end of CLASS wxPalette | |
76 | ||
77 | #endif | |
78 | // _WX_PALETTE_H_ |