1
0
forked from pool/wxWidgets-3_2
wxWidgets-3_2/wxWidgets-3.1.5-fix-wxIcon-wxDVC-columns.patch

39 lines
1.3 KiB
Diff

From c817a434d8d0d13a10f936af1eef0d8ffecb8069 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= <vaclav@slavik.io>
Date: Mon, 7 Jun 2021 16:15:53 +0200
Subject: [PATCH] Fix wxIcon wxDVC columns under wxGTK
b376d1402bdc48614888704cf191f82a630d93c0 accidentally broke columns
with wxIcon type. Contrary to that commit's assumption, operator<<
cannot convert wxIcon to wxBitmap and asserts:
src/common/bmpbase.cpp(33): assert "variant.GetType() == "wxBitmap"" failed in operator<<().
Fixed by restoring explicit conversion.
---
src/gtk/dataview.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 8ffa7b7b3b5..767334e0043 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -2562,8 +2562,16 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer( const wxString &varianttype,
bool wxDataViewBitmapRenderer::SetValue( const wxVariant &value )
{
wxBitmap bitmap;
- if (value.GetType() == wxS("wxBitmap") || value.GetType() == wxS("wxIcon"))
+ if (value.GetType() == wxS("wxBitmap"))
+ {
bitmap << value;
+ }
+ else if (value.GetType() == wxS("wxIcon"))
+ {
+ wxIcon icon;
+ icon << value;
+ bitmap.CopyFromIcon(icon);
+ }
#ifdef __WXGTK3__
WX_CELL_RENDERER_PIXBUF(m_renderer)->Set(bitmap);