]> git.saurik.com Git - wxWidgets.git/commitdiff
fix masking of disabled bitmaps with some themes
authorPaul Cornett <paulcor@bullseye.com>
Fri, 18 Jul 2008 02:45:48 +0000 (02:45 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Fri, 18 Jul 2008 02:45:48 +0000 (02:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/bmpbuttn.cpp
src/gtk/menu.cpp
src/gtk/statbmp.cpp
src/gtk/tglbtn.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
index 782c17ce7bea190acac0f7c26cfeba8df074d773..47ece481a3592c403b6a34f586d21a5d0249a4c6 100644 (file)
@@ -787,16 +787,9 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
             const char* stockid;
             if (bitmap.IsOk())
             {
-                GtkWidget* image;
-                if (bitmap.HasPixbuf())
-                    image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
-                else
-                {
-                    GdkPixmap* mask = NULL;
-                    if (bitmap.GetMask())
-                        mask = bitmap.GetMask()->GetBitmap();
-                    image = gtk_image_new_from_pixmap(bitmap.GetPixmap(), mask);
-                }
+                // always use pixbuf, because pixmap mask does not
+                // work with disabled images in some themes
+                GtkWidget* image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
                 menuItem = gtk_image_menu_item_new_with_label("");
                 gtk_widget_show(image);
                 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem), image);
index 6d6f82649c4fadc58eeb2b083441e546cb391c64..aeb95223ec0407ac674d4d0a271a9b85dd27a83d 100644 (file)
@@ -14,8 +14,7 @@
 
 #include "wx/statbmp.h"
 
-#include "gdk/gdk.h"
-#include "gtk/gtk.h"
+#include <gtk/gtk.h>
 
 //-----------------------------------------------------------------------------
 // wxStaticBitmap
@@ -64,18 +63,9 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
 
     if (m_bitmap.Ok())
     {
-        GdkBitmap *mask = (GdkBitmap *) NULL;
-        if (m_bitmap.GetMask())
-            mask = m_bitmap.GetMask()->GetBitmap();
-
-        if (m_bitmap.HasPixbuf())
-        {
-            gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget),
-                                      m_bitmap.GetPixbuf());
-        }
-        else
-            gtk_image_set_from_pixmap(GTK_IMAGE(m_widget),
-                                      m_bitmap.GetPixmap(), mask);
+        // always use pixbuf, because pixmap mask does not
+        // work with disabled images in some themes
+        gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), m_bitmap.GetPixbuf());
 
         InvalidateBestSize();
         SetSize(GetBestSize());
index 50b319394fe82fe6247d269ab2acb3d3a42d2b8a..b98f15130567a668edf3e0a268e7d0f0986b2d03 100644 (file)
@@ -126,15 +126,13 @@ void wxBitmapToggleButton::OnSetBitmap()
     GtkWidget* image = ((GtkBin*)m_widget)->child;
     if (image == NULL)
     {
-        // initial bitmap
-        image = gtk_image_new_from_pixbuf(m_bitmap.GetPixbuf());
+        image = gtk_image_new();
         gtk_widget_show(image);
         gtk_container_add((GtkContainer*)m_widget, image);
     }
-    else
-    {   // subsequent bitmaps
-        gtk_image_set_from_pixbuf((GtkImage*)image, m_bitmap.GetPixbuf());
-    }
+    // always use pixbuf, because pixmap mask does not
+    // work with disabled images in some themes
+    gtk_image_set_from_pixbuf((GtkImage*)image, m_bitmap.GetPixbuf());
 }
 
 bool wxBitmapToggleButton::Enable(bool enable /*=true*/)