]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dataview.cpp
made Blur() methods const (bug 180914)
[wxWidgets.git] / src / mac / carbon / dataview.cpp
index 13644c5cee3d55864cc89a7bc67d64bad7665e46..1bb46b5f1f248950f4fea6c02f523ee523560261 100644 (file)
@@ -99,54 +99,42 @@ static pascal OSStatus wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
 DEFINE_ONE_SHOT_HANDLER_GETTER(wxMacDataViewCtrlEventHandler)
 
 // ---------------------------------------------------------
-// wxMacDataViewListModelNotifier
+// wxMacDataViewModelNotifier
 // ---------------------------------------------------------
 #pragma mark -
-class wxMacDataViewListModelNotifier : public wxDataViewListModelNotifier
+class wxMacDataViewModelNotifier : public wxDataViewModelNotifier
 {
 public:
-  wxMacDataViewListModelNotifier(wxMacDataViewDataBrowserListViewControl* initDataViewControlPtr) : m_dataViewControlPtr(initDataViewControlPtr)
+  wxMacDataViewModelNotifier(wxMacDataViewDataBrowserListViewControl* initDataViewControlPtr) : m_dataViewControlPtr(initDataViewControlPtr)
   {
   }
 
-  virtual bool RowAppended(void)
+  virtual bool ItemAdded(const wxDataViewItem &parent, const wxDataViewItem &item)
   {
-    DataBrowserItemID newRowID;
-    
-    
-    if ((this->m_dataViewControlPtr->GetFreeItemID(&newRowID) == noErr) &&
-         this->m_dataViewControlPtr->InsertItemIDRowPair(newRowID,this->GetOwner()->GetRowCount()-1) &&
-        (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&newRowID) == noErr))
-    {
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-      
-     // sent the equivalent wxWidget event:
-      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_APPENDED,dataViewCtrlPtr->GetId()); // variable defintion
+    DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
 
-      dataViewEvent.SetEventObject(dataViewCtrlPtr);
-      dataViewEvent.SetRow(this->GetOwner()->GetRowCount()-1);
-     // sent the equivalent wxWidget event:
-      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-     // done
-      return true;
-    } /* if */
-    else
-      return false;
-  }
-  virtual bool RowChanged(unsigned int row)
+
+    wxCHECK_MSG(item.IsOk(),false,_("Added item is invalid."));
+    return (!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&itemID) == noErr) ||
+            parent.IsOk()  && (this->m_dataViewControlPtr->AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr));
+  } /* ItemAdded(wxDataViewItem const&, wxDataViewItem const&) */
+
+  virtual bool ItemChanged(wxDataViewItem const& item)
   {
-    DataBrowserItemID itemID;
+    DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
     
     
-    if (this->m_dataViewControlPtr->GetItemID(row,&itemID) == noErr)
+    wxCHECK_MSG(item.IsOk(),             false,_("Changed item is invalid."));
+    wxCHECK_MSG(this->GetOwner() != NULL,false,_("Owner not initialized."));
+    if (this->m_dataViewControlPtr->UpdateItems(&itemID) == noErr)
     {
       wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
       
      // sent the equivalent wxWidget event:
-      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_VALUE_ITEM_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
-      dataViewEvent.SetRow(row);
+      dataViewEvent.SetItem(item);
      // sent the equivalent wxWidget event:
       dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
      // done
@@ -154,190 +142,72 @@ public:
     } /* if */
     else
       return false;
-  }
-  virtual bool RowDeleted(unsigned int row)
-  {
-    DataBrowserItemID itemID;
+  } /* ItemChanged(wxDataViewItem const&) */
 
-
-    if (this->m_dataViewControlPtr->GetItemID(row,&itemID) == noErr)
-    {
-     // variable definition:
-      unsigned long rowIndex;
-      
-      wxCHECK_MSG(this->m_dataViewControlPtr->GetRowIndex(rowIndex,itemID) && this->m_dataViewControlPtr->DeleteItemIDRowPair(itemID),false,_("Unable to delete row data."));
-      this->m_dataViewControlPtr->RenumberItemIDRowIndicesDeletion(rowIndex);
-      if (this->m_dataViewControlPtr->RemoveItem(kDataBrowserNoItem,&itemID) == noErr)
-      {
-        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-        
-       // sent the equivalent wxWidget event:
-        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_DELETED,dataViewCtrlPtr->GetId()); // variable defintion
-
-        dataViewEvent.SetEventObject(dataViewCtrlPtr);
-        dataViewEvent.SetRow(row);
-       // sent the equivalent wxWidget event:
-        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-       // done
-        return true;
-      } /* if */
-      else
-        return false;
-    } /* if */
-    else
-      return false;
-  }
-  virtual bool RowInserted(unsigned int before)
+  virtual bool ItemDeleted(wxDataViewItem const& parent, wxDataViewItem const& item)
   {
-    DataBrowserItemID newRowID;
-
-
-    if (this->m_dataViewControlPtr->GetFreeItemID(&newRowID) == noErr)
+    if (item.IsOk())
     {
-      this->m_dataViewControlPtr->RenumberItemIDRowIndicesInsertion(before);
-      if (this->m_dataViewControlPtr->InsertItemIDRowPair(newRowID,before) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&newRowID) == noErr))
-      {
-        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-        
-       // sent the equivalent wxWidget event:
-        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_INSERTED,dataViewCtrlPtr->GetId()); // variable defintion
-
-        dataViewEvent.SetEventObject(dataViewCtrlPtr);
-        dataViewEvent.SetRow(before);
-       // sent the equivalent wxWidget event:
-        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-       // done
-        return true;
-      } /* if */
-      else
-        return false;
+     // variable definition and initialization:
+      DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+      OSStatus          errorStatus;
+      wxDataViewCtrl*   dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      
+     // when this method is called and currently an item is being edited this item may have already been deleted in the model (the passed item and the being edited item have
+     // not to be identical because the being edited item might be below the passed item in the hierarchy); therefore, the control is informed that currently a deleting process
+     // is started and that variables can currently not be updated even when requested by the system:
+      dataViewCtrlPtr->SetDeleting(true);
+      errorStatus = this->m_dataViewControlPtr->RemoveItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID);
+      dataViewCtrlPtr->SetDeleting(false);
+      return (errorStatus == noErr);
     } /* if */
     else
       return false;
-  }
-  virtual bool RowPrepended(void)
-  {
-    DataBrowserItemID newRowID;
-
+  } /* ItemDeleted(wxDataViewItem const&, wxDataViewItem const&) */
 
-    if (this->m_dataViewControlPtr->GetFreeItemID(&newRowID) == noErr)
-    {
-      this->m_dataViewControlPtr->RenumberItemIDRowIndicesInsertion(0);
-      if (this->m_dataViewControlPtr->InsertItemIDRowPair(newRowID,0) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&newRowID) == noErr))
-      {
-        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-        
-       // sent the equivalent wxWidget event:
-        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_PREPENDED,dataViewCtrlPtr->GetId()); // variable defintion
-
-        dataViewEvent.SetEventObject(dataViewCtrlPtr);
-        dataViewEvent.SetRow(0);
-       // sent the equivalent wxWidget event:
-        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-       // done
-        return true;
-      } /* if */
-      else
-        return false;
-    } /* if */
-    else
-      return false;
-  }
-  virtual bool ValueChanged(unsigned int col, unsigned int row)
+  virtual bool ValueChanged(wxDataViewItem const& item, unsigned int col)
   {
-    DataBrowserItemID itemID;
+    DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+    DataBrowserItemID parentID;
     
     DataBrowserPropertyID propertyID;
 
-    
-    wxDataViewCtrl*  dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-    
-    if ((dataViewCtrlPtr != NULL) && (this->m_dataViewControlPtr->GetItemID(row,&itemID) == noErr) && (this->m_dataViewControlPtr->GetColumnID(col,&propertyID) == noErr) &&
-        (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
+    wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+
+
+    wxCHECK_MSG(item.IsOk(),             false,_("Passed item is invalid."));
+    wxCHECK_MSG(this->GetOwner() != NULL,false,_("Owner not initialized."));
+    wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Control is wrongly initialized."));
+    parentID = reinterpret_cast<DataBrowserItemID>(this->GetOwner()->GetParent(item).GetID());
+    if ((this->m_dataViewControlPtr->GetPropertyID(col,&propertyID) == noErr) &&
+        (this->m_dataViewControlPtr->UpdateItems(parentID,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
     {
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-      
-     // sent the equivalent wxWidget event:
-      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
+     // variable definition and initialization:
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId());
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
       dataViewEvent.SetColumn(col);
-      dataViewEvent.SetRow(row);
-     // sent the equivalent wxWidget event:
+      dataViewEvent.SetItem(item);
+     // send the equivalent wxWidget event:
       dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
      // done
       return true;
     } /* if */
     else
       return false;
-  }
-  virtual bool RowsReordered(unsigned int* new_order)
-  {
-    DataBrowserPropertyID propertyId;
+  } /* ValueChanged(wxDataViewItem const&, unsigned int) */
 
-        
-    if ((new_order != NULL) && (this->m_dataViewControlPtr->GetSortProperty(&propertyId) == noErr) && (propertyId >= kMinPropertyID))
-    {
-      DataBrowserSortOrder sortOrder;
-      unsigned long        column;
-          
-      if ((this->m_dataViewControlPtr->GetSortOrder(&sortOrder) == noErr) && (this->m_dataViewControlPtr->GetPropertyColumn(propertyId,&column) == noErr))
-      {
-        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-        
-        if (dataViewCtrlPtr->GetColumn(column)->IsSortOrderAscending())
-          this->m_dataViewControlPtr->RenumberItemIDRowIndices(new_order);
-        else // the sort order of the control is descending but the passed sort order is always ordered top - down
-        {
-          ItemCount itemCount;
-
-          if (this->m_dataViewControlPtr->GetItemCount(&itemCount) != noErr)
-            return false;
-          unsigned int* reversedOrder(new unsigned int[itemCount]);
-          
-          for (ItemCount i=0; i<itemCount; ++i)
-            reversedOrder[i] = itemCount-new_order[i];
-          this->m_dataViewControlPtr->RenumberItemIDRowIndices(reversedOrder);
-          delete[] reversedOrder;
-        } /* if */
-        if (this->m_dataViewControlPtr->UpdateItems())
-        {
-         // sent the equivalent wxWidget event:
-          wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROWS_REORDERED,dataViewCtrlPtr->GetId()); // variable defintion
-
-          dataViewEvent.SetEventObject(dataViewCtrlPtr);
-         // sent the equivalent wxWidget event:
-          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-         // done
-          return true;
-        } /* if */
-        else
-          return false;
-      } /* if */
-      else
-        return false;
-    } /* if */
-    else
-      return false;
-  }
   virtual bool Cleared(void)
   {
-    this->m_dataViewControlPtr->ClearItemIDRowPairs();
     if (this->m_dataViewControlPtr->RemoveItems() == noErr)
-    {
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-      
-     // sent the equivalent wxWidget event:
-      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED,dataViewCtrlPtr->GetId()); // variable defintion
-
-      dataViewEvent.SetEventObject(dataViewCtrlPtr);
-     // sent the equivalent wxWidget event:
-      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-     // done
       return true;
-    } /* if */
     else
       return false;
+  } /* Cleared(void) */
+
+  virtual void Resort(void)
+  {
+    this->m_dataViewControlPtr->Resort();
   }
 
 protected:
@@ -397,7 +267,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase)
 // ---------------------------------------------------------
 #pragma mark -
 wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
-                         :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL)
+                         :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL), m_DCPtr(NULL)
 {
 } /* wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const&, wxDataViewCellMode) */
 
@@ -420,7 +290,7 @@ wxDC* wxDataViewCustomRenderer::GetDC(void)
 
 bool wxDataViewCustomRenderer::Render(void)
 {
-  return false;
+  return true;
 } /* wxDataViewCustomRenderer::Render(void) */
 
 void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr)
@@ -475,7 +345,7 @@ bool wxDataViewBitmapRenderer::Render(void)
     if (bitmap.Ok())
       return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetBitmapData()->GetIconRef()) == noErr);
     else
-      return false;
+      return true;
   } /* if */
   else
     return false;
@@ -483,6 +353,37 @@ bool wxDataViewBitmapRenderer::Render(void)
 
 IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer)
 
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                           :wxDataViewRenderer(varianttype,mode)
+{
+}
+
+bool wxDataViewIconTextRenderer::Render(void)
+{
+  if (this->GetValue().GetType() == this->GetVariantType())
+  {
+   // variable definition:
+    wxDataViewIconText iconText;
+    
+    iconText << this->GetValue();
+
+   // variable definition:
+    wxMacCFStringHolder cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+    
+    return ((::SetDataBrowserItemDataIcon(this->GetDataReference(),MAC_WXHICON(iconText.GetIcon().GetHICON())) == noErr) &&
+            (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr));
+  } /* if */
+  else
+    return false;
+} /* wxDataViewIconTextRenderer::Render(void) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer)
+
+
 // ---------------------------------------------------------
 // wxDataViewToggleRenderer
 // ---------------------------------------------------------
@@ -547,14 +448,16 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer)
 // ---------------------------------------------------------
 #pragma mark -
 wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer *cell, unsigned int model_column, int width, wxAlignment align, int flags)
-                 :wxDataViewColumnBase(title,cell,model_column,width,wxALIGN_CENTER,flags), m_alignment(align), m_ascending(true),
-                  m_flags(flags & ~(wxDATAVIEW_COL_HIDDEN | wxDATAVIEW_COL_RESIZABLE)), m_minWidth(0), m_maxWidth(std::numeric_limits<int>::max()), m_width(width), m_title(title)
+                 :wxDataViewColumnBase(title,cell,model_column,width,wxALIGN_CENTER,flags), m_ascending(true),
+                  m_flags(flags & ~(wxDATAVIEW_COL_HIDDEN)), m_maxWidth(30000), m_minWidth(0), m_width(width >= 0 ? width : wxDVC_DEFAULT_WIDTH),
+                  m_alignment(align), m_title(title)
 {
 } /* wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
 
 wxDataViewColumn::wxDataViewColumn(wxBitmap const& bitmap, wxDataViewRenderer *cell, unsigned int model_column, int width, wxAlignment align, int flags)
-                 :wxDataViewColumnBase(bitmap,cell,model_column,width,wxALIGN_CENTER,flags), m_ascending(true), m_alignment(align),
-                  m_flags(flags & (wxDATAVIEW_COL_HIDDEN | wxDATAVIEW_COL_RESIZABLE)), m_minWidth(0), m_maxWidth(std::numeric_limits<int>::max()), m_width(width)
+                 :wxDataViewColumnBase(bitmap,cell,model_column,width,wxALIGN_CENTER,flags), m_ascending(true),
+                  m_flags(flags & ~(wxDATAVIEW_COL_HIDDEN)), m_maxWidth(30000), m_minWidth(0), m_width(width >= 0 ? width : wxDVC_DEFAULT_WIDTH),
+                  m_alignment(align)
 {
 } /* wxDataViewColumn::wxDataViewColumn(wxBitmap const&, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
 
@@ -731,6 +634,7 @@ void wxDataViewColumn::SetSortOrder(bool ascending)
       else
         headerDescription.initialOrder = kDataBrowserOrderDecreasing;
       verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription));
+      macDataViewListCtrlPtr->SetSortProperty(this->GetPropertyID());
     } /* if */
   } /* if */
 } /* wxDataViewColumn::SetSortOrder(bool) */
@@ -786,8 +690,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn,wxDataViewColumnBase)
 #pragma mark -
 void wxDataViewCtrl::Init(void)
 {
+  this->m_Deleting      = false;
   this->m_macIsUserPane = false;
-  this->m_NotifierPtr   = NULL;
   this->m_cgContext     = NULL;
 } /* wxDataViewCtrl::Init(void) */
 
@@ -802,68 +706,57 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
 
   this->m_peer = new wxMacDataViewDataBrowserListViewControl(this,pos,size,style);
   this->MacPostControlCreate(pos,size);
+  ::SetAutomaticControlDragTrackingEnabledForWindow(::GetControlOwner(this->m_peer->GetControlRef()),true);
 
   InstallControlEventHandler(this->m_peer->GetControlRef(),GetwxMacDataViewCtrlEventHandlerUPP(),GetEventTypeCount(eventList),eventList,this,NULL);
 
   return true;
 } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
 
-void wxDataViewCtrl::OnSize(wxSizeEvent& event)
-{
-  unsigned int const NoOfColumns = this->GetColumnCount();
-
-
-  for (unsigned int i=0; i<NoOfColumns; ++i)
-  {
-   // variable definition and initialization:
-    wxDataViewColumn* dataViewColumnPtr(this->GetColumn(i));
-    
-    if (dataViewColumnPtr != NULL)
-    {
-     // variable definition and initialization:
-      wxDataViewCustomRenderer* dataViewCustomRendererPtr(dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer()));
-    
-      if (dataViewCustomRendererPtr != NULL)
-        dataViewCustomRendererPtr->SetDC(NULL); // reset DC because DC has changed
-    } /* if */
-  } /* for */
-  event.Skip();
-} /* wxDataViewCtrl::OnSize(wxSizeEvent&) */
-
-bool wxDataViewCtrl::AssociateModel(wxDataViewListModel *model)
+bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model)
 {
   if (!wxDataViewCtrlBase::AssociateModel(model))
     return false;
   
-  this->m_NotifierPtr = new wxMacDataViewListModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer));
-  model->AddNotifier(this->m_NotifierPtr);
+  model->AddNotifier(new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer)));
 
   return true;
-}
+} /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
 
 bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
 {
-  wxCHECK_MSG(dataViewColumnPtr != NULL,               false,_("Column pointer must not be NULL."));
-  wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,false,_("Column does not have a renderer."));
-  if (this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr))
+  DataBrowserPropertyID NewPropertyID;
+
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+ // first, some error checking:
+  wxCHECK_MSG(MacDataViewListCtrlPtr != NULL,                                            false,_("m_peer is not or incorrectly initialized"));
+  wxCHECK_MSG(dataViewColumnPtr != NULL,                                                 false,_("Column pointer must not be NULL."));
+  wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,                                  false,_("Column does not have a renderer."));
+  wxCHECK_MSG(this->GetModel() != NULL,                                                  false,_("No model associated with control."));
+  wxCHECK_MSG((dataViewColumnPtr->GetModelColumn() >= 0) &&
+              (dataViewColumnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
+  if ((MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr) && this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr))
   {
-   // variable definition:
-    DataBrowserPropertyID                          FreeID;
-    DataBrowserListViewColumnDesc                  columnDescription;
-    wxMacCFStringHolder                            cfTitle(dataViewColumnPtr->GetTitle(),(this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()));
-    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+   // 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:
-    wxCHECK_MSG (MacDataViewListCtrlPtr != NULL,false,_("m_peer is not or incorrectly initialized"));
-    verify_noerr(MacDataViewListCtrlPtr->GetFreePropertyID(&FreeID));
-    dataViewColumnPtr->SetPropertyID(FreeID);
-    columnDescription.propertyDesc.propertyID = FreeID;
+    dataViewColumnPtr->SetPropertyID(NewPropertyID);
+    columnDescription.propertyDesc.propertyID = NewPropertyID;
     columnDescription.propertyDesc.propertyType = dataViewColumnPtr->GetRenderer()->GetPropertyType();
-    columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn;
+    columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; // make the column selectable
     if (dataViewColumnPtr->IsSortable())
       columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn;
-    if (dataViewColumnPtr->IsResizeable())
+#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
@@ -876,8 +769,16 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
     columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
 #endif
     columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
-    columnDescription.headerBtnDesc.minimumWidth = 0;
-    columnDescription.headerBtnDesc.maximumWidth = 30000;
+    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
@@ -904,40 +805,21 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
     if (dataViewColumnPtr->GetBitmap().Ok())
       columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = dataViewColumnPtr->GetBitmap().GetBitmapData()->GetIconRef();
    // add column:
-    verify_noerr(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn));
+    wxCHECK_MSG(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn) == noErr,false,_("Column could not be added."));
+
    // 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;
+    wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,dataViewColumnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
 
-      if ((MacDataViewListCtrlPtr->GetSortProperty(&sortedProperty) == noErr) && (sortedProperty < kMinPropertyID))
-        MacDataViewListCtrlPtr->SetSortProperty(dataViewColumnPtr->GetPropertyID());
+   // 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 */
-
-   // now, make sure that data is shown in the newly appended column:
-    if ((this->GetModel() != NULL) && (this->m_NotifierPtr != NULL) && (dataViewColumnPtr->GetModelColumn() >= 0) && (dataViewColumnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()))
-      if (this->GetColumnCount() == 1) // the newly appended column is the only one and this means that no data has been inserted yet, so do it now:
-      {
-       // variable definition:
-        DataBrowserItemID newID;
-        
-        for (size_t i=0; i<this->GetModel()->GetRowCount(); ++i)
-          if (!((MacDataViewListCtrlPtr->GetFreeItemID(&newID) == noErr) && MacDataViewListCtrlPtr->InsertItemIDRowPair(newID,i) && (MacDataViewListCtrlPtr->AddItem(kDataBrowserNoItem,&newID) == noErr)))
-            return false;
-      } /* if */
-      else
-        for (size_t i=0; i<this->GetModel()->GetRowCount(); ++i)
-          (void) this->m_NotifierPtr->ValueChanged(dataViewColumnPtr->GetModelColumn(),i);
+    else
+      MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);
    // done:
     return true;
   } /* if */
@@ -945,149 +827,343 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
     return false;
 } /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
 
-int wxDataViewCtrl::GetSelection(void) const
+bool wxDataViewCtrl::ClearColumns(void)
 {
-  wxArrayInt selectedRows;
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+  
+  while (this->m_ColumnPointers.begin() != this->m_ColumnPointers.end())
+  {
+    wxCHECK_MSG(MacDataViewListCtrlPtr->RemoveColumnByProperty(this->m_ColumnPointers.begin()->first) == noErr,false,_("Could not remove column."));
+    delete this->m_ColumnPointers.begin()->second;
+    this->m_ColumnPointers.erase(this->m_ColumnPointers.begin());
+  } /* while */
+  return true;
+} /* wxDataViewCtrl::ClearColumns(void) */
+
+bool wxDataViewCtrl::DeleteColumn(wxDataViewColumn* columnPtr)
+{
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+  
+  if ((MacDataViewListCtrlPtr->RemoveColumnByProperty(columnPtr->GetPropertyID()) == noErr) && (this->m_ColumnPointers.erase(columnPtr->GetPropertyID()) > 0))
+  {
+    delete columnPtr;
+    return true;
+  } /* if */
+  else
+    return false;
+} /* wxDataViewCtrl::DeleteColumn(wxDataViewColumn*) */
+
+wxDataViewColumn* wxDataViewCtrl::GetColumn(unsigned int pos) const
+{
+  DataBrowserPropertyID propertyID;
+  
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+  
+  if (MacDataViewListCtrlPtr->GetPropertyID(pos,&propertyID) == noErr)
+  {
+   // variable definition:
+    ColumnPointerHashMapType::const_iterator Result(this->m_ColumnPointers.find(propertyID));
+    
+    if (Result != this->m_ColumnPointers.end())
+      return Result->second;
+    else
+      return NULL;
+  } /* if */
+  else
+    return NULL;
+} /* wxDataViewCtrl::GetColumn(unsigned int pos) const */
 
+unsigned int wxDataViewCtrl::GetColumnCount(void) const
+{
+  return this->m_ColumnPointers.size();
+} /* wxDataViewCtrl::GetColumnCount(void) const */
 
-  if (this->GetSelections(selectedRows) > 0)
-    return selectedRows[0];
+int wxDataViewCtrl::GetColumnPosition(wxDataViewColumn const* columnPtr) const
+{
+  if (columnPtr != NULL)
+  {
+   // variable definition and initialization:
+    DataBrowserTableViewColumnIndex                Position;
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+    
+    wxCHECK_MSG(MacDataViewListCtrlPtr->GetColumnIndex(columnPtr->GetPropertyID(),&Position) == noErr,-1,_("Could not determine column's position"));
+    return static_cast<int>(Position);
+  } /* if */
   else
     return wxNOT_FOUND;
-} /* wxDataViewCtrl::GetSelection(void) const */
+} /* wxDataViewCtrl::GetColumnPosition(wxDataViewColumn const*) const */
 
-int wxDataViewCtrl::GetSelections(wxArrayInt& selectedRows) const
+void wxDataViewCtrl::Collapse(wxDataViewItem const& item)
 {
-  size_t NoOfSelections;
-  wxArrayDataBrowserItemID itemIDs;
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
-  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
+  MacDataViewListCtrlPtr->CloseContainer(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+} /* wxDataViewCtrl::Collapse(wxDataViewItem const&) */
 
-  if (dataViewListCtrlPtr == NULL)
-    NoOfSelections = 0;
+void wxDataViewCtrl::EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr)
+{
+  if (item.IsOk())
+  {
+   // variable definition and initialization:
+    DataBrowserPropertyID propertyID;
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+    if (columnPtr != NULL)
+      propertyID = columnPtr->GetPropertyID();
+    else
+      propertyID = kDataBrowserNoItem;
+    MacDataViewListCtrlPtr->RevealItem(reinterpret_cast<DataBrowserItemID>(item.GetID()),propertyID,kDataBrowserRevealOnly);
+  } /* if */
+} /* wxDataViewCtrl::EnsureVisible(wxDataViewItem const&, wxDataViewColumn const*) */
+
+void wxDataViewCtrl::Expand(wxDataViewItem const& item)
+{
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  
+  MacDataViewListCtrlPtr->OpenContainer(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+} /* wxDataViewCtrl::Expand(wxDataViewItem const&) */
+
+wxDataViewColumn* wxDataViewCtrl::GetSortingColumn(void) const
+{
+  DataBrowserPropertyID propertyID;
+
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  
+  if (MacDataViewListCtrlPtr->GetSortProperty(&propertyID) == noErr)
+    return this->GetColumnPtr(propertyID);
   else
-    NoOfSelections = dataViewListCtrlPtr->GetSelectedItemIDs(itemIDs);
-  selectedRows.Empty();
-  selectedRows.Alloc(NoOfSelections);
-  for (size_t i=0; i<NoOfSelections; ++i)
+    return NULL;
+} /* wxDataViewCtrl::GetSortingColumn(void) const */
+
+unsigned int wxDataViewCtrl::GetCount(void) const
+{
+  ItemCount noOfItems;
+
+
+  wxCHECK_MSG(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer)->GetItemCount(&noOfItems) == noErr,0,_("Could not determine number of items"));
+  return noOfItems;
+} /* wxDataViewCtrl::GetCount(void) const */
+
+wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
+{
+  if (item.IsOk() && (columnPtr != NULL))
   {
    // variable definition:
-    DataBrowserTableViewRowIndex rowIndex;
+    Rect                                           MacRectangle;
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
     
-    wxCHECK_MSG(dataViewListCtrlPtr->GetRowIndex(rowIndex,itemIDs[i]),0,_("Could not determine row index."));
-    selectedRows[i] = static_cast<int>(rowIndex);
-  } /* for */
-  return static_cast<int>(NoOfSelections);
-} /* wxDataViewCtrl::GetSelections(wxArrayInt&) const */
+    if (MacDataViewListCtrlPtr->GetPartBounds(reinterpret_cast<DataBrowserItemID>(item.GetID()),columnPtr->GetPropertyID(),kDataBrowserPropertyContentPart,&MacRectangle) == noErr)
+    {
+     // variable definition:
+      wxRect rectangle;
+      
+      ::wxMacNativeToRect(&MacRectangle,&rectangle);
+      return rectangle;
+    } /* if */
+    else
+      return wxRect();
+  } /* if */
+  else
+    return wxRect();
+} /* wxDataViewCtrl::GetItemRect(wxDataViewItem const&, unsigned int) const */
 
-bool wxDataViewCtrl::IsSelected(unsigned int row) const
+wxDataViewItem wxDataViewCtrl::GetSelection(void) const
 {
-  DataBrowserItemID itemID;
+  wxArrayDataBrowserItemID itemIDs;
   
-  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
   
-  return ((dataViewListCtrlPtr != NULL) && (dataViewListCtrlPtr->GetItemID(row,&itemID) == noErr) && dataViewListCtrlPtr->IsItemSelected(itemID));
-} /* wxDataViewCtrl::IsSelected(unsigned int row) const */
+  if (MacDataViewListCtrlPtr->GetSelectedItemIDs(itemIDs) > 0)
+    return wxDataViewItem(reinterpret_cast<void*>(itemIDs[0]));
+  else
+    return wxDataViewItem();
+} /* wxDataViewCtrl::GetSelection(void) const */
 
-void wxDataViewCtrl::SetSelection(int row)
+int wxDataViewCtrl::GetSelections(wxDataViewItemArray& sel) const
 {
-  wxArrayDataBrowserItemID selectedItemIDs;
+  size_t NoOfSelectedItems;
+
+  wxArrayDataBrowserItemID itemIDs;
   
-  size_t NoOfSelections;
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
   
-  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  NoOfSelectedItems = MacDataViewListCtrlPtr->GetSelectedItemIDs(itemIDs);
+  sel.Empty();
+  sel.SetCount(NoOfSelectedItems);
+  for (size_t i=0; i<NoOfSelectedItems; ++i)
+    sel[i] = wxDataViewItem(reinterpret_cast<void*>(itemIDs[i]));
+  return static_cast<int>(NoOfSelectedItems);
+} /* wxDataViewCtrl::GetSelections(wxDataViewItemArray&) const */
+
+void wxDataViewCtrl::HitTest(wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const
+{
+  item = wxDataViewItem();
+  columnPtr = NULL;
+} /* wxDataViewCtrl::HitTest(wxPoint const&, wxDataViewItem&, wxDataViewColumn*&) const */
 
+bool wxDataViewCtrl::IsSelected(wxDataViewItem const& item) const
+{
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  
+  return MacDataViewListCtrlPtr->IsItemSelected(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+} /* wxDataViewCtrl::IsSelected(wxDataViewItem const&) const */
 
-  wxCHECK_RET(dataViewListCtrlPtr != NULL,_("Peer pointer not initialized."));  
-  if (row == -1) // unselect all selected items
+void wxDataViewCtrl::SelectAll(void)
+{
+  DataBrowserItemID* itemIDPtr;
+
+  Handle handle(::NewHandle(0));
+  
+  size_t NoOfItems;
+  
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  
+  wxCHECK_RET(MacDataViewListCtrlPtr->GetItems(kDataBrowserNoItem,true,kDataBrowserItemAnyState,handle) == noErr,_("Could not get items."));
+  NoOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID));
+  HLock(handle);
+  itemIDPtr = (DataBrowserItemID*) (*handle);
+  MacDataViewListCtrlPtr->SetSelectedItems(NoOfItems,itemIDPtr,kDataBrowserItemsAssign);
+  HUnlock(handle);
+  DisposeHandle(handle);
+} /* wxDataViewCtrl::SelectAll(void) */
+
+void wxDataViewCtrl::Select(wxDataViewItem const& item)
+{
+  if (item.IsOk())
   {
-    NoOfSelections = dataViewListCtrlPtr->GetSelectedItemIDs(selectedItemIDs);
-    for (size_t i=0; i<NoOfSelections; ++i)
-      (void) dataViewListCtrlPtr->SetSelectedItems(1,&(selectedItemIDs[i]),kDataBrowserItemsRemove);
+   // variable definition and initialization:
+    DataBrowserItemID                              itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+    MacDataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsAdd);
   } /* if */
-  else if (row >= 0) // select specified item
+} /* wxDataViewCtrl::Select(wxDataViewItem const&) */
+
+void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel)
+{
+  size_t const NoOfSelections = sel.GetCount();
+
+  DataBrowserItemID* itemIDs;
+
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  
+  itemIDs = new DataBrowserItemID[NoOfSelections];
+  for (size_t i=0; i<NoOfSelections; ++i)
+    itemIDs[i] = reinterpret_cast<DataBrowserItemID>(sel[i].GetID());
+  MacDataViewListCtrlPtr->SetSelectedItems(NoOfSelections,itemIDs,kDataBrowserItemsAssign);
+  delete[] itemIDs;
+} /* wxDataViewCtrl::SetSelections(wxDataViewItemArray const&) */
+
+void wxDataViewCtrl::Unselect(wxDataViewItem const& item)
+{
+  if (item.IsOk())
   {
-   // variable definition:
-    DataBrowserItemID itemID;
-    
-    verify_noerr(dataViewListCtrlPtr->GetItemID(row,&itemID));
-    verify_noerr(dataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsAdd)); // should also deselect automatically all other items
+   // variable definition and initialization:
+    DataBrowserItemID                              itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+    MacDataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsRemove);
   } /* if */
-} /* wxDataViewCtrl::SetSelection(int) */
+} /* wxDataViewCtrl::Unselect(wxDataViewItem const&) */
 
-void wxDataViewCtrl::SetSelectionRange(unsigned int from, unsigned int to)
+void wxDataViewCtrl::UnselectAll(void)
 {
-  wxCHECK_RET(from <= to,_("Invalid specified range ('from' has to be smaller or equal to 'to')."));
+  DataBrowserItemID* itemIDPtr;
   
- // variable definition:
-  wxArrayInt selectedRows;
+  Handle handle(::NewHandle(0));
+  
+  size_t NoOfItems;
+  
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+  
+  wxCHECK_RET(MacDataViewListCtrlPtr->GetItems(kDataBrowserNoItem,true,kDataBrowserItemAnyState,handle) == noErr,_("Could not get items."));
+  NoOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID));
+  HLock(handle);
+  itemIDPtr = (DataBrowserItemID*) (*handle);
+  MacDataViewListCtrlPtr->SetSelectedItems(NoOfItems,itemIDPtr,kDataBrowserItemsRemove);
+  HUnlock(handle);
+  DisposeHandle(handle);
+} /* wxDataViewCtrl::UnselectAll(void) */
+
+// data handling:
+void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const& parentItem)
+{
+  int NoOfChildren;
+
+  wxDataViewItemArray items;
   
-  selectedRows.Alloc(to-from+1);
-  for (unsigned int i=from; i<=to; ++i)
-    selectedRows.Add(i);
-  this->SetSelections(selectedRows);
-} /* wxDataViewCtrl::SetSelectionRange(unsigned int, unsigned int) */
+  
+  wxCHECK_RET(this->GetModel() != NULL,_("Model pointer not initialized."));
+  NoOfChildren = this->GetModel()->GetChildren(parentItem,items);
+  for (int i=0; i<NoOfChildren; ++i)
+    (void) this->GetModel()->ItemAdded(parentItem,items[i]);
+} /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
 
-void wxDataViewCtrl::SetSelections(wxArrayInt const& selectedRows)
+wxDataViewColumn* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID propertyID) const
 {
-  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+ // variable definition:
+  ColumnPointerHashMapType::const_iterator Result(this->m_ColumnPointers.find(propertyID));
+  
+  if (Result != this->m_ColumnPointers.end())
+    return Result->second;
+  else
+    return NULL;
+} /* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID) const */
 
-  wxCHECK_RET(dataViewListCtrlPtr != NULL,_("Peer pointer not initialized."));  
- // unselect all selected items:
-  this->SetSelection(-1);
-  for (size_t i=0; i<selectedRows.GetCount(); ++i)
+// inherited methods from wxDataViewCtrlBase
+void wxDataViewCtrl::DoSetExpanderColumn(void)
+{
+  if (this->GetExpanderColumn() != NULL)
   {
-   // variable definition:
-    DataBrowserItemID itemID;
-    
-    verify_noerr(dataViewListCtrlPtr->GetItemID(selectedRows[i],&itemID));
-    verify_noerr(dataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsAssign));
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+    (void) MacDataViewListCtrlPtr->SetDisclosureColumn(this->GetExpanderColumn()->GetPropertyID());
   } /* if */
-} /* wxDataViewCtrl::SetSelections(wxArrayInt const&) */
+} /* wxDataViewCtrl::DoSetExpanderColumn(void) */
 
-void wxDataViewCtrl::Unselect(unsigned int row)
+void wxDataViewCtrl::DoSetIndent(void)
 {
-  DataBrowserItemID itemID;
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));  
 
-  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
-  wxCHECK_RET( dataViewListCtrlPtr != NULL,                                                                                                                 _("Peer pointer not initialized."));  
-  wxCHECK_RET((dataViewListCtrlPtr->GetItemID(row,&itemID) == noErr) && (dataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsRemove) == noErr),_("Unselection impossible."));
-} /* wxDataViewCtrl::Unselect(unsigned int) */
+  (void) MacDataViewListCtrlPtr->SetIndent(static_cast<float>(this->GetIndent()));
+} /* wxDataViewCtrl::DoSetIndent(void) */
 
-void wxDataViewCtrl::ReverseSorting(DataBrowserPropertyID columnID)
+// event handling:
+void wxDataViewCtrl::OnSize(wxSizeEvent& event)
 {
+  unsigned int const NoOfColumns = this->GetColumnCount();
 
-  if (columnID >= kMinPropertyID)
+
+  for (unsigned int i=0; i<NoOfColumns; ++i)
   {
    // variable definition and initialization:
-    DataBrowserPropertyID                          sortPropertyID;
-    wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
-
-    wxCHECK_RET(dataViewListCtrlPtr != NULL,_("Peer pointer not initialized."));
-    wxCHECK_RET(dataViewListCtrlPtr->GetSortProperty(&sortPropertyID) == noErr,_("Determination of sort property impossible."));
-    if (sortPropertyID == columnID)
+    wxDataViewColumn* dataViewColumnPtr(this->GetColumn(i));
+    
+    if (dataViewColumnPtr != NULL)
     {
-     // variable defintion:
-      DataBrowserSortOrder         sortOrderCtrl;
-      DataBrowserTableViewColumnID columnIndex;
-      wxDataViewColumn*            dataViewColumnPtr;
-
-      wxCHECK_RET(dataViewListCtrlPtr->GetPropertyColumn(columnID,&columnIndex) == noErr,_("Determination of column index impossible"));
-      wxCHECK_RET(dataViewListCtrlPtr->GetSortOrder(&sortOrderCtrl)             == noErr,_("Determination of sort order impossible"));
-      dataViewColumnPtr = this->GetColumn(columnIndex);
-      wxCHECK_RET(dataViewColumnPtr != NULL,_("Column could not be obtained."));
-      if ((sortOrderCtrl == kDataBrowserOrderIncreasing) && !(dataViewColumnPtr->IsSortOrderAscending()) ||
-          (sortOrderCtrl == kDataBrowserOrderDecreasing) &&   dataViewColumnPtr->IsSortOrderAscending())
-        dataViewListCtrlPtr->ReverseRowIndexNumbering();
+     // variable definition and initialization:
+      wxDataViewCustomRenderer* dataViewCustomRendererPtr(dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer()));
+    
+      if (dataViewCustomRendererPtr != NULL)
+        dataViewCustomRendererPtr->SetDC(NULL); // reset DC because DC has changed
     } /* if */
-  } /* if */
-} /* wxDataViewCtrl::ReverseSorting(DataBrowserPropertyID columnID) */
+  } /* for */
+  event.Skip();
+} /* wxDataViewCtrl::OnSize(wxSizeEvent&) */
 
 IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase)