Don't show bogus value when there are none in wxGTK wxDVC neither

This is similar to the previous change to the generic version and simply
applies the same logic to the cells for which GetValue() returns null
value as for those for which HasValue() returns false.
This commit is contained in:
Vadim Zeitlin
2021-12-01 02:42:20 +01:00
parent 55420130b5
commit 74e1c444fa

View File

@@ -3171,6 +3171,14 @@ gtk_dataview_header_button_press_callback( GtkWidget *WXUNUSED(widget),
return FALSE;
}
// Helper for wxGtkTreeCellDataFunc() below.
static void wxGtkTreeSetVisibleProp(GtkCellRenderer *renderer, gboolean visible)
{
wxGtkValue gvalue( G_TYPE_BOOLEAN );
g_value_set_boolean( gvalue, visible );
g_object_set_property( G_OBJECT(renderer), "visible", gvalue );
}
extern "C"
{
@@ -3200,16 +3208,22 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
if (!wx_model->IsVirtualListModel())
{
gboolean visible = wx_model->HasValue(item, column);
wxGtkValue gvalue( G_TYPE_BOOLEAN );
g_value_set_boolean( gvalue, visible );
g_object_set_property( G_OBJECT(renderer), "visible", gvalue );
wxGtkTreeSetVisibleProp(renderer, visible);
if ( !visible )
return;
}
cell->GtkSetCurrentItem(item);
cell->PrepareForItem(wx_model, item, column);
if (!cell->PrepareForItem(wx_model, item, column))
{
// We don't have any value in this cell, after all, so hide it.
if (!wx_model->IsVirtualListModel())
{
wxGtkTreeSetVisibleProp(renderer, FALSE);
}
}
}
} // extern "C"