+static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDataViewItemArray const& items) // returns a newly allocated pointer to valid data browser item IDs
+{
+ size_t const noOfItems = items.GetCount();
+
+ DataBrowserItemID* itemIDs(new DataBrowserItemID[noOfItems]);
+
+
+ // convert all valid data view items to data browser items
+ noOfEntries = 0;
+ for (size_t i=0; i<noOfItems; ++i)
+ if (items[i].IsOk())
+ {
+ itemIDs[noOfEntries] = reinterpret_cast<DataBrowserItemID>(items[i].GetID());
+ ++noOfEntries;
+ } /* if */
+ // done:
+ return itemIDs;
+} /* CreateDataBrowserItemIDArray(size_t&, wxDataViewItemArray const&) */
+
+#if wxCHECK_VERSION(2,9,0)
+static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDescription, wxDataViewColumn const* columnPtr, DataBrowserPropertyID columnPropertyID, wxCFStringRef const& title)
+#else
+static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDescription, wxDataViewColumn const* columnPtr, DataBrowserPropertyID columnPropertyID, wxMacCFStringHolder const& title)
+#endif
+{
+ // set properties for the column:
+ columnDescription.propertyDesc.propertyID = columnPropertyID;
+ columnDescription.propertyDesc.propertyType = columnPtr->GetRenderer()->GetPropertyType();
+ columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; // make the column selectable
+ if (columnPtr->IsReorderable())
+ columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn;
+ if (columnPtr->IsResizeable())
+ {
+ columnDescription.headerBtnDesc.minimumWidth = 0;
+ columnDescription.headerBtnDesc.maximumWidth = 30000; // 32767 is the theoretical maximum though but 30000 looks nicer
+ } /* if */
+ else
+ {
+ columnDescription.headerBtnDesc.minimumWidth = columnPtr->GetWidth();
+ columnDescription.headerBtnDesc.maximumWidth = columnPtr->GetWidth();
+ } /* if */
+ if (columnPtr->IsSortable())
+ columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn;
+ if (columnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE)
+ columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable;
+ if ((columnDescription.propertyDesc.propertyType == kDataBrowserCustomType) ||
+ (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType) ||
+ (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
+ (columnDescription.propertyDesc.propertyType == kDataBrowserTextType))
+ columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; // enables generally the possibility to have user input for the mentioned types
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
+#endif
+ // set header's properties:
+ columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
+ columnDescription.headerBtnDesc.titleOffset = 0;
+ columnDescription.headerBtnDesc.titleString = ::CFStringCreateCopy(kCFAllocatorDefault,title);
+ columnDescription.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing; // choose one of the orders as "undefined" is not supported anyway (s. ControlDefs.h in the HIToolbox framework)
+ columnDescription.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask;
+ switch (columnPtr->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 (columnPtr->GetBitmap().Ok())
+#if wxCHECK_VERSION(2,9,0)
+ columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef();
+#else
+ columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetBitmapData()->GetIconRef();
+#endif
+ // done:
+ return true;
+} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
+