From d72f87f60bd548c9b09d4f15d5ed735d749aaa2b Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 23 Sep 2006 09:54:11 +0000 Subject: [PATCH] Implememt GetColoursCount() in the generic wxPalette. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/paletteg.h | 10 +++++----- src/generic/paletteg.cpp | 10 +++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/wx/generic/paletteg.h b/include/wx/generic/paletteg.h index f059c0c4f5..2eb853fc11 100644 --- a/include/wx/generic/paletteg.h +++ b/include/wx/generic/paletteg.h @@ -29,10 +29,7 @@ class WXDLLIMPEXP_CORE wxPalette; class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase { - DECLARE_DYNAMIC_CLASS(wxPalette) - - public: - +public: wxPalette(); wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); virtual ~wxPalette(); @@ -44,7 +41,10 @@ class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const; bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; - // no data + virtual int GetColoursCount() const: + +private: + DECLARE_DYNAMIC_CLASS(wxPalette) }; #endif // __WX_PALETTEG_H__ diff --git a/src/generic/paletteg.cpp b/src/generic/paletteg.cpp index 741a78893a..87945ca274 100644 --- a/src/generic/paletteg.cpp +++ b/src/generic/paletteg.cpp @@ -80,11 +80,19 @@ bool wxPalette::operator != (const wxPalette& palette) const return m_refData != palette.m_refData; } -bool wxPalette::Ok(void) const +bool wxPalette::Ok() const { return (m_refData != NULL); } +int wxPalette::GetColoursCount() const +{ + if (m_refData) + return M_PALETTEDATA->m_count; + + return 0; +} + bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, -- 2.45.2