]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/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" 
  20 //----------------------------------------------------------------------------- 
  22 //----------------------------------------------------------------------------- 
  24 class wxPaletteRefData
: public wxObjectRefData
 
  28     wxPaletteRefData(void); 
  29     ~wxPaletteRefData(void); 
  31     GdkColormap  
*m_colormap
; 
  34 wxPaletteRefData::wxPaletteRefData() 
  36     m_colormap 
= (GdkColormap 
*) NULL
; 
  39 wxPaletteRefData::~wxPaletteRefData() 
  41     if (m_colormap
) gdk_colormap_unref( m_colormap 
); 
  44 //----------------------------------------------------------------------------- 
  46 #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) 
  48 IMPLEMENT_DYNAMIC_CLASS(wxPalette
,wxGDIObject
) 
  50 wxPalette::wxPalette() 
  54 wxPalette::wxPalette( int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue 
) 
  56     m_refData 
= new wxPaletteRefData(); 
  57     Create( n
, red
, green
, blue 
); 
  60 wxPalette::wxPalette( const wxPalette
& palette 
) 
  65 wxPalette::~wxPalette() 
  69 wxPalette
& wxPalette::operator = ( const wxPalette
& palette 
) 
  71     if (*this == palette
) return (*this); 
  76 bool wxPalette::operator == ( const wxPalette
& palette 
) 
  78     return m_refData 
== palette
.m_refData
; 
  81 bool wxPalette::operator != ( const wxPalette
& palette 
) 
  83     return m_refData 
!= palette
.m_refData
; 
  86 bool wxPalette::Ok(void) const 
  88     return (m_refData 
!= NULL
); 
  91 bool wxPalette::Create( int WXUNUSED(n
),  
  92                         const unsigned char *WXUNUSED(red
),  
  93                         const unsigned char *WXUNUSED(green
),  
  94                         const unsigned char *WXUNUSED(blue
) ) 
  96     wxFAIL_MSG(wxT("not implemented")); 
 101 int wxPalette::GetPixel( const unsigned char WXUNUSED(red
),  
 102                          const unsigned char WXUNUSED(green
),  
 103                          const unsigned char WXUNUSED(blue
) ) const 
 105     wxFAIL_MSG(wxT("not implemented")); 
 110 bool wxPalette::GetRGB( int WXUNUSED(pixel
),  
 111                         unsigned char *WXUNUSED(red
),  
 112                         unsigned char *WXUNUSED(green
),  
 113                         unsigned char *WXUNUSED(blue
) ) const 
 115     wxFAIL_MSG(wxT("not implemented"));