]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/palette.h
added wxprec.h
[wxWidgets.git] / include / wx / os2 / palette.h
CommitLineData
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
DW
15#include "wx/gdiobj.h"
16
17class WXDLLEXPORT wxPalette;
18
19class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
20{
21 friend class WXDLLEXPORT wxPalette;
22public:
23 wxPaletteRefData();
24 ~wxPaletteRefData();
65029152 25// protected:
deb63b95
DW
26 WXHPALETTE m_hPalette;
27 HPS m_hPS;
28}; // end of CLASS wxPaletteRefData
0e320a79
DW
29
30#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
31
32class WXDLLEXPORT wxPalette: public wxGDIObject
33{
deb63b95 34 DECLARE_DYNAMIC_CLASS(wxPalette)
0e320a79
DW
35
36public:
deb63b95
DW
37 wxPalette();
38 inline wxPalette(const wxPalette& rPalette) { Ref(rPalette); }
0e320a79 39
deb63b95
DW
40 wxPalette( int n
41 ,const unsigned char* pRed
42 ,const unsigned char* pGreen
43 ,const unsigned char* pBlue
44 );
45 ~wxPalette();
0e320a79 46
deb63b95
DW
47 bool Create( int n
48 ,const unsigned char* pRed
49 ,const unsigned char* pGreen
50 ,const unsigned char* pBlue
51 );
52 int GetPixel( const unsigned char cRed
53 ,const unsigned char cGreen
54 ,const unsigned char cBlue
55 ) const;
56 bool GetRGB( int nPixel
57 ,unsigned char* pRed
58 ,unsigned char* pGreen
59 ,unsigned char* pBlue
60 ) const;
0e320a79 61
deb63b95 62 virtual bool Ok(void) const { return (m_refData != NULL) ; }
0e320a79 63
deb63b95
DW
64 inline wxPalette& operator = (const wxPalette& rPalette) { if (*this == rPalette) return (*this); Ref(rPalette); return *this; }
65 inline bool operator == (const wxPalette& rPalette) { return m_refData == rPalette.m_refData; }
66 inline bool operator != (const wxPalette& rPalette) { return m_refData != rPalette.m_refData; }
cdf1e714 67
deb63b95
DW
68 virtual bool FreeResource(bool bForce = FALSE);
69
70 inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
71 void SetHPALETTE(WXHPALETTE hPalette);
72 void SetPS(HPS hPS);
73}; // end of CLASS wxPalette
0e320a79 74
cdf1e714
DW
75#define wxColorMap wxPalette
76#define wxColourMap wxPalette
77
0e320a79
DW
78#endif
79 // _WX_PALETTE_H_
cdf1e714 80