X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e6b83091a1ef0114a3b45af43ee66832f1876bb..b7c542d5c6104aa3a52b0cafda59dff03510e888:/src/gtk/colour.cpp diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index bf2fa2a342..3e2386a840 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: colour.cpp +// Name: src/gtk/colour.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -7,16 +7,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "colour.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/gdicmn.h" #include "wx/colour.h" +#include "wx/gdicmn.h" #include "wx/gtk/private.h" #include @@ -37,7 +32,7 @@ public: m_color.blue = 0; m_color.pixel = 0; m_colormap = (GdkColormap *) NULL; - m_hasPixel = FALSE; + m_hasPixel = false; } wxColourRefData(const wxColourRefData& data) @@ -97,20 +92,14 @@ void wxColourRefData::FreeColour() { if (m_colormap) { -#ifdef __WXGTK20__ if ((m_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || (m_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) -#else - GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) m_colormap; - if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || - (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) -#endif { int idx = m_color.pixel; colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1; if (colMapAllocCounter[ idx ] == 0) - gdk_colormap_free_colors( m_colormap, &m_color, 1 ); + gdk_colormap_free_colors( m_colormap, &m_color, 1 ); } } } @@ -122,14 +111,8 @@ void wxColourRefData::AllocColour( GdkColormap *cmap ) FreeColour(); -#ifdef __WXGTK20__ if ( (cmap->visual->type == GDK_VISUAL_GRAYSCALE) || - (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) -#else - GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; - if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || - (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) -#endif + (cmap->visual->type == GDK_VISUAL_PSEUDO_COLOR) ) { m_hasPixel = gdk_colormap_alloc_color( cmap, &m_color, FALSE, TRUE ); int idx = m_color.pixel; @@ -146,7 +129,8 @@ void wxColourRefData::AllocColour( GdkColormap *cmap ) #define M_COLDATA ((wxColourRefData *)m_refData) -#define SHIFT (8*(sizeof(short int)-sizeof(char))) +// GDK's values are in 0..65535 range, our are in 0..255 +#define SHIFT 8 IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject) @@ -207,10 +191,10 @@ wxColour::~wxColour() bool wxColour::operator == ( const wxColour& col ) const { if (m_refData == col.m_refData) - return TRUE; + return true; if (!m_refData || !col.m_refData) - return FALSE; + return false; GdkColor *own = &(((wxColourRefData*)m_refData)->m_color); GdkColor *other = &(((wxColourRefData*)col.m_refData)->m_color); @@ -239,7 +223,7 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) M_COLDATA->m_color.pixel = 0; M_COLDATA->m_colormap = (GdkColormap*) NULL; - M_COLDATA->m_hasPixel = FALSE; + M_COLDATA->m_hasPixel = false; } unsigned char wxColour::Red() const @@ -283,5 +267,3 @@ GdkColor *wxColour::GetColor() const return &M_COLDATA->m_color; } - -