]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/colour.cpp
Applied [ 821234 ] Fix: erroneous assertion failed wxListBox::SetSelection
[wxWidgets.git] / src / motif / colour.cpp
index ee95c0a045c0b012c5bc3da3b87ce107f7064494..b77ec7a38bac47545d152de125965fe2045cff54 100644 (file)
@@ -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 ()
 {
 }