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