X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d84afea9d1ec41ee4e2ebb3bf6b87926cf5f04d1..68a2e005a51a87df6cc445345f27443e57ab3608:/src/gtk1/colour.cpp?ds=sidebyside diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp index 84c790a329..ce9b00c4c1 100644 --- a/src/gtk1/colour.cpp +++ b/src/gtk1/colour.cpp @@ -13,6 +13,8 @@ #endif #include "wx/gdicmn.h" +#include "wx/colour.h" +#include "wx/gtk/private.h" #include #include @@ -154,12 +156,13 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue ) M_COLDATA->m_color.pixel = 0; } + + void wxColour::InitFromName( const wxString &colourName ) { - wxNode *node = (wxNode *) NULL; - if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) + wxColour* col = NULL; + if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) ) { - wxColour *col = (wxColour*)node->Data(); UnRef(); if (col) Ref( *col ); } @@ -167,7 +170,7 @@ void wxColour::InitFromName( const wxString &colourName ) { m_refData = new wxColourRefData(); - if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color )) + if (!gdk_color_parse( wxGTK_CONV( colourName ), &M_COLDATA->m_color )) { // VZ: asserts are good in general but this one is triggered by // calling wxColourDatabase::FindColour() with an @@ -217,11 +220,13 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) { AllocExclusive(); - m_refData = new wxColourRefData(); M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT; M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT; M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT; M_COLDATA->m_color.pixel = 0; + + M_COLDATA->m_colormap = (GdkColormap*) NULL; + M_COLDATA->m_hasPixel = FALSE; } unsigned char wxColour::Red() const