From 6edc74808aab15c7f2645f9b8f24a89f66141adb Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 27 Dec 2007 17:45:40 +0000 Subject: [PATCH] Fix from Hartwig git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/databrow.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mac/carbon/databrow.cpp b/src/mac/carbon/databrow.cpp index 180327d493..97380b2bb1 100644 --- a/src/mac/carbon/databrow.cpp +++ b/src/mac/carbon/databrow.cpp @@ -611,7 +611,7 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow { DataBrowserSortOrder sortOrder; - DataBrowserTableViewColumnIndex columnIndex; + DataBrowserTableViewColumnIndex modelColumnIndex; wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(this->GetPeer())); @@ -620,13 +620,17 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); if (sortProperty >= kMinPropertyID) { - wxCHECK_MSG(this->GetColumnIndex(sortProperty,&columnIndex) == noErr,false,_("Could not determine column index.")); + // variable definition and initialization: + wxDataViewColumn* ColumnPtr(dataViewCtrlPtr->GetColumnPtr(sortProperty)); + + wxCHECK_MSG(ColumnPtr != NULL,false,_("Could not determine column index.")); + modelColumnIndex = ColumnPtr->GetModelColumn(); } /* if */ else - columnIndex = 0; + modelColumnIndex = 0; this->GetSortOrder(&sortOrder); return static_cast(dataViewCtrlPtr->GetModel()->Compare(wxDataViewItem(reinterpret_cast(itemOneID)),wxDataViewItem(reinterpret_cast(itemTwoID)), - columnIndex,sortOrder != kDataBrowserOrderDecreasing) < 0); + modelColumnIndex,sortOrder != kDataBrowserOrderDecreasing) < 0); } /* wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */ void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* WXUNUSED(selection)) @@ -668,14 +672,11 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc( else { // variable definitions: - DataBrowserTableViewColumnIndex columnIndex; - OSStatus errorStatus; - wxDataViewColumn* dataViewColumnPtr; + OSStatus errorStatus; + wxDataViewColumn* dataViewColumnPtr; wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); - errorStatus = this->GetColumnIndex(propertyID,&columnIndex); - wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Could not determine column index")); - dataViewColumnPtr = dataViewCtrlPtr->GetColumn(columnIndex); + dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID); wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index.")); switch (dataViewColumnPtr->GetRenderer()->GetPropertyType()) { @@ -692,14 +693,14 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc( // variable definition and initialization: wxVariant modifiedData(true); - return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast(itemID)),static_cast(columnIndex)) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured)); + return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast(itemID)),dataViewColumnPtr->GetModelColumn()) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured)); } /* if */ else if (buttonValue == kThemeButtonOff) { // variable definition and initialization: wxVariant modifiedData(false); - return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast(itemID)),static_cast(columnIndex)) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured)); + return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast(itemID)),dataViewColumnPtr->GetModelColumn()) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured)); } /* if */ else return errDataBrowserInvalidPropertyData; @@ -723,7 +724,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc( #endif wxVariant modifiedData(modifiedString.AsString()); - if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast(itemID)),static_cast(columnIndex))) + if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast(itemID)),dataViewColumnPtr->GetModelColumn())) return noErr; else return errDataBrowserNotConfigured; -- 2.45.2