]>
Commit | Line | Data |
---|---|---|
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 | ||
24 | class 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 | 34 | wxPaletteRefData::wxPaletteRefData() |
c801d85f | 35 | { |
8fc613f1 RR |
36 | m_colormap = (GdkColormap *) NULL; |
37 | } | |
c801d85f | 38 | |
8bbe427f | 39 | wxPaletteRefData::~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 | ||
48 | IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) | |
49 | ||
8bbe427f | 50 | wxPalette::wxPalette() |
c801d85f | 51 | { |
8fc613f1 | 52 | } |
c801d85f | 53 | |
debe6624 | 54 | wxPalette::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 | |
60 | wxPalette::wxPalette( const wxPalette& palette ) | |
61 | { | |
8fc613f1 RR |
62 | Ref( palette ); |
63 | } | |
c801d85f | 64 | |
8bbe427f | 65 | wxPalette::~wxPalette() |
c801d85f | 66 | { |
8fc613f1 | 67 | } |
c801d85f KB |
68 | |
69 | wxPalette& wxPalette::operator = ( const wxPalette& palette ) | |
70 | { | |
8fc613f1 RR |
71 | if (*this == palette) return (*this); |
72 | Ref( palette ); | |
73 | return *this; | |
74 | } | |
c801d85f KB |
75 | |
76 | bool wxPalette::operator == ( const wxPalette& palette ) | |
77 | { | |
8fc613f1 RR |
78 | return m_refData == palette.m_refData; |
79 | } | |
c801d85f KB |
80 | |
81 | bool wxPalette::operator != ( const wxPalette& palette ) | |
82 | { | |
8fc613f1 RR |
83 | return m_refData != palette.m_refData; |
84 | } | |
c801d85f KB |
85 | |
86 | bool wxPalette::Ok(void) const | |
87 | { | |
8fc613f1 RR |
88 | return (m_refData != NULL); |
89 | } | |
c801d85f | 90 | |
aeeb6a44 RR |
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) ) | |
c801d85f | 95 | { |
8fc613f1 | 96 | wxFAIL_MSG("not implemented"); |
47d67540 | 97 | |
8fc613f1 RR |
98 | return FALSE; |
99 | } | |
c801d85f | 100 | |
aeeb6a44 RR |
101 | int wxPalette::GetPixel( const unsigned char WXUNUSED(red), |
102 | const unsigned char WXUNUSED(green), | |
103 | const unsigned char WXUNUSED(blue) ) const | |
c801d85f | 104 | { |
8fc613f1 | 105 | wxFAIL_MSG("not implemented"); |
47d67540 | 106 | |
8fc613f1 RR |
107 | return 0; |
108 | } | |
c801d85f | 109 | |
aeeb6a44 RR |
110 | bool wxPalette::GetRGB( int WXUNUSED(pixel), |
111 | unsigned char *WXUNUSED(red), | |
112 | unsigned char *WXUNUSED(green), | |
113 | unsigned char *WXUNUSED(blue) ) const | |
c801d85f | 114 | { |
8fc613f1 RR |
115 | wxFAIL_MSG("not implemented"); |
116 | ||
117 | return 0; | |
118 | } | |
c801d85f | 119 |