X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/40989e46b86777dd211faeb3e5d2366cdcc6d8cd..2f36b4d22beeb7f4f0cedf922c0c26d037f54477:/src/x11/colour.cpp diff --git a/src/x11/colour.cpp b/src/x11/colour.cpp index a0d96399cf..467d3f45a0 100644 --- a/src/x11/colour.cpp +++ b/src/x11/colour.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart, Robert Roebling // Modified by: // Created: 17/09/98 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,8 +13,10 @@ #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" @@ -23,7 +24,7 @@ // wxColour //----------------------------------------------------------------------------- -class wxColourRefData: public wxObjectRefData +class wxColourRefData : public wxGDIRefData { public: wxColourRefData() @@ -32,23 +33,23 @@ public: 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 && @@ -139,8 +140,6 @@ void wxColourRefData::AllocColour( WXColormap cmap ) #define SHIFT (8*(sizeof(short int)-sizeof(char))) -IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject) - wxColour::~wxColour() { } @@ -160,17 +159,18 @@ bool wxColour::operator == ( const wxColour& col ) const } -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(); @@ -188,7 +188,7 @@ void wxColour::InitWith( unsigned char red, unsigned char green, unsigned char b unsigned char wxColour::Red() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); #if wxUSE_NANOX return (unsigned char) M_COLDATA->m_color.red ; @@ -199,7 +199,7 @@ unsigned char wxColour::Red() const unsigned char wxColour::Green() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); #if wxUSE_NANOX return (unsigned char) M_COLDATA->m_color.green ; @@ -210,7 +210,7 @@ unsigned char wxColour::Green() const unsigned char wxColour::Blue() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); #if wxUSE_NANOX return (unsigned char) M_COLDATA->m_color.blue ; @@ -221,7 +221,7 @@ unsigned char wxColour::Blue() const void wxColour::CalcPixel( WXColormap cmap ) { - wxCHECK_RET( Ok(), wxT("invalid colour") ); + wxCHECK_RET( IsOk(), wxT("invalid colour") ); wxCHECK_RET( cmap, wxT("invalid colormap") ); @@ -230,24 +230,24 @@ void wxColour::CalcPixel( WXColormap cmap ) unsigned long wxColour::GetPixel() const { - wxCHECK_MSG( Ok(), 0, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 0, wxT("invalid colour") ); return M_COLDATA->m_color.pixel; } WXColor *wxColour::GetColor() const { - wxCHECK_MSG( Ok(), (WXColor *) NULL, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), 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, wxGTK_CONV_SYS( name ), &xcol ) ) + if ( XParseColor( dpy, (Colormap)colormap, name.mbc_str(), &xcol ) ) { UnRef();