]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/x11/palette.h | |
3 | // Purpose: wxPalette class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // Copyright: (c) Julian Smart | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_PALETTE_H_ | |
12 | #define _WX_PALETTE_H_ | |
13 | ||
14 | #include "wx/list.h" | |
15 | ||
16 | class WXDLLIMPEXP_FWD_CORE wxPalette; | |
17 | ||
18 | // Palette for one display | |
19 | class wxXPalette : public wxObject | |
20 | { | |
21 | DECLARE_DYNAMIC_CLASS(wxXPalette) | |
22 | ||
23 | public: | |
24 | wxXPalette(); | |
25 | ||
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 | ||
33 | class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData | |
34 | { | |
35 | friend class WXDLLIMPEXP_FWD_CORE wxPalette; | |
36 | public: | |
37 | wxPaletteRefData(); | |
38 | virtual ~wxPaletteRefData(); | |
39 | ||
40 | protected: | |
41 | wxList m_palettes; | |
42 | }; | |
43 | ||
44 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
45 | ||
46 | class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase | |
47 | { | |
48 | DECLARE_DYNAMIC_CLASS(wxPalette) | |
49 | ||
50 | public: | |
51 | wxPalette(); | |
52 | ||
53 | wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); | |
54 | virtual ~wxPalette(); | |
55 | bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); | |
56 | int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; | |
57 | bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; | |
58 | ||
59 | // X-specific | |
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); | |
65 | ||
66 | protected: | |
67 | virtual wxGDIRefData *CreateGDIRefData() const; | |
68 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
69 | }; | |
70 | ||
71 | #endif // _WX_PALETTE_H_ |