From 36d21ce6c8bad682c6258e643c0cf4bc9b5e2d33 Mon Sep 17 00:00:00 2001 From: Igor Korot Date: Sun, 19 Aug 2018 12:04:04 +0200 Subject: [PATCH] Implement strike-through support for wxDataViewCtrl in wxGTK too Previously it was supported in the generic version only, see #18180 and the changes of 09124932eb7b1f6379b68ab193fc1ed8fedf01a0 Closes https://github.com/wxWidgets/wxWidgets/pull/892 --- docs/changes.txt | 2 +- interface/wx/dataview.h | 2 +- src/gtk/dataview.cpp | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 225685dbc2..aca1333053 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -110,7 +110,7 @@ All (GUI): - Fix possible infinite loop in wxHtmlWindow layout (trivia21). - Add "hint" property support to XRC for wxComboBox and wxSearchCtrl. - Add support for style="page-break-inside:avoid" to
in wxHTML. -- Add strike-through support to wxDataViewItem attributes (approach). +- Support strike-through in wxDataViewItem attributes (approach, Igor Korot). wxGTK: diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 61aad27b36..161ff7372c 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -718,7 +718,7 @@ public: text. Currently this attribute is only supported in the generic version of - wxDataViewCtrl and ignored by the native GTK+ and OS X implementations. + wxDataViewCtrl and GTK and ignored by the native OS X implementations. @since 3.1.2 */ diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index c7bd5f16c8..71bc42f004 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -2275,6 +2275,23 @@ void GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) g_value_unset( &gvalue ); } + if (attr.GetStrikethrough()) + { + GValue gvalue = G_VALUE_INIT; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, TRUE ); + g_object_set_property( G_OBJECT(renderer), "strikethrough", &gvalue ); + g_value_unset( &gvalue ); + } + else + { + GValue gvalue = G_VALUE_INIT; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, FALSE ); + g_object_set_property( G_OBJECT(renderer), "strikethrough-set", &gvalue ); + g_value_unset( &gvalue ); + } + if (attr.HasBackgroundColour()) { GValue gvalue = G_VALUE_INIT;