]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: palette.h | |
3 | // Purpose: wxPalette class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
e40298d5 | 9 | // Licence: wxWindows licence |
0dbd6262 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_PALETTE_H_ | |
13 | #define _WX_PALETTE_H_ | |
14 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
0dbd6262 SC |
16 | #pragma interface "palette.h" |
17 | #endif | |
18 | ||
03e11df5 | 19 | #include "wx/colour.h" |
0dbd6262 SC |
20 | #include "wx/gdiobj.h" |
21 | ||
22 | class WXDLLEXPORT wxPalette; | |
23 | ||
24 | class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData | |
25 | { | |
be52b341 GD |
26 | DECLARE_NO_COPY_CLASS(wxPaletteRefData) |
27 | ||
0dbd6262 SC |
28 | friend class WXDLLEXPORT wxPalette; |
29 | public: | |
30 | wxPaletteRefData(); | |
31 | ~wxPaletteRefData(); | |
0dbd6262 | 32 | protected: |
be52b341 GD |
33 | wxColour* m_palette; |
34 | wxInt32 m_count ; | |
0dbd6262 SC |
35 | }; |
36 | ||
37 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
38 | ||
39 | class WXDLLEXPORT wxPalette: public wxGDIObject | |
40 | { | |
41 | DECLARE_DYNAMIC_CLASS(wxPalette) | |
42 | ||
43 | public: | |
44 | wxPalette(); | |
be52b341 GD |
45 | wxPalette(const wxPalette& palette) |
46 | : wxGDIObject() | |
47 | { Ref(palette); } | |
0dbd6262 SC |
48 | |
49 | wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); | |
50 | ~wxPalette(); | |
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; | |
54 | ||
55 | virtual bool Ok() const { return (m_refData != NULL) ; } | |
56 | ||
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; } | |
60 | ||
61 | /* TODO: implementation | |
62 | inline WXHPALETTE GetHPALETTE() const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } | |
63 | void SetHPALETTE(WXHPALETTE pal); | |
64 | */ | |
65 | }; | |
66 | ||
67 | #endif | |
68 | // _WX_PALETTE_H_ |