wxPaletteBase introduction. wxPalette::GetColoursCount() in interface of all platforms. wxColourMap definition centralized and 2.4 only. Source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -92,6 +92,12 @@ true if the creation was successful, false otherwise.
|
||||
|
||||
\helpref{wxPalette::wxPalette}{wxpalettector}
|
||||
|
||||
\membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
|
||||
|
||||
\constfunc{int}{GetColoursCount}{\void}
|
||||
|
||||
Returns number of entries in palette.
|
||||
|
||||
\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
|
||||
|
||||
\constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp
|
||||
|
@@ -31,7 +31,7 @@ class wxPalette;
|
||||
// wxPalette
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxPalette: public wxGDIObject
|
||||
class wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
@@ -44,7 +44,7 @@ class wxPalette: public wxGDIObject
|
||||
wxPalette& operator = ( const wxPalette& palette );
|
||||
bool operator == ( const wxPalette& palette );
|
||||
bool operator != ( const wxPalette& palette );
|
||||
bool Ok() const;
|
||||
virtual bool Ok() const;
|
||||
|
||||
bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const;
|
||||
@@ -53,7 +53,4 @@ class wxPalette: public wxGDIObject
|
||||
// no data
|
||||
};
|
||||
|
||||
#define wxColorMap wxPalette
|
||||
#define wxColourMap wxPalette
|
||||
|
||||
#endif // __WX_PALETTEG_H__
|
||||
|
@@ -36,14 +36,14 @@ protected:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
public:
|
||||
wxPalette();
|
||||
wxPalette(const wxPalette& palette)
|
||||
: wxGDIObject()
|
||||
: wxPaletteBase()
|
||||
{ Ref(palette); }
|
||||
|
||||
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
|
@@ -36,14 +36,14 @@ protected:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
public:
|
||||
wxPalette();
|
||||
wxPalette(const wxPalette& palette)
|
||||
: wxGDIObject()
|
||||
: wxPaletteBase()
|
||||
{ Ref(palette); }
|
||||
|
||||
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
|
@@ -32,7 +32,7 @@ struct palette_t;
|
||||
// wxPalette
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
@@ -44,21 +44,16 @@ public:
|
||||
wxPalette& operator = (const wxPalette& palette);
|
||||
bool operator == (const wxPalette& palette) const;
|
||||
bool operator != (const wxPalette& palette) const;
|
||||
bool Ok() const;
|
||||
virtual bool Ok() const;
|
||||
|
||||
bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
|
||||
bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
|
||||
|
||||
// implementation
|
||||
int GetColoursCount() const;
|
||||
// FIXME_MGL -- make this method standard part of wx API
|
||||
// FIXME_MGL -- create wxXXXBase classes for all GDI stuff (Vadim wants that)
|
||||
virtual int GetColoursCount() const;
|
||||
|
||||
palette_t *GetMGLpalette_t() const;
|
||||
};
|
||||
|
||||
#define wxColorMap wxPalette
|
||||
#define wxColourMap wxPalette
|
||||
|
||||
#endif // __WX_PALETTE_H__
|
||||
|
@@ -49,7 +49,7 @@ protected:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
|
@@ -32,13 +32,13 @@ protected:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
public:
|
||||
wxPalette(void);
|
||||
inline wxPalette(const wxPalette& palette) : wxGDIObject(palette) { Ref(palette); }
|
||||
inline wxPalette(const wxPalette& palette) : wxPaletteBase(palette) { Ref(palette); }
|
||||
|
||||
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
~wxPalette(void);
|
||||
@@ -58,8 +58,5 @@ public:
|
||||
void SetHPALETTE(WXHPALETTE pal);
|
||||
};
|
||||
|
||||
#define wxColorMap wxPalette
|
||||
#define wxColourMap wxPalette
|
||||
|
||||
#endif
|
||||
// _WX_PALETTE_H_
|
||||
|
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
@@ -68,16 +68,13 @@ public:
|
||||
inline bool operator != (const wxPalette& rPalette) const
|
||||
{ return m_refData != rPalette.m_refData; }
|
||||
|
||||
virtual bool FreeResource(bool bForce = FALSE);
|
||||
virtual bool FreeResource(bool bForce = false);
|
||||
|
||||
inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
|
||||
void SetHPALETTE(WXHPALETTE hPalette);
|
||||
void SetPS(HPS hPS);
|
||||
}; // end of CLASS wxPalette
|
||||
|
||||
#define wxColorMap wxPalette
|
||||
#define wxColourMap wxPalette
|
||||
|
||||
#endif
|
||||
// _WX_PALETTE_H_
|
||||
|
||||
|
@@ -1,12 +1,26 @@
|
||||
#ifndef _WX_PALETTE_H_BASE_
|
||||
#define _WX_PALETTE_H_BASE_
|
||||
|
||||
// include it to get wxUSE_PALETTE value
|
||||
#include "wx/setup.h"
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/object.h"
|
||||
#include "wx/gdiobj.h"
|
||||
|
||||
// wxBrushBase
|
||||
class WXDLLEXPORT wxPaletteBase: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
virtual ~wxPaletteBase() { }
|
||||
|
||||
virtual bool Ok() const = 0;
|
||||
virtual int GetColoursCount() const { wxFAIL_MSG( _T("not implemented") ); return 0; };
|
||||
};
|
||||
|
||||
#if defined(__PALMOS__)
|
||||
#include "wx/palmos/palette.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/palette.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/palette.h"
|
||||
@@ -22,6 +36,11 @@
|
||||
#include "wx/os2/palette.h"
|
||||
#endif
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_4
|
||||
#define wxColorMap wxPalette
|
||||
#define wxColourMap wxPalette
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
#endif
|
||||
|
@@ -32,7 +32,7 @@ protected:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
@@ -52,14 +52,11 @@ public:
|
||||
inline bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; }
|
||||
inline bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; }
|
||||
|
||||
virtual bool FreeResource(bool force = FALSE);
|
||||
virtual bool FreeResource(bool force = false);
|
||||
|
||||
inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
|
||||
void SetHPALETTE(WXHPALETTE pal);
|
||||
};
|
||||
|
||||
#define wxColorMap wxPalette
|
||||
#define wxColourMap wxPalette
|
||||
|
||||
#endif
|
||||
// _WX_PALETTE_H_
|
||||
|
@@ -49,7 +49,7 @@ protected:
|
||||
|
||||
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxPalette: public wxGDIObject
|
||||
class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPalette)
|
||||
|
||||
|
@@ -23,7 +23,7 @@ I have implemented basic colormap support for the X11 versions of
|
||||
wxWidgets, notably wxPalette::Create(). The way I did it is to
|
||||
allocate additional read-only color cells in the default colormap. In
|
||||
general you will get arbitrary pixel values assigned to these new
|
||||
cells and therefore I added a method wxColourMap::TransferBitmap()
|
||||
cells and therefore I added a method wxPalette::TransferBitmap()
|
||||
which maps the pixel values 0..n to the real ones obtained with
|
||||
Create(). This is only implemented for the popular case of 8-bit
|
||||
depth.
|
||||
@@ -69,7 +69,7 @@ wxXPalette::wxXPalette()
|
||||
m_pix_array_n = 0;
|
||||
m_pix_array = (unsigned long*) 0;
|
||||
m_display = (WXDisplay*) 0;
|
||||
m_destroyable = FALSE;
|
||||
m_destroyable = false;
|
||||
}
|
||||
|
||||
wxPaletteRefData::wxPaletteRefData()
|
||||
@@ -130,7 +130,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
||||
UnRef();
|
||||
|
||||
if (!n) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_refData = new wxPaletteRefData;
|
||||
@@ -146,7 +146,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
||||
|
||||
pix_array = new unsigned long[n];
|
||||
if (!pix_array)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
pix_array_n = n;
|
||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||
@@ -163,10 +163,10 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
||||
c->m_pix_array = pix_array;
|
||||
c->m_cmap = (WXColormap) cmap;
|
||||
c->m_display = (WXDisplay*) display;
|
||||
c->m_destroyable = FALSE;
|
||||
c->m_destroyable = false;
|
||||
M_PALETTEDATA->m_palettes.Append(c);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
|
||||
@@ -181,13 +181,13 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
|
||||
bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
|
||||
{
|
||||
if ( !m_refData )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (index < 0 || index > 255)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
||||
@@ -221,7 +221,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
||||
c->m_pix_array = new unsigned long[pix_array_n];
|
||||
c->m_display = display;
|
||||
c->m_cmap = wxTheApp->GetMainColormap(display);
|
||||
c->m_destroyable = FALSE;
|
||||
c->m_destroyable = false;
|
||||
|
||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||
int i;
|
||||
@@ -257,10 +257,10 @@ bool wxPalette::TransferBitmap(void *data, int depth, int size)
|
||||
uptr++;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,9 +314,9 @@ bool wxPalette::TransferBitmap8(unsigned char *data, unsigned long sz,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
|
||||
|
@@ -23,7 +23,7 @@ I have implemented basic colormap support for the X11 versions of
|
||||
wxWidgets, notably wxPalette::Create(). The way I did it is to
|
||||
allocate additional read-only color cells in the default colormap. In
|
||||
general you will get arbitrary pixel values assigned to these new
|
||||
cells and therefore I added a method wxColourMap::TransferBitmap()
|
||||
cells and therefore I added a method wxPalette::TransferBitmap()
|
||||
which maps the pixel values 0..n to the real ones obtained with
|
||||
Create(). This is only implemented for the popular case of 8-bit
|
||||
depth.
|
||||
@@ -66,7 +66,7 @@ wxXPalette::wxXPalette()
|
||||
m_pix_array_n = 0;
|
||||
m_pix_array = (unsigned long*) 0;
|
||||
m_display = (WXDisplay*) 0;
|
||||
m_destroyable = FALSE;
|
||||
m_destroyable = false;
|
||||
}
|
||||
|
||||
wxPaletteRefData::wxPaletteRefData()
|
||||
@@ -129,7 +129,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
||||
UnRef();
|
||||
|
||||
if (!n) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_refData = new wxPaletteRefData;
|
||||
@@ -145,7 +145,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
||||
|
||||
pix_array = new unsigned long[n];
|
||||
if (!pix_array)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
pix_array_n = n;
|
||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||
@@ -162,10 +162,10 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
||||
c->m_pix_array = pix_array;
|
||||
c->m_cmap = (WXColormap) cmap;
|
||||
c->m_display = (WXDisplay*) display;
|
||||
c->m_destroyable = FALSE;
|
||||
c->m_destroyable = false;
|
||||
M_PALETTEDATA->m_palettes.Append(c);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
|
||||
@@ -180,13 +180,13 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
|
||||
bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
|
||||
{
|
||||
if ( !m_refData )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (index < 0 || index > 255)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
||||
@@ -219,7 +219,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
||||
c->m_pix_array = new unsigned long[pix_array_n];
|
||||
c->m_display = display;
|
||||
c->m_cmap = wxTheApp->GetMainColormap(display);
|
||||
c->m_destroyable = FALSE;
|
||||
c->m_destroyable = false;
|
||||
|
||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||
int i;
|
||||
@@ -253,10 +253,10 @@ bool wxPalette::TransferBitmap(void *data, int depth, int size)
|
||||
uptr++;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,9 +310,9 @@ bool wxPalette::TransferBitmap8(unsigned char *data, unsigned long sz,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
|
||||
|
Reference in New Issue
Block a user