]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/palette.cpp
* Fixes
[wxWidgets.git] / src / gtk / palette.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: palette.cpp
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6// Id:
7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11
12#ifdef __GNUG__
13#pragma implementation "palette.h"
14#endif
15
16#include "wx/palette.h"
17
18//-----------------------------------------------------------------------------
19// wxPalette
20//-----------------------------------------------------------------------------
21
22class wxPaletteRefData: public wxObjectRefData
23{
24 public:
8bbe427f 25
c801d85f
KB
26 wxPaletteRefData(void);
27 ~wxPaletteRefData(void);
8bbe427f 28
c801d85f
KB
29 GdkColormap *m_colormap;
30};
31
8bbe427f 32wxPaletteRefData::wxPaletteRefData()
c801d85f 33{
c67daf87 34 m_colormap = (GdkColormap *) NULL;
c801d85f
KB
35};
36
8bbe427f 37wxPaletteRefData::~wxPaletteRefData()
c801d85f
KB
38{
39 if (m_colormap) gdk_colormap_unref( m_colormap );
40};
41
42//-----------------------------------------------------------------------------
43
44#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
45
46IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
47
8bbe427f 48wxPalette::wxPalette()
c801d85f
KB
49{
50};
51
debe6624 52wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue )
c801d85f
KB
53{
54 m_refData = new wxPaletteRefData();
55 Create( n, red, green, blue );
56};
57
58wxPalette::wxPalette( const wxPalette& palette )
59{
60 Ref( palette );
61};
62
8bbe427f 63wxPalette::~wxPalette()
c801d85f
KB
64{
65};
66
67wxPalette& wxPalette::operator = ( const wxPalette& palette )
68{
8bbe427f
VZ
69 if (*this == palette) return (*this);
70 Ref( palette );
71 return *this;
c801d85f
KB
72};
73
74bool wxPalette::operator == ( const wxPalette& palette )
75{
8bbe427f 76 return m_refData == palette.m_refData;
c801d85f
KB
77};
78
79bool wxPalette::operator != ( const wxPalette& palette )
80{
8bbe427f 81 return m_refData != palette.m_refData;
c801d85f
KB
82};
83
84bool wxPalette::Ok(void) const
85{
86 return (m_refData);
87};
88
aeeb6a44
RR
89bool wxPalette::Create( int WXUNUSED(n),
90 const unsigned char *WXUNUSED(red),
91 const unsigned char *WXUNUSED(green),
92 const unsigned char *WXUNUSED(blue) )
c801d85f 93{
47d67540
VZ
94 wxFAIL_MSG("not implemented");
95
96 return FALSE;
c801d85f
KB
97};
98
aeeb6a44
RR
99int wxPalette::GetPixel( const unsigned char WXUNUSED(red),
100 const unsigned char WXUNUSED(green),
101 const unsigned char WXUNUSED(blue) ) const
c801d85f 102{
47d67540
VZ
103 wxFAIL_MSG("not implemented");
104
105 return 0;
c801d85f
KB
106};
107
aeeb6a44
RR
108bool wxPalette::GetRGB( int WXUNUSED(pixel),
109 unsigned char *WXUNUSED(red),
110 unsigned char *WXUNUSED(green),
111 unsigned char *WXUNUSED(blue) ) const
c801d85f 112{
47d67540
VZ
113 wxFAIL_MSG("not implemented");
114
115 return 0;
c801d85f
KB
116};
117