// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
-// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_PALETTE
+
#ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/setup.h"
-#include "wx/palette.h"
+ #include "wx/palette.h"
#endif
-#include <windows.h>
-
-#include "assert.h"
+#include "wx/msw/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
wxPaletteRefData::~wxPaletteRefData(void)
{
- if ( m_hPalette )
- ::DeleteObject((HPALETTE) m_hPalette);
+ if ( m_hPalette )
+ ::DeleteObject((HPALETTE) m_hPalette);
}
wxPalette::wxPalette(void)
wxPalette::~wxPalette(void)
{
-// FreeResource(TRUE);
+// FreeResource(TRUE);
}
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();
-#if defined(__WXWINE__) || defined(__WXMICROWIN__)
+#if defined(__WXMICROWIN__)
return (FALSE);
return FALSE;
#else
if ( !m_refData )
- return FALSE;
+ return FALSE;
return ::GetNearestPaletteIndex((HPALETTE) M_PALETTEDATA->m_hPalette, PALETTERGB(red, green, blue));
#endif
return FALSE;
#else
if ( !m_refData )
- return FALSE;
+ return FALSE;
if (index < 0 || index > 255)
return FALSE;
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
+