void AdjustRowHeight(wxDataViewItem const& item);
// ... and the same method for a couple of items:
void AdjustRowHeights(wxDataViewItemArray const& items);
+ // adjust wxCOL_WIDTH_AUTOSIZE columns to fit the data
+ void AdjustAutosizedColumns();
private:
wxDataViewCtrl* m_DataViewCtrlPtr;
m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
// row height may have to be adjusted:
AdjustRowHeight(item);
+ AdjustAutosizedColumns();
// done
return true;
}
return false;
// if this location is reached all items have been updated:
AdjustRowHeights(items);
+ AdjustAutosizedColumns();
// done:
return true;
}
noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,item);
// enable automatic updating again:
m_DataViewCtrlPtr->SetDeleting(false);
+
+ AdjustAutosizedColumns();
// done:
return noFailureFlag;
}
noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,items);
// enable automatic updating again:
m_DataViewCtrlPtr->SetDeleting(false);
+
+ AdjustAutosizedColumns();
// done:
return noFailureFlag;
}
dataViewEvent.SetItem(item);
// send the equivalent wxWidget event:
m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+
+ AdjustAutosizedColumns();
// done
return true;
}
}
}
+void wxOSXDataViewModelNotifier::AdjustAutosizedColumns()
+{
+ unsigned count = m_DataViewCtrlPtr->GetColumnCount();
+ for ( unsigned col = 0; col < count; col++ )
+ {
+ wxDataViewColumn *column = m_DataViewCtrlPtr->GetColumnPtr(col);
+
+ if ( column->GetWidthVariable() == wxCOL_WIDTH_AUTOSIZE )
+ m_DataViewCtrlPtr->GetDataViewPeer()->FitColumnWidthToContent(col);
+ }
+}
+
// ---------------------------------------------------------
// wxDataViewCustomRenderer
// The constructor, the implementation macro and environment