No changes, just use an extra variable in wxGTK wxDataViewCtrl code.

Store the column index in a variable instead of accessing it several times
using the clumsy and unclear cell->GetOwner()->GetModelColumn() expression.
This commit is contained in:
Vadim Zeitlin
2015-08-28 23:37:51 +02:00
parent bbecebd4ba
commit e8647b4751

View File

@@ -2897,6 +2897,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
wxDataViewRenderer *cell = (wxDataViewRenderer*) data; wxDataViewRenderer *cell = (wxDataViewRenderer*) data;
wxDataViewItem item( (void*) iter->user_data ); wxDataViewItem item( (void*) iter->user_data );
const unsigned column = cell->GetOwner()->GetModelColumn();
wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel(); wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel();
@@ -2905,8 +2906,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
gboolean visible; gboolean visible;
if (wx_model->IsContainer( item )) if (wx_model->IsContainer( item ))
{ {
visible = wx_model->HasContainerColumns( item ) || visible = wx_model->HasContainerColumns( item ) || (column == 0);
(cell->GetOwner()->GetModelColumn() == 0);
} }
else else
{ {
@@ -2924,7 +2924,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
} }
wxVariant value; wxVariant value;
wx_model->GetValue( value, item, cell->GetOwner()->GetModelColumn() ); wx_model->GetValue( value, item, column );
// It is always possible to leave a cell empty, don't warn about type // It is always possible to leave a cell empty, don't warn about type
// mismatch in this case. // mismatch in this case.
@@ -2942,7 +2942,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
cell->SetValue( value ); cell->SetValue( value );
// deal with disabled items // deal with disabled items
bool enabled = wx_model->IsEnabled( item, cell->GetOwner()->GetModelColumn() ); bool enabled = wx_model->IsEnabled( item, column );
// a) this sets the appearance to disabled grey // a) this sets the appearance to disabled grey
GValue gvalue = G_VALUE_INIT; GValue gvalue = G_VALUE_INIT;
@@ -2961,7 +2961,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
// it can support attributes so check if this item has any // it can support attributes so check if this item has any
wxDataViewItemAttr attr; wxDataViewItemAttr attr;
if ( wx_model->GetAttr( item, cell->GetOwner()->GetModelColumn(), attr ) if ( wx_model->GetAttr( item, column, attr )
|| !cell->GtkIsUsingDefaultAttrs() ) || !cell->GtkIsUsingDefaultAttrs() )
{ {
bool usingDefaultAttrs = !cell->GtkSetAttr(attr); bool usingDefaultAttrs = !cell->GtkSetAttr(attr);