- // insert column into hash map:
- this->m_ColumnPointers.insert(ColumnPointerHashMapType::value_type(NewPropertyID,dataViewColumnPtr));
-
- // variable definitions:
- DataBrowserListViewColumnDesc columnDescription;
- wxMacCFStringHolder cfTitle(dataViewColumnPtr->GetTitle(),(this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()));
-
- // initialize column description:
- dataViewColumnPtr->SetPropertyID(NewPropertyID);
- columnDescription.propertyDesc.propertyID = NewPropertyID;
- columnDescription.propertyDesc.propertyType = dataViewColumnPtr->GetRenderer()->GetPropertyType();
- columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; // make the column selectable
- if (dataViewColumnPtr->IsSortable())
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn;
-#if 0
- if (dataViewColumnPtr->IsMovable())
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn;
-#endif
- if (dataViewColumnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE)
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable;
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
- if ((columnDescription.propertyDesc.propertyType == kDataBrowserTextType) ||
- (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
- (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType))
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
-#endif
- columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
- if (dataViewColumnPtr->IsResizeable())
- {
- columnDescription.headerBtnDesc.minimumWidth = 0;
- columnDescription.headerBtnDesc.maximumWidth = 30000;
- } /* if */
- else
- {
- columnDescription.headerBtnDesc.minimumWidth = dataViewColumnPtr->GetWidth();
- columnDescription.headerBtnDesc.maximumWidth = dataViewColumnPtr->GetWidth();
- } /* if */
- columnDescription.headerBtnDesc.titleOffset = 0;
- columnDescription.headerBtnDesc.titleString = cfTitle; // we cannot directly use the wxMacCFStringHolder constructor call because then the CFStringRef is released
- // having called 'AddColumn' where the title (CFStringRef) is going to be used
- columnDescription.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing;
- columnDescription.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask;
- switch (dataViewColumnPtr->GetAlignment())
- {
- case wxALIGN_CENTER:
- case wxALIGN_CENTER_HORIZONTAL:
- columnDescription.headerBtnDesc.btnFontStyle.just = teCenter;
- break;
- case wxALIGN_LEFT:
- columnDescription.headerBtnDesc.btnFontStyle.just = teFlushLeft;
- break;
- case wxALIGN_RIGHT:
- columnDescription.headerBtnDesc.btnFontStyle.just = teFlushRight;
- break;
- default:
- columnDescription.headerBtnDesc.btnFontStyle.just = teFlushDefault;
- } /* switch */
- columnDescription.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
- columnDescription.headerBtnDesc.btnFontStyle.style = normal;
- columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
- if (dataViewColumnPtr->GetBitmap().Ok())
- columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = dataViewColumnPtr->GetBitmap().GetBitmapData()->GetIconRef();
- // add column:
- wxCHECK_MSG(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn) == noErr,false,_("Column could not be added."));
-
- // final adjustments for the layout:
- wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,dataViewColumnPtr->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(dataViewColumnPtr);
- this->AddChildrenLevel(wxDataViewItem());
- } /* if */
- else
- MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);
- // done:
- return true;