-bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
-{
- DataBrowserListViewColumnDesc columnDescription;
-
- DataBrowserPropertyID NewPropertyID;
-
- wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
-
-#if wxCHECK_VERSION(2,9,0)
- wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
-#else
- wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
-#endif
-
-
- // first, some error checking:
- wxCHECK_MSG(MacDataViewListCtrlPtr != NULL, false,_("m_peer is not or incorrectly initialized"));
- 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(this->GetModel() != NULL, false,_("No model associated with control."));
- wxCHECK_MSG((columnPtr->GetModelColumn() >= 0) &&
- (columnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
-
- // try to get new ID for the column:
- wxCHECK_MSG(MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr,false,_("Cannot create new column's ID. Probably max. number of columns reached."));
- // full column variable initialization:
- columnPtr->SetPropertyID(NewPropertyID);
- // add column to wxWidget's internal structure:
- wxCHECK_MSG(this->wxDataViewCtrlBase::AppendColumn(columnPtr) &&
- this->m_ColumnPointers.insert(ColumnPointerHashMapType::value_type(NewPropertyID,columnPtr)).second,false,_("Could not add column to internal structures."));
- // create a column description and add column to the native control:
- wxCHECK_MSG(::InitializeColumnDescription(columnDescription,columnPtr,NewPropertyID,title),false,_("Column description could not be initialized."));
- wxCHECK_MSG(MacDataViewListCtrlPtr->AddColumn(&columnDescription,0) == noErr, false,_("Column could not be added."));
-
- // final adjustments for the layout:
- wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,columnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
-
- // 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 and mark the column as an expander column,
- // otherwise ask the control to 'update' the data in the newly appended column:
- if (this->GetColumnCount() == 1)
- {
- this->SetExpanderColumn(columnPtr);
- this->AddChildrenLevel(wxDataViewItem());
- } /* if */
- else
- MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);
- // done:
- return true;
-} /* wxDataViewCtrl::PrependColumn(wxDataViewColumn*) */
-