-IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
-
-wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
-{
- m_refData = new wxColourRefData();
-#if wxUSE_NANOX
- M_COLDATA->m_color.red = ((unsigned short)red) ;
- M_COLDATA->m_color.green = ((unsigned short)green) ;
- M_COLDATA->m_color.blue = ((unsigned short)blue) ;
-#else
- 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;
-#endif
- M_COLDATA->m_color.pixel = 0;
-}
-
-void wxColour::InitFromName( const wxString &colourName )
-{
- wxNode *node = (wxNode *) NULL;
- if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
- {
- wxColour *col = (wxColour*)node->GetData();
- UnRef();
- if (col) Ref( *col );
- }
- else
- {
- m_refData = new wxColourRefData();
-
- M_COLDATA->m_colormap = wxTheApp->GetMainColormap( wxGlobalDisplay() );
-
- if (!XParseColor( wxGlobalDisplay(), (Colormap) M_COLDATA->m_colormap, colourName.mb_str(), &M_COLDATA->m_color ))
- {
- // VZ: asserts are good in general but this one is triggered by
- // calling wxColourDatabase::FindColour() with an
- // unrecognized colour name and this can't be avoided from the
- // user code, so don't give it here
- //
- // a better solution would be to changed code in FindColour()
-
- //wxFAIL_MSG( wxT("wxColour: couldn't find colour") );
-
- delete m_refData;
- m_refData = (wxObjectRefData *) NULL;
- }
- }
-}
-