]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/palette.h
don't crash if (char*)c_str() is used twice in a row on the same string and both...
[wxWidgets.git] / include / wx / os2 / palette.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
88ef3a57 2// Name: wx/os2/palette.h
0e320a79 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 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PALETTE_H_
13#define _WX_PALETTE_H_
14
0e320a79 15#include "wx/gdiobj.h"
48c82007 16#include "wx/os2/private.h"
0e320a79
DW
17
18class WXDLLEXPORT wxPalette;
19
20class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
21{
22 friend class WXDLLEXPORT wxPalette;
23public:
24 wxPaletteRefData();
d3c7fc99 25 virtual ~wxPaletteRefData();
65029152 26// protected:
deb63b95
DW
27 WXHPALETTE m_hPalette;
28 HPS m_hPS;
29}; // end of CLASS wxPaletteRefData
0e320a79
DW
30
31#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
32
917be7ed 33class WXDLLEXPORT wxPalette: public wxPaletteBase
0e320a79 34{
deb63b95 35 DECLARE_DYNAMIC_CLASS(wxPalette)
0e320a79
DW
36
37public:
deb63b95 38 wxPalette();
0e320a79 39
deb63b95
DW
40 wxPalette( int n
41 ,const unsigned char* pRed
42 ,const unsigned char* pGreen
43 ,const unsigned char* pBlue
44 );
d3c7fc99 45 virtual ~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 );
88ef3a57
WS
52 int GetPixel( unsigned char cRed
53 ,unsigned char cGreen
54 ,unsigned char cBlue
deb63b95
DW
55 ) const;
56 bool GetRGB( int nPixel
57 ,unsigned char* pRed
58 ,unsigned char* pGreen
59 ,unsigned char* pBlue
60 ) const;
0e320a79 61
b7cacb43
VZ
62 virtual bool Ok() const { return IsOk(); }
63 virtual bool IsOk(void) const { return (m_refData != NULL) ; }
0e320a79 64
917be7ed 65 virtual bool FreeResource(bool bForce = false);
deb63b95
DW
66
67 inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
68 void SetHPALETTE(WXHPALETTE hPalette);
69 void SetPS(HPS hPS);
70}; // end of CLASS wxPalette
0e320a79
DW
71
72#endif
73 // _WX_PALETTE_H_