- // initialize column description:
- wxCHECK_MSG (MacDataViewListCtrlPtr != NULL,false,_("m_peer is not or incorrectly initialized"));
- verify_noerr(MacDataViewListCtrlPtr->GetFreePropertyID(&FreeID));
- dataViewColumnPtr->SetPropertyID(FreeID);
- columnDescription.propertyDesc.propertyID = FreeID;
- columnDescription.propertyDesc.propertyType = dataViewColumnPtr->GetRenderer()->GetPropertyType();
- columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn;
- if (dataViewColumnPtr->IsSortable())
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn;
- if (dataViewColumnPtr->IsResizeable())
- columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn;
- 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;
- columnDescription.headerBtnDesc.minimumWidth = 0;
- columnDescription.headerBtnDesc.maximumWidth = 30000;
- 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:
- verify_noerr(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn));
- // final adjustments for the layout:
- if (dataViewColumnPtr->GetWidth() <= 0)
- {
- // 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;