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