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
{
m_CustomRendererPtr = NULL;
m_Deleting = false;
- m_macIsUserPane = false;
m_cgContext = NULL;
}
const wxValidator& validator,
const wxString& name)
{
+ DontCreatePeer();
if (!(wxControl::Create(parent,id,pos,size,style,validator,name)))
return false;
- m_peer = ::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle());
+ SetPeer(::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle()));
MacPostControlCreate(pos,size);
wxCHECK_MSG(columnPtr != NULL, false,"Column pointer must not be NULL.");
wxCHECK_MSG(columnPtr->GetRenderer() != NULL, false,"Column does not have a renderer.");
wxCHECK_MSG(GetModel() != NULL, false,"No model associated with control.");
- wxCHECK_MSG((columnPtr->GetModelColumn() >= 0) &&
- (columnPtr->GetModelColumn() < GetModel()->GetColumnCount()),false,"Column's model column has no equivalent in the associated model.");
+ wxCHECK_MSG(columnPtr->GetModelColumn() < GetModel()->GetColumnCount(),false,"Column's model column has no equivalent in the associated model.");
// add column to wxWidget's internal structure:
if (wxDataViewCtrlBase::InsertColumn(pos,columnPtr))