1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPalette class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PALETTE_H_
13 #define _WX_PALETTE_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "palette.h"
19 #include "wx/colour.h"
20 #include "wx/gdiobj.h"
22 class WXDLLEXPORT wxPalette
;
24 class WXDLLEXPORT wxPaletteRefData
: public wxGDIRefData
26 DECLARE_NO_COPY_CLASS(wxPaletteRefData
)
28 friend class WXDLLEXPORT wxPalette
;
37 #define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
39 class WXDLLEXPORT wxPalette
: public wxGDIObject
41 DECLARE_DYNAMIC_CLASS(wxPalette
)
45 wxPalette(const wxPalette
& palette
)
49 wxPalette(int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue
);
51 bool Create(int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue
);
52 int GetPixel(const unsigned char red
, const unsigned char green
, const unsigned char blue
) const;
53 bool GetRGB(int pixel
, unsigned char *red
, unsigned char *green
, unsigned char *blue
) const;
55 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
57 inline wxPalette
& operator = (const wxPalette
& palette
) { if (*this == palette
) return (*this); Ref(palette
); return *this; }
58 inline bool operator == (const wxPalette
& palette
) { return m_refData
== palette
.m_refData
; }
59 inline bool operator != (const wxPalette
& palette
) { return m_refData
!= palette
.m_refData
; }
61 /* TODO: implementation
62 inline WXHPALETTE GetHPALETTE() const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
63 void SetHPALETTE(WXHPALETTE pal);