X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/88ef3a57a47f840adea9d38bc11cb30689a0838a..e69d5138dc8f95e294ae6d03beb4f321406f4e34:/src/msw/palette.cpp diff --git a/src/msw/palette.cpp b/src/msw/palette.cpp index c958a25a2a..d72f0adc40 100644 --- a/src/msw/palette.cpp +++ b/src/msw/palette.cpp @@ -18,8 +18,9 @@ #if wxUSE_PALETTE +#include "wx/palette.h" + #ifndef WX_PRECOMP - #include "wx/palette.h" #endif #include "wx/msw/private.h" @@ -42,13 +43,13 @@ wxPaletteRefData::~wxPaletteRefData(void) ::DeleteObject((HPALETTE) m_hPalette); } -wxPalette::wxPalette(void) +wxPalette::wxPalette() { } wxPalette::wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) { - Create(n, red, green, blue); + Create(n, red, green, blue); } wxPalette::~wxPalette(void) @@ -60,11 +61,22 @@ bool wxPalette::FreeResource(bool WXUNUSED(force)) { if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette) { - DeleteObject((HPALETTE)M_PALETTEDATA->m_hPalette); + DeleteObject((HPALETTE)M_PALETTEDATA->m_hPalette); } + return true; } +int wxPalette::GetColoursCount() const +{ + if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette) + { + return ::GetPaletteEntries((HPALETTE) M_PALETTEDATA->m_hPalette, 0, 0, NULL ); + } + + return 0; +} + bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) { UnRef();