]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/palette.cpp
Another solaris fix. :-<
[wxWidgets.git] / src / gtk1 / 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
83624f79
RR
18#include "gdk/gdk.h"
19
c801d85f
KB
20//-----------------------------------------------------------------------------
21// wxPalette
22//-----------------------------------------------------------------------------
23
24class wxPaletteRefData: public wxObjectRefData
25{
26 public:
8bbe427f 27
c801d85f
KB
28 wxPaletteRefData(void);
29 ~wxPaletteRefData(void);
8bbe427f 30
c801d85f
KB
31 GdkColormap *m_colormap;
32};
33
8bbe427f 34wxPaletteRefData::wxPaletteRefData()
c801d85f 35{
c67daf87 36 m_colormap = (GdkColormap *) NULL;
c801d85f
KB
37};
38
8bbe427f 39wxPaletteRefData::~wxPaletteRefData()
c801d85f
KB
40{
41 if (m_colormap) gdk_colormap_unref( m_colormap );
42};
43
44//-----------------------------------------------------------------------------
45
46#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
47
48IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
49
8bbe427f 50wxPalette::wxPalette()
c801d85f
KB
51{
52};
53
debe6624 54wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue )
c801d85f
KB
55{
56 m_refData = new wxPaletteRefData();
57 Create( n, red, green, blue );
58};
59
60wxPalette::wxPalette( const wxPalette& palette )
61{
62 Ref( palette );
63};
64
8bbe427f 65wxPalette::~wxPalette()
c801d85f
KB
66{
67};
68
69wxPalette& wxPalette::operator = ( const wxPalette& palette )
70{
8bbe427f
VZ
71 if (*this == palette) return (*this);
72 Ref( palette );
73 return *this;
c801d85f
KB
74};
75
76bool wxPalette::operator == ( const wxPalette& palette )
77{
8bbe427f 78 return m_refData == palette.m_refData;
c801d85f
KB
79};
80
81bool wxPalette::operator != ( const wxPalette& palette )
82{
8bbe427f 83 return m_refData != palette.m_refData;
c801d85f
KB
84};
85
86bool wxPalette::Ok(void) const
87{
88 return (m_refData);
89};
90
aeeb6a44
RR
91bool wxPalette::Create( int WXUNUSED(n),
92 const unsigned char *WXUNUSED(red),
93 const unsigned char *WXUNUSED(green),
94 const unsigned char *WXUNUSED(blue) )
c801d85f 95{
47d67540
VZ
96 wxFAIL_MSG("not implemented");
97
98 return FALSE;
c801d85f
KB
99};
100
aeeb6a44
RR
101int wxPalette::GetPixel( const unsigned char WXUNUSED(red),
102 const unsigned char WXUNUSED(green),
103 const unsigned char WXUNUSED(blue) ) const
c801d85f 104{
47d67540
VZ
105 wxFAIL_MSG("not implemented");
106
107 return 0;
c801d85f
KB
108};
109
aeeb6a44
RR
110bool wxPalette::GetRGB( int WXUNUSED(pixel),
111 unsigned char *WXUNUSED(red),
112 unsigned char *WXUNUSED(green),
113 unsigned char *WXUNUSED(blue) ) const
c801d85f 114{
47d67540
VZ
115 wxFAIL_MSG("not implemented");
116
117 return 0;
c801d85f
KB
118};
119