#include "wx/colour.h"
-#include "wx/gdicmn.h"
-#include "wx/app.h"
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/gdicmn.h"
+#endif
#include "wx/x11/private.h"
// wxColour
//-----------------------------------------------------------------------------
-class wxColourRefData: public wxObjectRefData
+class wxColourRefData : public wxGDIRefData
{
public:
wxColourRefData()
m_color.green = 0;
m_color.blue = 0;
m_color.pixel = 0;
- m_colormap = (WXColormap *) NULL;
+ m_colormap = NULL;
m_hasPixel = false;
}
- wxColourRefData(const wxColourRefData& data):
- wxObjectRefData()
+
+ wxColourRefData(const wxColourRefData& data)
{
m_color = data.m_color;
m_colormap = data.m_colormap;
m_hasPixel = data.m_hasPixel;
}
- ~wxColourRefData()
+ virtual ~wxColourRefData()
{
FreeColour();
}
- bool operator == (const wxColourRefData& data) const
+ bool operator==(const wxColourRefData& data) const
{
return (m_colormap == data.m_colormap &&
m_hasPixel == data.m_hasPixel &&
#define SHIFT (8*(sizeof(short int)-sizeof(char)))
-IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
-
wxColour::~wxColour()
{
}
}
-wxObjectRefData *wxColour::CreateRefData() const
+wxGDIRefData *wxColour::CreateGDIRefData() const
{
return new wxColourRefData;
}
-wxObjectRefData *wxColour::CloneRefData(const wxObjectRefData *data) const
+wxGDIRefData *wxColour::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxColourRefData(*(wxColourRefData *)data);
}
-void wxColour::InitWith( unsigned char red, unsigned char green, unsigned char blue )
+void wxColour::InitRGBA(unsigned char red, unsigned char green, unsigned char blue,
+ unsigned char WXUNUSED(alpha))
{
AllocExclusive();
WXColor *wxColour::GetColor() const
{
- wxCHECK_MSG( Ok(), (WXColor *) NULL, wxT("invalid colour") );
+ wxCHECK_MSG( Ok(), NULL, wxT("invalid colour") );
return (WXColor*) &M_COLDATA->m_color;
}
-bool wxColour::FromString(const wxChar *name)
+bool wxColour::FromString(const wxString& name)
{
Display *dpy = wxGlobalDisplay();
WXColormap colormap = wxTheApp->GetMainColormap( dpy );
XColor xcol;
- if ( XParseColor( dpy, (Colormap)colormap, name , &xcol ) )
+ if ( XParseColor( dpy, (Colormap)colormap, name.mbc_str(), &xcol ) )
{
UnRef();