]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/bmpbuttn.cpp
don't waste time sending out update UI events for separators, they can't be updated...
[wxWidgets.git] / src / gtk / bmpbuttn.cpp
index fcf8ff13bb969971116dda7953114e0012bc85ef..7920f09130c27f6e1849f192ddf536bbc0ef18bd 100644 (file)
@@ -137,6 +137,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
     m_bmpNormal = bitmap;
 
     m_widget = gtk_button_new();
     m_bmpNormal = bitmap;
 
     m_widget = gtk_button_new();
+    g_object_ref(m_widget);
 
     if (style & wxNO_BORDER)
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
 
     if (style & wxNO_BORDER)
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
@@ -204,21 +205,16 @@ void wxBitmapButton::OnSetBitmap()
     if (!the_one.Ok())
         return;
 
     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
 }
 
 wxSize wxBitmapButton::DoGetBestSize() const