]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/palette.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "palette.h"
16 #include "wx/palette.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class wxPaletteRefData
: public wxObjectRefData
26 wxPaletteRefData(void);
27 ~wxPaletteRefData(void);
29 GdkColormap
*m_colormap
;
32 wxPaletteRefData::wxPaletteRefData(void)
37 wxPaletteRefData::~wxPaletteRefData(void)
39 if (m_colormap
) gdk_colormap_unref( m_colormap
);
42 //-----------------------------------------------------------------------------
44 #define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
46 IMPLEMENT_DYNAMIC_CLASS(wxPalette
,wxGDIObject
)
48 wxPalette::wxPalette(void)
52 wxPalette::wxPalette( int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue
)
54 m_refData
= new wxPaletteRefData();
55 Create( n
, red
, green
, blue
);
58 wxPalette::wxPalette( const wxPalette
& palette
)
63 wxPalette::wxPalette( const wxPalette
* palette
)
66 if (palette
) Ref( *palette
);
69 wxPalette::~wxPalette(void)
73 wxPalette
& wxPalette::operator = ( const wxPalette
& palette
)
75 if (*this == palette
) return (*this);
80 bool wxPalette::operator == ( const wxPalette
& palette
)
82 return m_refData
== palette
.m_refData
;
85 bool wxPalette::operator != ( const wxPalette
& palette
)
87 return m_refData
!= palette
.m_refData
;
90 bool wxPalette::Ok(void) const
95 bool wxPalette::Create( int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue
)
99 int wxPalette::GetPixel( const unsigned char red
, const unsigned char green
, const unsigned char blue
) const
103 bool wxPalette::GetRGB( int pixel
, unsigned char *red
, unsigned char *green
, unsigned char *blue
) const