X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6fba6c78a4e1fee477d91e3735fdd69d5ab2f26b..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/gtk/bmpbuttn.cpp diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index fcf8ff13bb..7920f09130 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -137,6 +137,7 @@ bool wxBitmapButton::Create( wxWindow *parent, 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 ); @@ -204,21 +205,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