]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/palette.cpp
moved wxDash typedef to gdicmn.h
[wxWidgets.git] / src / gtk1 / palette.cpp
... / ...
CommitLineData
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#include <gdk/gdk.h>
19
20//-----------------------------------------------------------------------------
21// wxPalette
22//-----------------------------------------------------------------------------
23
24class wxPaletteRefData: public wxObjectRefData
25{
26 public:
27
28 wxPaletteRefData(void);
29 ~wxPaletteRefData(void);
30
31 GdkColormap *m_colormap;
32};
33
34wxPaletteRefData::wxPaletteRefData()
35{
36 m_colormap = (GdkColormap *) NULL;
37}
38
39wxPaletteRefData::~wxPaletteRefData()
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
50wxPalette::wxPalette()
51{
52}
53
54wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue )
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
65wxPalette::~wxPalette()
66{
67}
68
69wxPalette& wxPalette::operator = ( const wxPalette& palette )
70{
71 if (*this == palette) return (*this);
72 Ref( palette );
73 return *this;
74}
75
76bool wxPalette::operator == ( const wxPalette& palette )
77{
78 return m_refData == palette.m_refData;
79}
80
81bool wxPalette::operator != ( const wxPalette& palette )
82{
83 return m_refData != palette.m_refData;
84}
85
86bool wxPalette::Ok(void) const
87{
88 return (m_refData != NULL);
89}
90
91bool wxPalette::Create( int WXUNUSED(n),
92 const unsigned char *WXUNUSED(red),
93 const unsigned char *WXUNUSED(green),
94 const unsigned char *WXUNUSED(blue) )
95{
96 wxFAIL_MSG(wxT("not implemented"));
97
98 return FALSE;
99}
100
101int wxPalette::GetPixel( const unsigned char WXUNUSED(red),
102 const unsigned char WXUNUSED(green),
103 const unsigned char WXUNUSED(blue) ) const
104{
105 wxFAIL_MSG(wxT("not implemented"));
106
107 return 0;
108}
109
110bool wxPalette::GetRGB( int WXUNUSED(pixel),
111 unsigned char *WXUNUSED(red),
112 unsigned char *WXUNUSED(green),
113 unsigned char *WXUNUSED(blue) ) const
114{
115 wxFAIL_MSG(wxT("not implemented"));
116
117 return 0;
118}
119