]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/palette.h
fix for CW compilation
[wxWidgets.git] / include / wx / os2 / palette.h
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) const
67 { return m_refData == rPalette.m_refData; }
68 inline bool operator != (const wxPalette& rPalette) const
69 { return m_refData != rPalette.m_refData; }
70
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
77
78 #define wxColorMap wxPalette
79 #define wxColourMap wxPalette
80
81 #endif
82 // _WX_PALETTE_H_
83