]>
Commit | Line | Data |
---|---|---|
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 | ||
24 | class wxPaletteRefData: public wxObjectRefData | |
25 | { | |
26 | public: | |
27 | ||
28 | wxPaletteRefData(void); | |
29 | ~wxPaletteRefData(void); | |
30 | ||
31 | GdkColormap *m_colormap; | |
32 | }; | |
33 | ||
34 | wxPaletteRefData::wxPaletteRefData() | |
35 | { | |
36 | m_colormap = (GdkColormap *) NULL; | |
37 | } | |
38 | ||
39 | wxPaletteRefData::~wxPaletteRefData() | |
40 | { | |
41 | if (m_colormap) gdk_colormap_unref( m_colormap ); | |
42 | } | |
43 | ||
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) | |
47 | ||
48 | IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) | |
49 | ||
50 | wxPalette::wxPalette() | |
51 | { | |
52 | } | |
53 | ||
54 | wxPalette::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 | ||
60 | wxPalette::wxPalette( const wxPalette& palette ) | |
61 | { | |
62 | Ref( palette ); | |
63 | } | |
64 | ||
65 | wxPalette::~wxPalette() | |
66 | { | |
67 | } | |
68 | ||
69 | wxPalette& wxPalette::operator = ( const wxPalette& palette ) | |
70 | { | |
71 | if (*this == palette) return (*this); | |
72 | Ref( palette ); | |
73 | return *this; | |
74 | } | |
75 | ||
76 | bool wxPalette::operator == ( const wxPalette& palette ) | |
77 | { | |
78 | return m_refData == palette.m_refData; | |
79 | } | |
80 | ||
81 | bool wxPalette::operator != ( const wxPalette& palette ) | |
82 | { | |
83 | return m_refData != palette.m_refData; | |
84 | } | |
85 | ||
86 | bool wxPalette::Ok(void) const | |
87 | { | |
88 | return (m_refData != NULL); | |
89 | } | |
90 | ||
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) ) | |
95 | { | |
96 | wxFAIL_MSG(_T("not implemented")); | |
97 | ||
98 | return FALSE; | |
99 | } | |
100 | ||
101 | int wxPalette::GetPixel( const unsigned char WXUNUSED(red), | |
102 | const unsigned char WXUNUSED(green), | |
103 | const unsigned char WXUNUSED(blue) ) const | |
104 | { | |
105 | wxFAIL_MSG(_T("not implemented")); | |
106 | ||
107 | return 0; | |
108 | } | |
109 | ||
110 | bool 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(_T("not implemented")); | |
116 | ||
117 | return 0; | |
118 | } | |
119 |