- {
- // variable definition:
- UInt16 defaultColumnWidth;
-
- MacDataViewListCtrlPtr->GetDefaultColumnWidth(&defaultColumnWidth);
- dataViewColumnPtr->SetWidth(defaultColumnWidth);
- } /* if */
- verify_noerr(MacDataViewListCtrlPtr->SetColumnWidth(dataViewColumnPtr->GetPropertyID(),dataViewColumnPtr->GetWidth()));
- if (dataViewColumnPtr->IsSortable()) // if the current column is sortable and there is no active sortable column yet, the new column will become active
- {
- // variable definition:
- DataBrowserPropertyID sortedProperty;
-
- if ((MacDataViewListCtrlPtr->GetSortProperty(&sortedProperty) == noErr) && (sortedProperty < kMinPropertyID))
- MacDataViewListCtrlPtr->SetSortProperty(dataViewColumnPtr->GetPropertyID());
- } /* if */
-
- // now, make sure that data is shown in the newly appended column:
- if ((this->GetModel() != NULL) && (this->m_NotifierPtr != NULL) && (dataViewColumnPtr->GetModelColumn() >= 0) && (dataViewColumnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()))
- if (this->GetColumnCount() == 1) // the newly appended column is the only one and this means that no data has been inserted yet, so do it now:
- {
- // variable definition:
- DataBrowserItemID newID;
-
- for (size_t i=0; i<this->GetModel()->GetRowCount(); ++i)
- if (!((MacDataViewListCtrlPtr->GetFreeItemID(&newID) == noErr) && MacDataViewListCtrlPtr->InsertItemIDRowPair(newID,i) && (MacDataViewListCtrlPtr->AddItem(kDataBrowserNoItem,&newID) == noErr)))
- return false;
- } /* if */
- else
- for (size_t i=0; i<this->GetModel()->GetRowCount(); ++i)
- (void) this->m_NotifierPtr->ValueChanged(dataViewColumnPtr->GetModelColumn(),i);
+ dataViewColumnPtr->SetWidth(wxDVC_DEFAULT_WIDTH);
+ wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,dataViewColumnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
+ if (dataViewColumnPtr->IsSortable()) // if the current column is marked sortable this column will become the active sortable column, otherwise don't do anything
+ MacDataViewListCtrlPtr->SetSortProperty(NewPropertyID);
+ if (this->GetColumnCount()-1 == this->GetExpanderColumn()) // if the current column is marked expandable this column will become the active expandable column
+ MacDataViewListCtrlPtr->SetDisclosureColumn(NewPropertyID,true);
+
+ // make sure that the data is up-to-date...
+ // if the newly appended column is the first column add the initial data to the control otherwise ask the control to 'update' the data in the newly appended column:
+ if (this->GetColumnCount() == 1)
+ this->AddChildrenLevel(wxDataViewItem());
+ else
+ MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);