]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/palette.h
created a reusable interface to dbghelp API
[wxWidgets.git] / include / wx / x11 / palette.h
CommitLineData
83df96d6
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: palette.h
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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
83df96d6
JS
16#pragma interface "palette.h"
17#endif
18
19#include "wx/gdiobj.h"
20#include "wx/list.h"
21
22class WXDLLEXPORT wxPalette;
23
24// Palette for one display
25class wxXPalette : public wxObject
26{
27 DECLARE_DYNAMIC_CLASS(wxXPalette)
917be7ed 28
83df96d6
JS
29public:
30 wxXPalette();
917be7ed 31
83df96d6
JS
32 WXDisplay* m_display;
33 int m_pix_array_n;
34 unsigned long* m_pix_array;
35 WXColormap m_cmap;
36 bool m_destroyable;
37};
38
39class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
40{
41 friend class WXDLLEXPORT wxPalette;
42public:
43 wxPaletteRefData();
44 ~wxPaletteRefData();
917be7ed 45
83df96d6
JS
46protected:
47 wxList m_palettes;
48};
49
50#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
51
917be7ed 52class WXDLLEXPORT wxPalette: public wxPaletteBase
83df96d6
JS
53{
54 DECLARE_DYNAMIC_CLASS(wxPalette)
917be7ed 55
83df96d6
JS
56public:
57 wxPalette();
58 wxPalette(const wxPalette& palette) { Ref(palette); }
917be7ed 59
83df96d6
JS
60 wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
61 ~wxPalette();
62 bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
63 int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
64 bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
917be7ed 65
83df96d6 66 virtual bool Ok() const { return (m_refData != NULL) ; }
917be7ed 67
83df96d6
JS
68 wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
69 bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; }
70 bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; }
917be7ed 71
7266b672 72 // X-specific
83df96d6
JS
73 WXColormap GetXColormap(WXDisplay* display = NULL) const;
74 bool TransferBitmap(void *data, int depth, int size);
75 bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);
76 unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n);
77 void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable);
78};
79
80#endif
81// _WX_PALETTE_H_