X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/564a150b1f7c63a060c1b205a7cd50035031cd4b..5955710c8bd346e8be675bd1dbbd427723a57920:/src/motif/colour.cpp diff --git a/src/motif/colour.cpp b/src/motif/colour.cpp index ee95c0a045..b77ec7a38b 100644 --- a/src/motif/colour.cpp +++ b/src/motif/colour.cpp @@ -63,6 +63,26 @@ void wxColour::InitFromName(const wxString& name) *this = wxTheColourDatabase->Find(name); } +/* static */ +wxColour wxColour::CreateByName(const wxString& name) +{ + wxColour col; + + Display *dpy = wxGlobalDisplay(); + WXColormap colormap = wxTheApp->GetMainColormap( dpy ); + XColor xcol; + if ( XParseColor( dpy, (Colormap)colormap, name.mb_str(), &xcol ) ) + { + col.m_red = xcol.red & 0xff; + col.m_green = xcol.green & 0xff; + col.m_blue = xcol.blue & 0xff; + col.m_isInit = TRUE; + col.m_pixel = -1; + } + + return col; +} + wxColour::~wxColour () { }