Add a class derived from GtkImage to support HiDPI bitmaps

And use it to get HiDPI support wherever we use GtkImage. This extends and
consolidates support for custom drawing of images which has already been added
somewhat redundantly in several places.
This commit is contained in:
Paul Cornett
2020-09-15 11:52:03 -07:00
parent cb04c35365
commit 85d63c3150
14 changed files with 314 additions and 134 deletions

View File

@@ -26,6 +26,7 @@
#include "wx/stockitem.h"
#include "wx/gtk/private.h"
#include "wx/gtk/private/image.h"
#include "wx/gtk/private/mnemonics.h"
// Number of currently open modal dialogs, defined in src/gtk/toplevel.cpp.
@@ -911,9 +912,8 @@ void wxMenu::GtkAppend(wxMenuItem* mitem, int pos)
const wxBitmap& bitmap = mitem->GetBitmap();
if (bitmap.IsOk())
{
// always use pixbuf, because pixmap mask does not
// work with disabled images in some themes
GtkWidget* image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
GtkWidget* image = wxGtkImage::New();
WX_GTK_IMAGE(image)->Set(bitmap);
menuItem = gtk_image_menu_item_new_with_label("");
gtk_widget_show(image);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem), image);