]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/databrow.cpp
remove the drag-and-drop compatibility hack for extracting the embedded size of the...
[wxWidgets.git] / src / mac / carbon / databrow.cpp
index bde0284cbf4c35fc6071e0371d7c7308e342c9ae..e3e4610a480a5b7cba811d84a81e50aa81ed59ad 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "wx/wxprec.h"
 
+#if wxUSE_DATAVIEWCTRL
+
 #include "wx/utils.h"
 
 #ifndef WX_PRECOMP
@@ -221,6 +223,11 @@ OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID
   return ::GetDataBrowserTableViewNamedColumnWidth(this->m_controlRef,propertyID,width);
 }
 
+OSStatus wxMacDataBrowserTableViewControl::GetDefaultColumnWidth( UInt16 *width ) const
+{
+    return GetDataBrowserTableViewColumnWidth(this->m_controlRef, width );
+}
+
 OSStatus wxMacDataBrowserTableViewControl::GetDefaultRowHeight(UInt16* height) const
 {
   return ::GetDataBrowserTableViewRowHeight(this->m_controlRef,height);
@@ -231,15 +238,15 @@ OSStatus wxMacDataBrowserTableViewControl::GetHeaderButtonHeight(UInt16 *height)
   return ::GetDataBrowserListViewHeaderBtnHeight(this->m_controlRef,height);
 }
 
-OSStatus wxMacDataBrowserTableViewControl::GetDefaultColumnWidth( UInt16 *width ) const
+OSStatus wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect* bounds)
 {
-    return GetDataBrowserTableViewColumnWidth(this->m_controlRef, width );
-}
+  return ::GetDataBrowserItemPartBounds(this->m_controlRef,item,property,part,bounds);
+} /* wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID, DataBrowswerPropertyID, DataBrowserPropertyPart, Rect*) */
 
-OSStatus wxMacDataBrowserTableViewControl::GetRowHeight( DataBrowserItemID item , UInt16 *height) const
+OSStatus wxMacDataBrowserTableViewControl::GetRowHeight(DataBrowserItemID item, UInt16* height) const
 {
-    return GetDataBrowserTableViewItemRowHeight( m_controlRef, item , height);
-}
+  return ::GetDataBrowserTableViewItemRowHeight(this->m_controlRef,item,height);
+} /* wxMacDataBrowserTableViewControl::GetRowHeight(DataBrowserItemID, UInt16*) const */
 
 OSStatus wxMacDataBrowserTableViewControl::GetScrollPosition( UInt32 *top , UInt32 *left ) const
 {
@@ -268,20 +275,25 @@ OSStatus wxMacDataBrowserTableViewControl::SetDefaultRowHeight(UInt16 height)
   return ::SetDataBrowserTableViewRowHeight(this->m_controlRef,height);
 }
 
-OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars( bool horiz, bool vert )
+OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars(bool horiz, bool vert)
 {
-    return SetDataBrowserHasScrollBars(this->m_controlRef, horiz, vert );
-}
+  return ::SetDataBrowserHasScrollBars(this->m_controlRef,horiz,vert);
+} /* wxMacDataBrowserTableViewControl::SetHasScrollBars(bool, bool) */
 
 OSStatus wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16 height)
 {
-    return SetDataBrowserListViewHeaderBtnHeight(this->m_controlRef, height );
-}
+  return ::SetDataBrowserListViewHeaderBtnHeight(this->m_controlRef,height);
+} /* wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16) */
 
-OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle )
+OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle(DataBrowserTableViewHiliteStyle hiliteStyle)
 {
-    return SetDataBrowserTableViewHiliteStyle(this->m_controlRef, hiliteStyle );
-}
+  return ::SetDataBrowserTableViewHiliteStyle(this->m_controlRef,hiliteStyle);
+} /*wxMacDataBrowserTableViewControl::SetHiliteStyle(DataBrowserTableViewHiliteStyle)  */
+
+OSStatus wxMacDataBrowserTableViewControl::SetIndent(float Indent)
+{
+  return ::DataBrowserSetMetric(this->m_controlRef,kDataBrowserMetricDisclosureColumnPerDepthGap,true,Indent);
+} /* wxMacDataBrowserTableViewControl::SetIndent(float* Indent) */
 
 OSStatus wxMacDataBrowserTableViewControl::SetRowHeight(DataBrowserItemID item, UInt16 height)
 {
@@ -319,6 +331,11 @@ OSStatus wxMacDataBrowserTableViewControl::GetPropertyFlags(DataBrowserPropertyI
   return ::GetDataBrowserPropertyFlags(this->m_controlRef,propertyID,flags);
 }
 
+OSStatus wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID)
+{
+  return ::GetDataBrowserItemDataProperty(itemData,propertyID);
+} /* wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserItemDataRef, DataBrowserPropertyID*) */
+
 OSStatus wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserTableViewColumnIndex index, DataBrowserTableViewColumnID* propertyID)
 {
   return ::GetDataBrowserTableViewColumnProperty(this->m_controlRef,index,propertyID);
@@ -334,14 +351,19 @@ OSStatus wxMacDataBrowserTableViewControl::IsUsedPropertyID(DataBrowserPropertyI
   return ::GetDataBrowserTableViewColumnPosition(this->m_controlRef,propertyID,&index);
 } /* wxMacDataBrowserTableViewControl::IsUsedPropertyId(DataBrowserPropertyID) const */
 
-OSStatus wxMacDataBrowserTableViewControl::RemoveColumn(DataBrowserTableViewColumnIndex index)
+OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID)
+{
+  return ::RemoveDataBrowserTableViewColumn(this->m_controlRef,propertyID);
+} /* wxMacDataBrowserTableViewControl::RemoveColumnByProperty(DataBrowserTableViewColumnID) */
+
+OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByIndex(DataBrowserTableViewColumnIndex index)
 {
   DataBrowserTableViewColumnID propertyID;
 
 
   this->GetPropertyID(index,&propertyID);
   return ::RemoveDataBrowserTableViewColumn(this->m_controlRef,propertyID);
-} /* wxMacDataBrowserTableViewControl::RemoveColumn(DataBrowserTableViewColumnIndex) */
+} /* wxMacDataBrowserTableViewControl::RemoveColumnByIndex(DataBrowserTableViewColumnIndex) */
 
 OSStatus wxMacDataBrowserTableViewControl::SetColumnIndex(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index)
 {
@@ -491,25 +513,43 @@ OSStatus wxMacDataBrowserTableViewControl::SetSelectedItems(UInt32 numItems, Dat
   return ::SetDataBrowserSelectedItems(this->m_controlRef, numItems, items, operation );
 } /* wxMacDataBrowserTableViewControl::SetSelectedItems(UInt32, DataBrowserItemID const*, DataBrowserSetOption) */
 
+OSStatus wxMacDataBrowserTableViewControl::GetSortOrder(DataBrowserSortOrder* order) const
+{
+  return ::GetDataBrowserSortOrder(this->m_controlRef,order);
+}
+
 OSStatus wxMacDataBrowserTableViewControl::GetSortProperty(DataBrowserPropertyID* propertyID) const
 {
   return ::GetDataBrowserSortProperty(this->m_controlRef,propertyID);
 }
 
+OSStatus wxMacDataBrowserTableViewControl::Resort(DataBrowserItemID container, Boolean sortChildren)
+{
+  return ::SortDataBrowserContainer(this->m_controlRef,container,sortChildren);
+} /* wxMacDataBrowserTableViewControl::Resort(DataBrowserItemID, Boolean) */
+
+OSStatus wxMacDataBrowserTableViewControl::SetSortOrder(DataBrowserSortOrder order)
+{
+  return ::SetDataBrowserSortOrder(this->m_controlRef,order);
+}
+
 OSStatus wxMacDataBrowserTableViewControl::SetSortProperty(DataBrowserPropertyID propertyID)
 {
   return ::SetDataBrowserSortProperty(this->m_controlRef,propertyID);
 }
 
-OSStatus wxMacDataBrowserTableViewControl::GetSortOrder(DataBrowserSortOrder* order) const
+//
+// container handling
+//
+OSStatus wxMacDataBrowserTableViewControl::CloseContainer(DataBrowserItemID containerID)
 {
-  return ::GetDataBrowserSortOrder(this->m_controlRef,order);
-}
+  return ::CloseDataBrowserContainer(this->m_controlRef,containerID);
+} /* wxMacDataBrowserTableViewControl::CloseContainer(DataBrowserItemID) */
 
-OSStatus wxMacDataBrowserTableViewControl::SetSortOrder(DataBrowserSortOrder order)
+OSStatus wxMacDataBrowserTableViewControl::OpenContainer(DataBrowserItemID containerID)
 {
-  return ::SetDataBrowserSortOrder(this->m_controlRef,order);
-}
+  return ::OpenDataBrowserContainer(this->m_controlRef,containerID);
+} /* wxMacDataBrowserTableViewControl::OpenContainer(DataBrowserItemID) */
 
 IMPLEMENT_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl,wxMacControl)
 
@@ -542,6 +582,10 @@ wxMacDataViewDataBrowserListViewControl::wxMacDataViewDataBrowserListViewControl
 //
 Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty)
 {
+  DataBrowserSortOrder sortOrder;
+
+  DataBrowserTableViewColumnIndex columnIndex;
+  
   wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
   
 
@@ -549,13 +593,13 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow
   wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly."));
   if (sortProperty >= kMinPropertyID)
   {
-   // variable definition:
-    DataBrowserTableViewColumnIndex columnIndex;
-    
     wxCHECK_MSG(this->GetColumnIndex(sortProperty,&columnIndex) == noErr,false,_("Could not determine column index."));
-    dataViewCtrlPtr->GetModel()->SetSortingColumn(columnIndex);
   } /* if */
-  return static_cast<Boolean>(dataViewCtrlPtr->GetModel()->Compare(wxDataViewItem(reinterpret_cast<void*>(itemOneID)),wxDataViewItem(reinterpret_cast<void*>(itemTwoID))) < 0);
+  else
+    columnIndex = 0;
+  this->GetSortOrder(&sortOrder);
+  return static_cast<Boolean>(dataViewCtrlPtr->GetModel()->Compare(wxDataViewItem(reinterpret_cast<void*>(itemOneID)),wxDataViewItem(reinterpret_cast<void*>(itemTwoID)),
+                              columnIndex,sortOrder != kDataBrowserOrderDecreasing) < 0);
 } /* wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */
 
 void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice)
@@ -617,99 +661,139 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
   if (getValue)
   {
    // variable definitions:
-    DataBrowserTableViewColumnIndex columnIndex;
-    OSStatus                        errorStatus;
-    wxDataViewCtrl*                 dataViewCtrlPtr;
-    wxDataViewColumn*               dataViewColumnPtr;
+    wxDataViewCtrl* dataViewCtrlPtr;
     
     dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
-    wxCHECK_MSG(dataViewCtrlPtr != NULL,            errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
-    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);
-    wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index."));
-    switch (dataViewColumnPtr->GetRenderer()->GetPropertyType())
+    wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
+    if (dataViewCtrlPtr->IsDeleting())
+      return noErr; // if a delete process is running the data of editable fields cannot be saved because the associated model variable may already have been deleted
+    else
     {
-      case kDataBrowserCheckboxType:
-        {
-         // variable definition:
-          ThemeButtonValue buttonValue;
-
-          errorStatus = ::GetDataBrowserItemDataButtonValue(itemData,&buttonValue);
-          if (errorStatus == noErr)
+     // variable definitions:
+      DataBrowserTableViewColumnIndex columnIndex;
+      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);
+      wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index."));
+      switch (dataViewColumnPtr->GetRenderer()->GetPropertyType())
+      {
+        case kDataBrowserCheckboxType:
           {
-            if (buttonValue == kThemeButtonOn)
-            {
-             // variable definition and initialization:
-              wxVariant modifiedData(true);
+           // variable definition:
+            ThemeButtonValue buttonValue;
 
-              return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured));
-            } /* if */
-            else if (buttonValue == kThemeButtonOff)
+            errorStatus = ::GetDataBrowserItemDataButtonValue(itemData,&buttonValue);
+            if (errorStatus == noErr)
             {
-             // variable definition and initialization:
-              wxVariant modifiedData(false);
-
-              return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured));
+              if (buttonValue == kThemeButtonOn)
+              {
+               // variable definition and initialization:
+                wxVariant modifiedData(true);
+
+                return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured));
+              } /* if */
+              else if (buttonValue == kThemeButtonOff)
+              {
+               // variable definition and initialization:
+                wxVariant modifiedData(false);
+
+                return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)) ? OSStatus(noErr) : OSStatus(errDataBrowserNotConfigured));
+              } /* if */
+              else
+                return errDataBrowserInvalidPropertyData;
             } /* if */
             else
-              return errDataBrowserInvalidPropertyData;
-          } /* if */
-          else
-            return errorStatus;
-        } /* block */
-      case kDataBrowserTextType:
-        {
-         // variable definitions:
-          CFStringRef stringReference;
-
-          errorStatus = ::GetDataBrowserItemDataText(itemData,&stringReference);
-          if (errorStatus == noErr)
+              return errorStatus;
+          } /* block */
+        case kDataBrowserTextType:
           {
-           // variable definitions and initializations:
-            wxMacCFStringHolder modifiedString(stringReference);
-            wxVariant           modifiedData(modifiedString.AsString());
+           // variable definitions:
+            CFStringRef stringReference;
 
-            if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)))
-              return noErr;
+            errorStatus = ::GetDataBrowserItemDataText(itemData,&stringReference);
+            if (errorStatus == noErr)
+            {
+             // variable definitions and initializations:
+              wxMacCFStringHolder modifiedString(stringReference);
+              wxVariant           modifiedData(modifiedString.AsString());
+
+              if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)))
+                return noErr;
+              else
+                return errDataBrowserNotConfigured;
+            } /* if */
             else
-              return errDataBrowserNotConfigured;
-          } /* if */
-          else
-            return errorStatus;
-        } /* block */
-      default:
-        return errDataBrowserPropertyNotSupported;
-    } /* switch */
+              return errorStatus;
+          } /* block */
+        default:
+          return errDataBrowserPropertyNotSupported;
+      } /* switch */
+    } /* if */
   } /* if */
   else
   {
-    if (propertyID >= kMinPropertyID) // in case of data columns set the data
+    if (propertyID >= kMinPropertyID) // in case data columns set the data
     {
      // variable definitions:
-      DataBrowserTableViewColumnIndex columnIndex;
-      OSStatus                        errorStatus;
-      wxVariant                       variant;
-      wxDataViewColumn*               dataViewColumnPtr;
-      wxDataViewCtrl*                 dataViewCtrlPtr;
+      wxVariant         variant;
+      wxDataViewColumn* dataViewColumnPtr;
+      wxDataViewCtrl*   dataViewCtrlPtr;
       
       dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
       wxCHECK_MSG(dataViewCtrlPtr             != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
       wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
-      errorStatus = this->GetColumnIndex(propertyID,&columnIndex);
-      wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Column index does not exist."));
-      dataViewColumnPtr = dataViewCtrlPtr->GetColumn(columnIndex);
+      dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
       wxCHECK_MSG(dataViewColumnPtr                != NULL,errDataBrowserNotConfigured,_("No column for the specified column position existing."));
       wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,errDataBrowserNotConfigured,_("No renderer specified for column."));
       dataViewCtrlPtr->GetModel()->GetValue(variant,wxDataViewItem(reinterpret_cast<void*>(itemID)),dataViewColumnPtr->GetModelColumn());
-      dataViewColumnPtr->GetRenderer()->SetDataReference(itemData);
-      dataViewColumnPtr->GetRenderer()->SetValue(variant);
-      wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->Render(),errDataBrowserNotConfigured,_("Rendering failed."));
+      if (!(variant.IsNull()))
+      {
+        dataViewColumnPtr->GetRenderer()->SetDataReference(itemData);
+        dataViewColumnPtr->GetRenderer()->SetValue(variant);
+        wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->Render(),errDataBrowserNotConfigured,_("Rendering failed."));
+      } /* if */
+      return noErr;
     } /* if */
     else // react on special system requests
+    {
       switch (propertyID)
       {
+        case kDataBrowserContainerIsClosableProperty:
+          {
+           // variable definitions:
+            wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+            
+            wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
+           // initialize wxWidget event:
+            wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
+            
+            dataViewEvent.SetEventObject(dataViewCtrlPtr);
+            dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+           // finally send the equivalent wxWidget event:
+            dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+           // opening the container is allowed if not vetoed:
+            return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
+          } /* block */
+        case kDataBrowserContainerIsOpenableProperty:
+          {
+           // variable definitions:
+            wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+            
+            wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
+           // initialize wxWidget event:
+            wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
+              
+            dataViewEvent.SetEventObject(dataViewCtrlPtr);
+            dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+           // finally send the equivalent wxWidget event:
+            dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+           // opening the container is allowed if not vetoed:
+            return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
+          } /* block */
         case kDataBrowserItemIsContainerProperty:
           {
            // variable definition:
@@ -722,14 +806,32 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
         case kDataBrowserItemIsEditableProperty:
           return ::SetDataBrowserItemDataBooleanValue(itemData,true);
       } /* switch */
+    } /* if */
   } /* if */
   return errDataBrowserPropertyNotSupported;
 } /* wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemDataRef, Boolean) */
 
-void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef WXUNUSED(itemData))
+void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
 {
   switch (message)
   {
+    case kDataBrowserContainerClosed:
+      {
+       // variable definitions:
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+        
+        if (dataViewCtrlPtr != NULL) // can become NULL when the window is being deleted (wxWidget has already disposed the data before receiving this event
+        {
+         // initialize wxWidget event:
+          wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
+          
+          dataViewEvent.SetEventObject(dataViewCtrlPtr);
+          dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+         // finally send the equivalent wxWidget event:
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+        } /* if */
+      } /* block */
+      break;
     case kDataBrowserContainerOpened:
       {
        // variable definitions:
@@ -737,6 +839,99 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
         
         wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly."));
         dataViewCtrlPtr->AddChildrenLevel(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+       // initialize wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
+        
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+       // finally send the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+      } /* block */
+      break;
+    case kDataBrowserEditStarted:
+      {
+       // variable definitions:
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+        
+        if (dataViewCtrlPtr != NULL)
+        {
+         // initialize wxWidget event:
+          DataBrowserPropertyID propertyID;  
+          wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
+          
+          dataViewEvent.SetEventObject(dataViewCtrlPtr);
+          dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+          if (this->GetPropertyID(itemData,&propertyID) == noErr)
+          {
+           // variable definition and initialization:
+            DataBrowserTableViewColumnIndex columnIndex;
+            
+            wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
+            dataViewEvent.SetColumn(columnIndex);
+            dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));          
+          } /* if */
+         // finally send the equivalent wxWidget event:
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+        } /* if */
+      } /* block */
+      break;
+    case kDataBrowserEditStopped:
+    {
+     // variable definitions:
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+      
+      if (dataViewCtrlPtr != NULL)
+      {
+       // initialize wxWidget event:
+        DataBrowserPropertyID propertyID;  
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
+        
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+        if (this->GetPropertyID(itemData,&propertyID) == noErr)
+        {
+         // variable definition and initialization:
+          DataBrowserTableViewColumnIndex columnIndex;
+
+          wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
+          dataViewEvent.SetColumn(columnIndex);
+          dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));          
+        } /* if */
+       // finally send the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+      } /* if */
+    } /* block */
+      break;
+    case kDataBrowserItemAdded:
+      {
+       // variable definitions:
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+        
+        wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly."));
+       // initialize wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED,dataViewCtrlPtr->GetId()); // variable definition
+        
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+       // finally send the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+      } /* block */
+      break;
+    case kDataBrowserItemDeselected:
+      {
+       // variable definitions:
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+        
+        if (dataViewCtrlPtr != NULL) // can become NULL if an item is still selected while removing the data browser
+        {
+         // initialize wxWidget event:
+          wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DESELECTED,dataViewCtrlPtr->GetId()); // variable definition
+          
+          dataViewEvent.SetEventObject(dataViewCtrlPtr);
+          dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+         // finally send the equivalent wxWidget event:
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+        } /* if */
       } /* block */
       break;
     case kDataBrowserItemDoubleClicked:
@@ -750,10 +945,27 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
 
         dataViewEvent.SetEventObject(dataViewCtrlPtr);
         dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
-       // finally sent the equivalent wxWidget event:
+       // finally send the equivalent wxWidget event:
         dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
       } /* block */
       break;
+    case kDataBrowserItemRemoved:
+      {
+       // variable definitions:
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+
+        if (dataViewCtrlPtr != NULL) // can become NULL when the window is being deleted (wxWidget has already disposed the data before receiving this event
+        {
+         // initialize wxWidget event:
+          wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED,dataViewCtrlPtr->GetId()); // variable definition
+          
+          dataViewEvent.SetEventObject(dataViewCtrlPtr);
+          dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+         // finally send the equivalent wxWidget event:
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+        } /* if */
+      } /* block */
+      break;
     case kDataBrowserItemSelected:
       {
        // variable definitions:
@@ -765,10 +977,12 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
 
         dataViewEvent.SetEventObject(dataViewCtrlPtr);
         dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
-       // finally sent the equivalent wxWidget event:
+       // finally send the equivalent wxWidget event:
         dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
       } /* block */
       break;
+    case kDataBrowserSelectionSetChanged:
+      break;
     case kDataBrowserUserStateChanged:
       {
         DataBrowserPropertyID propertyID;
@@ -781,18 +995,23 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
           if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetColumnIndex(propertyID,&columnIndex) == noErr))
           {
            // variable definition and initialization:
-            wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
-
-            if (  dataViewCtrlPtr->GetColumn(columnIndex)->IsSortOrderAscending()  && (sortOrder == kDataBrowserOrderDecreasing) ||
-                !(dataViewCtrlPtr->GetColumn(columnIndex)->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing))
+            wxDataViewColumn* columnPtr;
+            wxDataViewCtrl*   dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+
+            wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data vie wcontrol not set correctly."));
+            columnPtr = dataViewCtrlPtr->GetColumn(columnIndex);
+           // check if the sort order has changed:
+            if (  columnPtr->IsSortOrderAscending()  && (sortOrder == kDataBrowserOrderDecreasing) ||
+                !(columnPtr->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing))
             {
+              columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending()));
              // initialize wxWidget event:
               wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
 
               dataViewEvent.SetEventObject(dataViewCtrlPtr);
               dataViewEvent.SetColumn(columnIndex);
-              dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumn(columnIndex));
-             // finally sent the equivalent wxWidget event:
+              dataViewEvent.SetDataViewColumn(columnPtr);
+             // finally send the equivalent wxWidget event:
               dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
             } /* if */
           } /* if */
@@ -803,5 +1022,5 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
 } /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
 
 
-#endif
- // wxUSE_GENERICDATAVIEWCTRL
+#endif // wxUSE_DATAVIEWCTRL
+#endif // wxUSE_GENERICDATAVIEWCTRL