]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/palette.h
added Mark Newsam's patch
[wxWidgets.git] / include / wx / mac / palette.h
CommitLineData
0dbd6262
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: palette.h
3// Purpose: wxPalette class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PALETTE_H_
13#define _WX_PALETTE_H_
14
15#ifdef __GNUG__
16#pragma interface "palette.h"
17#endif
18
03e11df5 19#include "wx/colour.h"
0dbd6262
SC
20#include "wx/gdiobj.h"
21
22class WXDLLEXPORT wxPalette;
23
24class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
25{
be52b341
GD
26 DECLARE_NO_COPY_CLASS(wxPaletteRefData)
27
0dbd6262
SC
28 friend class WXDLLEXPORT wxPalette;
29public:
30 wxPaletteRefData();
31 ~wxPaletteRefData();
0dbd6262 32protected:
be52b341
GD
33 wxColour* m_palette;
34 wxInt32 m_count ;
0dbd6262
SC
35};
36
37#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
38
39class WXDLLEXPORT wxPalette: public wxGDIObject
40{
41 DECLARE_DYNAMIC_CLASS(wxPalette)
42
43public:
44 wxPalette();
be52b341
GD
45 wxPalette(const wxPalette& palette)
46 : wxGDIObject()
47 { Ref(palette); }
0dbd6262
SC
48
49 wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
50 ~wxPalette();
51 bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
52 int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
53 bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
54
55 virtual bool Ok() const { return (m_refData != NULL) ; }
56
57 inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
58 inline bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; }
59 inline bool operator != (const wxPalette& palette) { return m_refData != palette.m_refData; }
60
61/* TODO: implementation
62 inline WXHPALETTE GetHPALETTE() const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
63 void SetHPALETTE(WXHPALETTE pal);
64*/
65};
66
67#endif
68 // _WX_PALETTE_H_