]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/palette.h
Fixed comment bug [ 1390056 ] Wrong Documentation for TransferFromWindow
[wxWidgets.git] / include / wx / motif / palette.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/motif/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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PALETTE_H_
13#define _WX_PALETTE_H_
14
15#include "wx/gdiobj.h"
16#include "wx/list.h"
17
18class WXDLLEXPORT wxPalette;
19
20// Palette for one display
21class wxXPalette : public wxObject
22{
23 DECLARE_DYNAMIC_CLASS(wxXPalette)
24
25public:
26 wxXPalette();
27
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
35class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
36{
37 friend class WXDLLEXPORT wxPalette;
38public:
39 wxPaletteRefData();
40 ~wxPaletteRefData();
41
42protected:
43 wxList m_palettes;
44};
45
46#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
47
48class WXDLLEXPORT wxPalette: public wxPaletteBase
49{
50 DECLARE_DYNAMIC_CLASS(wxPalette)
51
52public:
53 wxPalette();
54 wxPalette(const wxPalette& palette) { Ref(palette); }
55
56 wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
57 ~wxPalette();
58 bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
59 int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
60 bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
61
62 virtual bool Ok() const { return (m_refData != NULL) ; }
63
64 wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
65 bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; }
66 bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; }
67
68 // Motif-specific
69 WXColormap GetXColormap(WXDisplay* display = NULL) const;
70 bool TransferBitmap(void *data, int depth, int size);
71 bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);
72 unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n);
73 void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable);
74};
75
76#endif
77// _WX_PALETTE_H_