From: Robert Roebling Date: Fri, 12 Oct 2007 19:36:21 +0000 (+0000) Subject: Implemented HasContainerColumns() for GTK+ X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a826202ecf2e58f7bebb7514f3001dd703ddea03 Implemented HasContainerColumns() for GTK+ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 04d3f1d811..da79580e26 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -2024,8 +2024,40 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *column, wxDataViewItem item( (void*) iter->user_data ); + wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel(); + + if (wx_model->IsContainer( item )) + { + if (wx_model->HasContainerColumns( item ) || (cell->GetOwner()->GetModelColumn() == 0)) + { + GValue gvalue = { 0, }; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, TRUE ); + g_object_set_property( G_OBJECT(renderer), "visible", &gvalue ); + g_value_unset( &gvalue ); + } + else + { + GValue gvalue = { 0, }; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, FALSE ); + g_object_set_property( G_OBJECT(renderer), "visible", &gvalue ); + g_value_unset( &gvalue ); + + return; + } + } + else + { + GValue gvalue = { 0, }; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, TRUE ); + g_object_set_property( G_OBJECT(renderer), "visible", &gvalue ); + g_value_unset( &gvalue ); + } + wxVariant value; - tree_model->internal->GetDataViewModel()->GetValue( value, item, cell->GetOwner()->GetModelColumn() ); + wx_model->GetValue( value, item, cell->GetOwner()->GetModelColumn() ); if (value.GetType() != cell->GetVariantType()) wxLogError( wxT("Wrong type, required: %s but: %s"), @@ -2036,7 +2068,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *column, #if 0 wxListItemAttr attr; - tree_model->model->GetAttr( attr, cell->GetOwner()->GetModelColumn(), model_row ); + wx_model->GetAttr( item, attr, cell->GetOwner()->GetModelColumn() ); if (attr.HasBackgroundColour()) {