]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/palette.cpp
fixed false alert in wxRegKey::DeleteSelf
[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
5e7e9e1b 18#include <gdk/gdk.h>
83624f79 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{
8fc613f1
RR
36 m_colormap = (GdkColormap *) NULL;
37}
c801d85f 38
8bbe427f 39wxPaletteRefData::~wxPaletteRefData()
c801d85f 40{
8fc613f1
RR
41 if (m_colormap) gdk_colormap_unref( m_colormap );
42}
c801d85f
KB
43
44//-----------------------------------------------------------------------------
45
46#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
47
48IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
49
8bbe427f 50wxPalette::wxPalette()
c801d85f 51{
8fc613f1 52}
c801d85f 53
debe6624 54wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue )
c801d85f 55{
8fc613f1
RR
56 m_refData = new wxPaletteRefData();
57 Create( n, red, green, blue );
58}
c801d85f
KB
59
60wxPalette::wxPalette( const wxPalette& palette )
61{
8fc613f1
RR
62 Ref( palette );
63}
c801d85f 64
8bbe427f 65wxPalette::~wxPalette()
c801d85f 66{
8fc613f1 67}
c801d85f
KB
68
69wxPalette& wxPalette::operator = ( const wxPalette& palette )
70{
8fc613f1
RR
71 if (*this == palette) return (*this);
72 Ref( palette );
73 return *this;
74}
c801d85f
KB
75
76bool wxPalette::operator == ( const wxPalette& palette )
77{
8fc613f1
RR
78 return m_refData == palette.m_refData;
79}
c801d85f
KB
80
81bool wxPalette::operator != ( const wxPalette& palette )
82{
8fc613f1
RR
83 return m_refData != palette.m_refData;
84}
c801d85f
KB
85
86bool wxPalette::Ok(void) const
87{
8fc613f1
RR
88 return (m_refData != NULL);
89}
c801d85f 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{
223d09f6 96 wxFAIL_MSG(wxT("not implemented"));
47d67540 97
8fc613f1
RR
98 return FALSE;
99}
c801d85f 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{
223d09f6 105 wxFAIL_MSG(wxT("not implemented"));
47d67540 106
8fc613f1
RR
107 return 0;
108}
c801d85f 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{
223d09f6 115 wxFAIL_MSG(wxT("not implemented"));
8fc613f1
RR
116
117 return 0;
118}
c801d85f 119