]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/bmpbuttn.cpp
optimize Replace() for the common case of replacing one character with another one...
[wxWidgets.git] / src / gtk / bmpbuttn.cpp
index fcf8ff13bb969971116dda7953114e0012bc85ef..916cbf0f16c595cffed0dc906c754818fc587e59 100644 (file)
@@ -204,21 +204,16 @@ void wxBitmapButton::OnSetBitmap()
     if (!the_one.Ok())
         return;
 
-    GtkWidget *child = GTK_BIN(m_widget)->child;
-    if (child == NULL)
+    GtkWidget* image = GTK_BIN(m_widget)->child;
+    if (image == NULL)
     {
-        // initial bitmap
-        GtkWidget *pixmap =
-            gtk_image_new_from_pixbuf(the_one.GetPixbuf());
-
-        gtk_widget_show(pixmap);
-        gtk_container_add(GTK_CONTAINER(m_widget), pixmap);
-    }
-    else
-    {   // subsequent bitmaps
-        GtkImage *pixmap = GTK_IMAGE(child);
-        gtk_image_set_from_pixbuf(pixmap, the_one.GetPixbuf());
+        image = gtk_image_new();
+        gtk_widget_show(image);
+        gtk_container_add(GTK_CONTAINER(m_widget), image);
     }
+    // always use pixbuf, because pixmap mask does not
+    // work with disabled images in some themes
+    gtk_image_set_from_pixbuf(GTK_IMAGE(image), the_one.GetPixbuf());
 }
 
 wxSize wxBitmapButton::DoGetBestSize() const