1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-10-06 10:37:43 -04:00
|
|
|
// Name: wx/msw/palette.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxPalette class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-08-31 08:38:46 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_PALETTE_H_
|
|
|
|
#define _WX_PALETTE_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#include "wx/gdiobj.h"
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPalette;
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
|
|
|
|
{
|
|
|
|
friend class WXDLLEXPORT wxPalette;
|
|
|
|
public:
|
|
|
|
wxPaletteRefData(void);
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxPaletteRefData(void);
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
|
|
|
WXHPALETTE m_hPalette;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
|
|
|
|
2004-12-08 12:43:18 -05:00
|
|
|
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
|
|
|
public:
|
2006-09-23 05:35:09 -04:00
|
|
|
wxPalette();
|
|
|
|
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
|
|
|
virtual ~wxPalette(void);
|
|
|
|
bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
|
|
|
|
|
|
|
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;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2006-09-23 05:35:09 -04:00
|
|
|
virtual int GetColoursCount() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2006-10-08 17:56:55 -04:00
|
|
|
virtual bool Ok() const { return IsOk(); }
|
|
|
|
virtual bool IsOk(void) const { return (m_refData != NULL) ; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2006-09-23 05:35:09 -04:00
|
|
|
virtual bool FreeResource(bool force = false);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2006-09-23 05:35:09 -04:00
|
|
|
// implemetation
|
|
|
|
inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
|
|
|
|
void SetHPALETTE(WXHPALETTE pal);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPalette)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_PALETTE_H_
|