X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5ea105e0ba20c15e4d83f829e1c4faeb0a4952f0..5aab763c09c663ab5e5b92e533ca025e811f1bcf:/src/msw/palette.cpp diff --git a/src/msw/palette.cpp b/src/msw/palette.cpp index 77569777f7..159975a963 100644 --- a/src/msw/palette.cpp +++ b/src/msw/palette.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -17,22 +17,18 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif +#if wxUSE_PALETTE + #ifndef WX_PRECOMP -#include -#include "wx/setup.h" -#include "wx/palette.h" + #include "wx/palette.h" #endif -#include - -#include "assert.h" +#include "wx/msw/private.h" -#if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) -#endif /* * Palette @@ -46,8 +42,8 @@ wxPaletteRefData::wxPaletteRefData(void) wxPaletteRefData::~wxPaletteRefData(void) { - if ( m_hPalette ) - ::DeleteObject((HPALETTE) m_hPalette); + if ( m_hPalette ) + ::DeleteObject((HPALETTE) m_hPalette); } wxPalette::wxPalette(void) @@ -61,26 +57,26 @@ wxPalette::wxPalette(int n, const unsigned char *red, const unsigned char *green wxPalette::~wxPalette(void) { -// FreeResource(TRUE); +// FreeResource(TRUE); } -bool wxPalette::FreeResource(bool force) +bool wxPalette::FreeResource(bool WXUNUSED(force)) { - if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette) - { + if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette) + { DeleteObject((HPALETTE)M_PALETTEDATA->m_hPalette); - } - return TRUE; + } + return TRUE; } bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) { UnRef(); -#ifdef __WXWINE__ +#if defined(__WXMICROWIN__) return (FALSE); - + #else m_refData = new wxPaletteRefData; @@ -104,22 +100,29 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre M_PALETTEDATA->m_hPalette = (WXHPALETTE) CreatePalette((LPLOGPALETTE)npPal); LocalFree((HANDLE)npPal); return TRUE; - + #endif } int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const { +#ifdef __WXMICROWIN__ + return FALSE; +#else if ( !m_refData ) - return FALSE; + return FALSE; return ::GetNearestPaletteIndex((HPALETTE) M_PALETTEDATA->m_hPalette, PALETTERGB(red, green, blue)); +#endif } bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const { +#ifdef __WXMICROWIN__ + return FALSE; +#else if ( !m_refData ) - return FALSE; + return FALSE; if (index < 0 || index > 255) return FALSE; @@ -133,13 +136,16 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi return TRUE; } else return FALSE; +#endif } void wxPalette::SetHPALETTE(WXHPALETTE pal) { - if ( !m_refData ) - m_refData = new wxPaletteRefData; + if ( !m_refData ) + m_refData = new wxPaletteRefData; M_PALETTEDATA->m_hPalette = pal; } +#endif // wxUSE_PALETTE +