]>
Commit | Line | Data |
---|---|---|
83df96d6 | 1 | ///////////////////////////////////////////////////////////////////////////// |
88ef3a57 | 2 | // Name: wx/x11/palette.h |
83df96d6 JS |
3 | // Purpose: wxPalette class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
65571936 | 9 | // Licence: wxWindows licence |
83df96d6 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_PALETTE_H_ | |
13 | #define _WX_PALETTE_H_ | |
14 | ||
83df96d6 JS |
15 | #include "wx/list.h" |
16 | ||
b5dbe15d | 17 | class WXDLLIMPEXP_FWD_CORE wxPalette; |
83df96d6 JS |
18 | |
19 | // Palette for one display | |
20 | class wxXPalette : public wxObject | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxXPalette) | |
917be7ed | 23 | |
83df96d6 JS |
24 | public: |
25 | wxXPalette(); | |
917be7ed | 26 | |
83df96d6 JS |
27 | WXDisplay* m_display; |
28 | int m_pix_array_n; | |
29 | unsigned long* m_pix_array; | |
30 | WXColormap m_cmap; | |
31 | bool m_destroyable; | |
32 | }; | |
33 | ||
53a2db12 | 34 | class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData |
83df96d6 | 35 | { |
b5dbe15d | 36 | friend class WXDLLIMPEXP_FWD_CORE wxPalette; |
83df96d6 JS |
37 | public: |
38 | wxPaletteRefData(); | |
d3c7fc99 | 39 | virtual ~wxPaletteRefData(); |
917be7ed | 40 | |
83df96d6 JS |
41 | protected: |
42 | wxList m_palettes; | |
43 | }; | |
44 | ||
45 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
46 | ||
53a2db12 | 47 | class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase |
83df96d6 JS |
48 | { |
49 | DECLARE_DYNAMIC_CLASS(wxPalette) | |
917be7ed | 50 | |
83df96d6 JS |
51 | public: |
52 | wxPalette(); | |
917be7ed | 53 | |
83df96d6 | 54 | wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); |
d3c7fc99 | 55 | virtual ~wxPalette(); |
83df96d6 | 56 | bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); |
88ef3a57 | 57 | int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; |
83df96d6 | 58 | bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; |
917be7ed | 59 | |
7266b672 | 60 | // X-specific |
83df96d6 JS |
61 | WXColormap GetXColormap(WXDisplay* display = NULL) const; |
62 | bool TransferBitmap(void *data, int depth, int size); | |
63 | bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp); | |
64 | unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n); | |
65 | void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable); | |
8f884a0d VZ |
66 | |
67 | protected: | |
68 | virtual wxGDIRefData *CreateGDIRefData() const; | |
69 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
83df96d6 JS |
70 | }; |
71 | ||
8f884a0d | 72 | #endif // _WX_PALETTE_H_ |