X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/88ef3a57a47f840adea9d38bc11cb30689a0838a..bf6d45ebf663a0f31021893d2369a95d96198c8f:/src/msw/palette.cpp diff --git a/src/msw/palette.cpp b/src/msw/palette.cpp index c958a25a2a..989ff48e22 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();