]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dataview.cpp
ignore WinCE projects and build directories
[wxWidgets.git] / src / mac / carbon / dataview.cpp
index 2d4085c91df7931ba5627db433ed88d96d7c1153..c3ee3ab5c7893a9132a9a93dcf6c2f1fcfa8a459 100644 (file)
 #include "wx/mac/carbon/databrow.h"
 
 #ifndef WX_PRECOMP
 #include "wx/mac/carbon/databrow.h"
 
 #ifndef WX_PRECOMP
-  #include "wx/timer.h"
+    #include "wx/timer.h"
+    #include "wx/settings.h"
+    #include "wx/dcclient.h"
+    #include "wx/icon.h"
 #endif
 
 #endif
 
-#include "wx/icon.h"
 #include "wx/renderer.h"
 
 //-----------------------------------------------------------------------------
 #include "wx/renderer.h"
 
 //-----------------------------------------------------------------------------
@@ -82,7 +84,11 @@ static pascal OSStatus wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
         DataViewEvent.SetColumn(columnIndex);
         DataViewEvent.SetDataViewColumn(DataViewCtrlPtr->GetColumn(columnIndex));
        // finally sent the equivalent wxWidget event:
         DataViewEvent.SetColumn(columnIndex);
         DataViewEvent.SetDataViewColumn(DataViewCtrlPtr->GetColumn(columnIndex));
        // finally sent the equivalent wxWidget event:
+#if wxCHECK_VERSION(2,9,0)
+        DataViewCtrlPtr->HandleWindowEvent(DataViewEvent);
+#else
         DataViewCtrlPtr->GetEventHandler()->ProcessEvent(DataViewEvent);
         DataViewCtrlPtr->GetEventHandler()->ProcessEvent(DataViewEvent);
+#endif
         return ::CallNextEventHandler(handler,EventReference);
       } /* if */
       else
         return ::CallNextEventHandler(handler,EventReference);
       } /* if */
       else
@@ -92,6 +98,93 @@ static pascal OSStatus wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
   return eventNotHandledErr;
 } /* wxMacDataViewCtrlEventHandler(EventHandlerCallRef, EventRef, void*) */
 
   return eventNotHandledErr;
 } /* wxMacDataViewCtrlEventHandler(EventHandlerCallRef, EventRef, void*) */
 
+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&) */
+
 //-----------------------------------------------------------------------------
 // local function pointers
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // local function pointers
 //-----------------------------------------------------------------------------
@@ -115,42 +208,52 @@ public:
 
 
     wxCHECK_MSG(item.IsOk(),false,_("Added item is invalid."));
 
 
     wxCHECK_MSG(item.IsOk(),false,_("Added item is invalid."));
-    if (!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,                                 &itemID) == noErr) ||
-          parent.IsOk()  && (this->m_dataViewControlPtr->AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr))
-    {
-     // variable definitions and initializations:
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-      wxDataViewEvent dataViewEvent  (wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED,dataViewCtrlPtr->GetId());
-      
-      dataViewEvent.SetEventObject(dataViewCtrlPtr);
-      dataViewEvent.SetItem(item);
-     // sent the equivalent wxWidget event:
-      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-     // done:
-      return true;
-    } /* if */
-    else
-      return false;
+    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&) */
 
   } /* ItemAdded(wxDataViewItem const&, wxDataViewItem const&) */
 
+  virtual bool ItemsAdded(wxDataViewItem const& parent, wxDataViewItemArray const& items)
+  {
+    bool noFailureFlag;
+
+    DataBrowserItemID* itemIDs;
+    
+    size_t noOfEntries;
+    
+
+   // convert all valid data view items to data browser items:
+    itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items);
+   // insert all valid items into control:
+    noFailureFlag = ((noOfEntries == 0) ||
+                     !(parent.IsOk()) && (this->m_dataViewControlPtr->AddItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) ||
+                     parent.IsOk() && (this->m_dataViewControlPtr->AddItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr));
+   // give allocated array space free again:
+    delete[] itemIDs;
+   // done:
+    return noFailureFlag;
+  } /* ItemsAdded(wxDataViewItem const&, wxDataViewItemArray const&) */
+
   virtual bool ItemChanged(wxDataViewItem const& item)
   {
     DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
     
     
   virtual bool ItemChanged(wxDataViewItem const& item)
   {
     DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
     
     
-    wxCHECK_MSG(item.IsOk(),             false,_("Changed item is invalid."));
-    wxCHECK_MSG(this->GetOwner() != NULL,false,_("Owner not initialized."));
+    wxCHECK_MSG(item.IsOk(),false,_("Changed item is invalid."));
     if (this->m_dataViewControlPtr->UpdateItems(&itemID) == noErr)
     {
       wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
       
      // sent the equivalent wxWidget event:
     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_ITEM_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
       dataViewEvent.SetItem(item);
      // sent the equivalent wxWidget event:
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
       dataViewEvent.SetItem(item);
      // sent the equivalent wxWidget event:
+#if wxCHECK_VERSION(2,9,0)
+      dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+#else
       dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
       dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+#endif
      // done
       return true;
     } /* if */
      // done
       return true;
     } /* if */
@@ -158,28 +261,96 @@ public:
       return false;
   } /* ItemChanged(wxDataViewItem const&) */
 
       return false;
   } /* ItemChanged(wxDataViewItem const&) */
 
-  virtual bool ItemDeleted(wxDataViewItem const& parent, wxDataViewItem const& item)
+  virtual bool ItemsChanged(wxDataViewItemArray const& items)
   {
   {
-    DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+    bool noFailureFlag;
 
 
+    DataBrowserItemID* itemIDs;
+    
+    size_t noOfEntries;
+    
 
 
-    wxCHECK_MSG(item.IsOk(),false,_("Deleted item is invalid."));
-    if (this->m_dataViewControlPtr->RemoveItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr)
+   // convert all valid data view items to data browser items:
+    itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items);
+   // change items (ATTENTION: ONLY ITEMS OF THE ROOT ARE CHANGED BECAUSE THE PARENT PARAMETER IS MISSING):
+    noFailureFlag = (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr);
+    if (noFailureFlag)
     {
     {
-     // variable definitions and initializations:
       wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
       wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-      wxDataViewEvent dataViewEvent  (wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED,dataViewCtrlPtr->GetId());
+      
+     // send for all changed items a wxWidget event:
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
-      dataViewEvent.SetItem(item);
-     // sent the equivalent wxWidget event:
-      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-     // done
-      return true;
+      for (size_t i=0; i<noOfEntries; ++i)
+      {
+        dataViewEvent.SetItem(reinterpret_cast<void*>(itemIDs[i]));
+#if wxCHECK_VERSION(2,9,0)
+        dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+#else
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+#endif
+      } /* for */
+    } /* if */
+   // release allocated array space:
+    delete[] itemIDs;
+   // done:
+    return noFailureFlag;
+  } /* ItemsChanged(wxDataViewItem const&) */
+
+  virtual bool ItemDeleted(wxDataViewItem const& parent, wxDataViewItem const& item)
+  {
+    if (item.IsOk())
+    {
+     // 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);
+     // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
+     // has been 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);
+     // enable automatic updating again:
+      dataViewCtrlPtr->SetDeleting(false);
+      return (errorStatus == noErr);
     } /* if */
     else
       return false;
     } /* if */
     else
       return false;
-  } /* ItemDeleted(wxDataViewItem const&) */
+  } /* ItemDeleted(wxDataViewItem const&, wxDataViewItem const&) */
+
+  virtual bool ItemsDeleted(wxDataViewItem const& parent, wxDataViewItemArray const& items)
+  {
+    bool noFailureFlag;
+
+    DataBrowserItemID* itemIDs;
+    
+    wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+
+    size_t noOfEntries;
+    
+
+    wxCHECK_MSG(dataViewCtrlPtr != NULL,false,_("Data view control is not correctly initialized"));
+   // convert all valid data view items to data browser items:
+    itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items);
+   // 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);
+   // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
+   // has been started and that variables can currently not be updated even when requested by the system:
+    dataViewCtrlPtr->SetDeleting(true);
+   // insert all valid items into control:
+    noFailureFlag = ((noOfEntries == 0) ||
+                     !(parent.IsOk()) && (this->m_dataViewControlPtr->RemoveItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) ||
+                     parent.IsOk() && (this->m_dataViewControlPtr->RemoveItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr));
+   // enable automatic updating again:
+    dataViewCtrlPtr->SetDeleting(false);
+   // give allocated array space free again:
+    delete[] itemIDs;
+   // done:
+    return noFailureFlag;
+  } /* ItemsDeleted(wxDataViewItem const&, wxDataViewItemArray const&) */
 
   virtual bool ValueChanged(wxDataViewItem const& item, unsigned int col)
   {
 
   virtual bool ValueChanged(wxDataViewItem const& item, unsigned int col)
   {
@@ -199,13 +370,17 @@ public:
         (this->m_dataViewControlPtr->UpdateItems(parentID,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
     {
      // variable definition and initialization:
         (this->m_dataViewControlPtr->UpdateItems(parentID,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
     {
      // variable definition and initialization:
-      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED,dataViewCtrlPtr->GetId());
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId());
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
       dataViewEvent.SetColumn(col);
       dataViewEvent.SetItem(item);
      // send the equivalent wxWidget event:
 
       dataViewEvent.SetEventObject(dataViewCtrlPtr);
       dataViewEvent.SetColumn(col);
       dataViewEvent.SetItem(item);
      // send the equivalent wxWidget event:
+#if wxCHECK_VERSION(2,9,0)
+      dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+#else
       dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
       dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+#endif
      // done
       return true;
     } /* if */
      // done
       return true;
     } /* if */
@@ -215,22 +390,19 @@ public:
 
   virtual bool Cleared(void)
   {
 
   virtual bool Cleared(void)
   {
-    if (this->m_dataViewControlPtr->RemoveItems() == noErr)
-    {
-     // variable definitions and initializations:
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
-      wxDataViewEvent dataViewEvent  (wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED,dataViewCtrlPtr->GetId());
-
-      dataViewEvent.SetEventObject(dataViewCtrlPtr);
-     // send the equivalent wxWidget event:
-      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
-     // done
-      return true;
-    } /* if */
-    else
-      return false;
+    bool noFailureFlag = (this->m_dataViewControlPtr->RemoveItems() == noErr);
+    wxDataViewItem item;
+    wxDataViewItemArray array;
+    GetOwner()->GetChildren( item, array );
+    ItemsAdded( item, array );
+    return noFailureFlag;
   } /* Cleared(void) */
 
   } /* Cleared(void) */
 
+  virtual void Resort(void)
+  {
+    this->m_dataViewControlPtr->Resort();
+  }
+
 protected:
 private:
 //
 protected:
 private:
 //
@@ -288,7 +460,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase)
 // ---------------------------------------------------------
 #pragma mark -
 wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
 // ---------------------------------------------------------
 #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) */
 
 {
 } /* wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const&, wxDataViewCellMode) */
 
@@ -298,20 +470,28 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void)
     delete this->m_DCPtr;
 } /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) */
 
     delete this->m_DCPtr;
 } /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) */
 
+void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state )
+{
+    wxDataViewCtrl *view = GetOwner()->GetOwner();
+    wxColour col = (state & wxDATAVIEW_CELL_SELECTED) ? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) : view->GetForegroundColour();
+    dc->SetTextForeground(col);
+    dc->DrawText( text, cell.x + xoffset, cell.y + ((cell.height - dc->GetCharHeight()) / 2));
+}
+
 wxDC* wxDataViewCustomRenderer::GetDC(void)
 {
   if (this->m_DCPtr == NULL)
   {
     if ((GetOwner() == NULL) || (GetOwner()->GetOwner() == NULL))
       return NULL;
 wxDC* wxDataViewCustomRenderer::GetDC(void)
 {
   if (this->m_DCPtr == NULL)
   {
     if ((GetOwner() == NULL) || (GetOwner()->GetOwner() == NULL))
       return NULL;
-    this->m_DCPtr = new wxClientDC(this->GetOwner()->GetOwner());
+    this->m_DCPtr = new wxWindowDC(this->GetOwner()->GetOwner());
   } /* if */
   return this->m_DCPtr;
 } /* wxDataViewCustomRenderer::GetDC(void) */
 
 bool wxDataViewCustomRenderer::Render(void)
 {
   } /* if */
   return this->m_DCPtr;
 } /* wxDataViewCustomRenderer::GetDC(void) */
 
 bool wxDataViewCustomRenderer::Render(void)
 {
-  return false;
+  return true;
 } /* wxDataViewCustomRenderer::Render(void) */
 
 void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr)
 } /* wxDataViewCustomRenderer::Render(void) */
 
 void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr)
@@ -320,6 +500,10 @@ void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr)
   this->m_DCPtr = newDCPtr;
 } /* wxDataViewCustomRenderer::SetDC(wxDC*) */
 
   this->m_DCPtr = newDCPtr;
 } /* wxDataViewCustomRenderer::SetDC(wxDC*) */
 
+WXDataBrowserPropertyType wxDataViewCustomRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserCustomType;
+} /* wxDataViewCustomRenderer::GetPropertyType(void) const */
 
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer)
 
 
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer)
 
@@ -334,19 +518,35 @@ wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const& varianttype, wxDa
 
 bool wxDataViewTextRenderer::Render(void)
 {
 
 bool wxDataViewTextRenderer::Render(void)
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-  {
-   // variable definition:
-    wxMacCFStringHolder cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << this->GetValue().GetType());
 
 
-    return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr);
-  } /* if */
-  else
-    return false;
+ // variable definition:
+#if wxCHECK_VERSION(2,9,0)
+  wxCFStringRef cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+#else
+  wxMacCFStringHolder cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+#endif
+  return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr);
 } /* wxDataViewTextRenderer::Render(void) */
 
 } /* wxDataViewTextRenderer::Render(void) */
 
+WXDataBrowserPropertyType wxDataViewTextRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserTextType;
+} /* wxDataViewTextRenderer::GetPropertyType(void) const */
+
 IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer)
 
 IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer)
 
+// --------------------------------------------------------- 
+// wxDataViewTextRendererAttr
+// --------------------------------------------------------- 
+#pragma mark -
+wxDataViewTextRendererAttr::wxDataViewTextRendererAttr(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                           :wxDataViewTextRenderer(varianttype,mode,align)
+{
+} /* wxDataViewTextRendererAttr::wxDataViewTextRendererAttr(wxString const&, wxDataViewCellMode, int) */
+    
+IMPLEMENT_CLASS(wxDataViewTextRendererAttr,wxDataViewTextRenderer)
+
 // ---------------------------------------------------------
 // wxDataViewBitmapRenderer
 // ---------------------------------------------------------
 // ---------------------------------------------------------
 // wxDataViewBitmapRenderer
 // ---------------------------------------------------------
@@ -357,23 +557,73 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString const& varianttype,
 }
 
 bool wxDataViewBitmapRenderer::Render(void)
 }
 
 bool wxDataViewBitmapRenderer::Render(void)
+ // This method returns 'true' if
+ //  - the passed bitmap is valid and it could be assigned to the native data browser;
+ //  - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap.
+ // In all other cases the method returns 'false'.
 {
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-  {
-    wxBitmap bitmap;
-    
-    bitmap << this->GetValue();
-    if (bitmap.Ok())
-      return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetBitmapData()->GetIconRef()) == noErr);
-    else
-      return false;
-  } /* if */
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Bitmap renderer cannot render value; value type: ")) << this->GetValue().GetType());
+
+ // variable definition:
+  wxBitmap bitmap;
+  
+  bitmap << this->GetValue();
+  if (bitmap.Ok())
+#if wxCHECK_VERSION(2,9,0)
+    return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetIconRef()) == noErr);
+#else
+    return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetBitmapData()->GetIconRef()) == noErr);
+#endif
   else
   else
-    return false;
+    return true;
 } /* wxDataViewBitmapRenderer::Render(void) */
 
 } /* wxDataViewBitmapRenderer::Render(void) */
 
+WXDataBrowserPropertyType wxDataViewBitmapRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserIconType;
+} /* wxDataViewBitmapRenderer::GetPropertyType(void) const */
+
 IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer)
 
 IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer)
 
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                           :wxDataViewRenderer(varianttype,mode)
+{
+}
+
+bool wxDataViewIconTextRenderer::Render(void)
+{
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << this->GetValue().GetType());
+
+ // variable definition:
+  wxDataViewIconText iconText;
+  
+  iconText << this->GetValue();
+
+ // variable definition:
+#if wxCHECK_VERSION(2,9,0)
+  wxCFStringRef cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+#else
+  wxMacCFStringHolder cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+#endif
+
+  if (iconText.GetIcon().IsOk())
+    if (::SetDataBrowserItemDataIcon(this->GetDataReference(),MAC_WXHICON(iconText.GetIcon().GetHICON())) != noErr)
+      return false;
+  return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr);
+} /* wxDataViewIconTextRenderer::Render(void) */
+
+WXDataBrowserPropertyType wxDataViewIconTextRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserIconAndTextType;
+} /* wxDataViewIconTextRenderer::GetPropertyType(void) const */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer)
+
+
 // ---------------------------------------------------------
 // wxDataViewToggleRenderer
 // ---------------------------------------------------------
 // ---------------------------------------------------------
 // wxDataViewToggleRenderer
 // ---------------------------------------------------------
@@ -385,12 +635,15 @@ wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString const& varianttype,
 
 bool wxDataViewToggleRenderer::Render(void)
 {
 
 bool wxDataViewToggleRenderer::Render(void)
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-    return (::SetDataBrowserItemDataButtonValue(this->GetDataReference(),this->GetValue().GetBool()) == noErr);
-  else
-    return false;
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Toggle renderer cannot render value; value type: ")) << this->GetValue().GetType());
+  return (::SetDataBrowserItemDataButtonValue(this->GetDataReference(),this->GetValue().GetBool()) == noErr);
 } /* wxDataViewToggleRenderer::Render(void) */
 
 } /* wxDataViewToggleRenderer::Render(void) */
 
+WXDataBrowserPropertyType wxDataViewToggleRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserCheckboxType;
+} /* wxDataViewToggleRenderer::GetPropertyType(void) const */
+
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer)
 
 // ---------------------------------------------------------
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer)
 
 // ---------------------------------------------------------
@@ -404,14 +657,17 @@ wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString const& label, wx
 
 bool wxDataViewProgressRenderer::Render(void)
 {
 
 bool wxDataViewProgressRenderer::Render(void)
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-    return ((::SetDataBrowserItemDataMinimum(this->GetDataReference(),  0)                        == noErr) &&
-            (::SetDataBrowserItemDataMaximum(this->GetDataReference(),100)                        == noErr) &&
-            (::SetDataBrowserItemDataValue  (this->GetDataReference(),this->GetValue().GetLong()) == noErr));
-  else
-    return false;
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Progress renderer cannot render value type; value type: ")) << this->GetValue().GetType());
+  return ((::SetDataBrowserItemDataMinimum(this->GetDataReference(),  0)                        == noErr) &&
+          (::SetDataBrowserItemDataMaximum(this->GetDataReference(),100)                        == noErr) &&
+          (::SetDataBrowserItemDataValue  (this->GetDataReference(),this->GetValue().GetLong()) == noErr));
 } /* wxDataViewProgressRenderer::Render(void) */
 
 } /* wxDataViewProgressRenderer::Render(void) */
 
+WXDataBrowserPropertyType wxDataViewProgressRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserProgressBarType;
+} /* wxDataViewProgressRenderer::GetPropertyType(void) const */
+
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer)
 
 // ---------------------------------------------------------
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer)
 
 // ---------------------------------------------------------
@@ -425,12 +681,15 @@ wxDataViewDateRenderer::wxDataViewDateRenderer(wxString const& varianttype, wxDa
 
 bool wxDataViewDateRenderer::Render(void)
 {
 
 bool wxDataViewDateRenderer::Render(void)
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-    return (::SetDataBrowserItemDataDateTime(this->GetDataReference(),this->GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan,1904)).GetSeconds().GetLo()) == noErr);
-  else
-    return false;
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Date renderer cannot render value; value type: ")) << this->GetValue().GetType());
+  return (::SetDataBrowserItemDataDateTime(this->GetDataReference(),this->GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan,1904)).GetSeconds().GetLo()) == noErr);
 } /* wxDataViewDateRenderer::Render(void) */
 
 } /* wxDataViewDateRenderer::Render(void) */
 
+WXDataBrowserPropertyType wxDataViewDateRenderer::GetPropertyType(void) const
+{
+  return kDataBrowserDateTimeType;
+} /* wxDataViewDateRenderer::GetPropertyType(void) const */
+
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer)
 
 // ---------------------------------------------------------
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer)
 
 // ---------------------------------------------------------
@@ -438,15 +697,15 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer)
 // ---------------------------------------------------------
 #pragma mark -
 wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer *cell, unsigned int model_column, int width, wxAlignment align, int flags)
 // ---------------------------------------------------------
 #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_ascending(true),
-                  m_flags(flags & ~(wxDATAVIEW_COL_HIDDEN | wxDATAVIEW_COL_RESIZABLE)), m_maxWidth(std::numeric_limits<int>::max()), m_minWidth(0), m_width(width),
+                 :wxDataViewColumnBase(title,cell,model_column,width,align,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)
                   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_flags(flags & (wxDATAVIEW_COL_HIDDEN | wxDATAVIEW_COL_RESIZABLE)), m_maxWidth(std::numeric_limits<int>::max()), m_minWidth(0), m_width(width),
+                 :wxDataViewColumnBase(bitmap,cell,model_column,width,align,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) */
                   m_alignment(align)
 {
 } /* wxDataViewColumn::wxDataViewColumn(wxBitmap const&, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
@@ -506,7 +765,11 @@ void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap)
 
       wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
       if (this->GetBitmap().Ok())
 
       wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
       if (this->GetBitmap().Ok())
+#if wxCHECK_VERSION(2,9,0)
+        headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetIconRef();
+#else
         headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetBitmapData()->GetIconRef();
         headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetBitmapData()->GetIconRef();
+#endif
       else
         headerDescription.btnContentInfo.u.iconRef = NULL;
       wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon."));
       else
         headerDescription.btnContentInfo.u.iconRef = NULL;
       wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon."));
@@ -516,9 +779,10 @@ void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap)
 
 void wxDataViewColumn::SetFlags(int flags)
 {
 
 void wxDataViewColumn::SetFlags(int flags)
 {
-  this->SetHidden    ((flags & wxDATAVIEW_COL_HIDDEN)    != 0);
-  this->SetResizeable((flags & wxDATAVIEW_COL_RESIZABLE) != 0);
-  this->SetSortable  ((flags & wxDATAVIEW_COL_SORTABLE)  != 0);
+  this->SetHidden     ((flags & wxDATAVIEW_COL_HIDDEN)      != 0);
+  this->SetReorderable((flags & wxDATAVIEW_COL_REORDERABLE) != 0);
+  this->SetResizeable ((flags & wxDATAVIEW_COL_RESIZABLE)   != 0);
+  this->SetSortable   ((flags & wxDATAVIEW_COL_SORTABLE)    != 0);
 } /* wxDataViewColumn::SetFlags(int) */
 
 void wxDataViewColumn::SetMaxWidth(int maxWidth)
 } /* wxDataViewColumn::SetFlags(int) */
 
 void wxDataViewColumn::SetMaxWidth(int maxWidth)
@@ -567,38 +831,59 @@ void wxDataViewColumn::SetMinWidth(int minWidth)
   } /* if */
 } /* wxDataViewColumn::SetMaxWidth(int) */
 
   } /* if */
 } /* wxDataViewColumn::SetMaxWidth(int) */
 
+void wxDataViewColumn::SetReorderable(bool reorderable)
+{
+ // first set the internal flag of the column:
+  if (reorderable)
+    this->m_flags |= wxDATAVIEW_COL_REORDERABLE;
+  else
+    this->m_flags &= ~wxDATAVIEW_COL_REORDERABLE;
+ // if the column is associated with a control change also immediately the flags of the control:
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner()); // variable definition and initialization
+
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    DataBrowserPropertyFlags                       flags;
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    wxCHECK_RET(macDataViewListCtrlPtr != NULL,                                                 _("Valid pointer to native data view control does not exist"));
+    wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(this->GetPropertyID(),&flags) == noErr,_("Could not get property flags."));
+    if (reorderable)
+      flags |= kDataBrowserListViewMovableColumn;
+    else
+      flags &= ~kDataBrowserListViewMovableColumn;
+    wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(this->GetPropertyID(),flags) == noErr,_("Could not set property flags."));
+  } /* if */
+} /* wxDataViewColumn::SetReorderable(bool) */
+
 void wxDataViewColumn::SetResizeable(bool WXUNUSED(resizeable))
 {
 } /* wxDataViewColumn::SetResizeable(bool) */
 
 void wxDataViewColumn::SetSortable(bool sortable)
 {
 void wxDataViewColumn::SetResizeable(bool WXUNUSED(resizeable))
 {
 } /* wxDataViewColumn::SetResizeable(bool) */
 
 void wxDataViewColumn::SetSortable(bool sortable)
 {
- // variable definition and initialization:
-  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
-  
+ // first set the internal flag of the column:
+  if (sortable)
+    this->m_flags |= wxDATAVIEW_COL_SORTABLE;
+  else
+    this->m_flags &= ~wxDATAVIEW_COL_SORTABLE;
+ // if the column is associated with a control change also immediately the flags of the control:
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner()); // variable definition and initialization
+
   if (dataViewCtrlPtr != NULL)
   {
    // variable definition and initialization:
   if (dataViewCtrlPtr != NULL)
   {
    // variable definition and initialization:
+    DataBrowserPropertyFlags                       flags;
     wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
     
     wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
     
-    if (macDataViewListCtrlPtr != NULL)
-    {
-     // variable definition and initialization:
-      DataBrowserPropertyFlags flags;
-      
-      wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(this->GetPropertyID(),&flags) == noErr,_("Could not get property flags."));
-      if (sortable)
-      {
-        this->m_flags |= wxDATAVIEW_COL_SORTABLE;
-        flags         |= kDataBrowserListViewSortableColumn;
-      } /* if */
-      else
-      {
-        this->m_flags &= ~wxDATAVIEW_COL_SORTABLE;
-        flags         &= ~kDataBrowserPropertyIsEditable;
-      } /* if */
-      wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(this->GetPropertyID(),flags) == noErr,_("Could not set property flags."));
-    } /* if */
+    wxCHECK_RET(macDataViewListCtrlPtr != NULL,                                                 _("Valid pointer to native data view control does not exist"));
+    wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(this->GetPropertyID(),&flags) == noErr,_("Could not get property flags."));
+    if (sortable)
+      flags |= kDataBrowserListViewSortableColumn;
+    else
+      flags &= ~kDataBrowserListViewSortableColumn;
+    wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(this->GetPropertyID(),flags) == noErr,_("Could not set property flags."));
   } /* if */
 } /* wxDataViewColumn::SetSortable(bool) */
 
   } /* if */
 } /* wxDataViewColumn::SetSortable(bool) */
 
@@ -624,6 +909,7 @@ void wxDataViewColumn::SetSortOrder(bool ascending)
       else
         headerDescription.initialOrder = kDataBrowserOrderDecreasing;
       verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription));
       else
         headerDescription.initialOrder = kDataBrowserOrderDecreasing;
       verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription));
+      macDataViewListCtrlPtr->SetSortProperty(this->GetPropertyID());
     } /* if */
   } /* if */
 } /* wxDataViewColumn::SetSortOrder(bool) */
     } /* if */
   } /* if */
 } /* wxDataViewColumn::SetSortOrder(bool) */
@@ -643,7 +929,11 @@ void wxDataViewColumn::SetTitle(wxString const& title)
     {
      // variable definition and initialization:
       DataBrowserListViewHeaderDesc headerDescription;
     {
      // variable definition and initialization:
       DataBrowserListViewHeaderDesc headerDescription;
+#if wxCHECK_VERSION(2,9,0)
+      wxCFStringRef           cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+#else
       wxMacCFStringHolder           cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
       wxMacCFStringHolder           cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+#endif
       
       wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
       headerDescription.titleString = cfTitle;
       
       wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
       headerDescription.titleString = cfTitle;
@@ -679,9 +969,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn,wxDataViewColumnBase)
 #pragma mark -
 void wxDataViewCtrl::Init(void)
 {
 #pragma mark -
 void wxDataViewCtrl::Init(void)
 {
-  this->m_macIsUserPane = false;
-  this->m_NotifierPtr   = NULL;
-  this->m_cgContext     = NULL;
+  this->m_CustomRendererPtr = NULL;
+  this->m_Deleting          = false;
+  this->m_macIsUserPane     = false;
+  this->m_cgContext         = NULL;
 } /* wxDataViewCtrl::Init(void) */
 
 bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator )
 } /* wxDataViewCtrl::Init(void) */
 
 bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator )
@@ -695,104 +986,288 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
 
   this->m_peer = new wxMacDataViewDataBrowserListViewControl(this,pos,size,style);
   this->MacPostControlCreate(pos,size);
 
   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);
 
 
   InstallControlEventHandler(this->m_peer->GetControlRef(),GetwxMacDataViewCtrlEventHandlerUPP(),GetEventTypeCount(eventList),eventList,this,NULL);
 
+  ::SetDataBrowserTableViewHiliteStyle( this->m_peer->GetControlRef(), kDataBrowserTableViewFillHilite );
+
+  ::SetDataBrowserTableViewGeometry( this->m_peer->GetControlRef(), true, false );
+  
   return true;
 } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
 
   return true;
 } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
 
-bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
+/*static*/
+wxVisualAttributes wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
 {
 {
+    wxVisualAttributes attr;
+
+    attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
+    attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX );
+    attr.font.MacCreateFromThemeFont(kThemeViewsFont);
+
+    return attr;
+}
+
+bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model)
+{
+  if (!wxDataViewCtrlBase::AssociateModel(model))
+    return false;
+  
+  model->AddNotifier(new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer)));
+
+  return true;
+} /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
+
+bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr)
+{
+  DataBrowserListViewColumnDesc columnDescription;
+
+  DataBrowserPropertyID NewPropertyID;
+
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+#if wxCHECK_VERSION(2,9,0)
+  wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
+#else
+  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
+#endif
+
+
  // first, some error checking:
  // first, some error checking:
-  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 (this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr))
+  wxCHECK_MSG(MacDataViewListCtrlPtr != NULL,                                    false,_("m_peer is not or incorrectly initialized"));
+  wxCHECK_MSG(columnPtr != NULL,                                                 false,_("Column pointer must not be NULL."));
+  wxCHECK_MSG(columnPtr->GetRenderer() != NULL,                                  false,_("Column does not have a renderer."));
+  wxCHECK_MSG(this->GetModel() != NULL,                                          false,_("No model associated with control."));
+  wxCHECK_MSG((columnPtr->GetModelColumn() >= 0) &&
+              (columnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
+
+ // try to get new ID for the column:
+  wxCHECK_MSG(MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr,false,_("Cannot create new column's ID. Probably max. number of columns reached."));
+ // full column variable initialization:
+  columnPtr->SetPropertyID(NewPropertyID);
+ // add column to wxWidget's internal structure:
+  wxCHECK_MSG(this->wxDataViewCtrlBase::AppendColumn(columnPtr) &&
+              this->m_ColumnPointers.insert(ColumnPointerHashMapType::value_type(NewPropertyID,columnPtr)).second,false,_("Could not add column to internal structures."));
+ // create a column description and add column to the native control:
+  wxCHECK_MSG(::InitializeColumnDescription(columnDescription,columnPtr,NewPropertyID,title),                 false,_("Column description could not be initialized."));
+  wxCHECK_MSG(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn) == noErr,false,_("Column could not be added."));
+
+ // final adjustments for the layout:
+  wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,columnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
+
+ // 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(columnPtr);
+    this->AddChildrenLevel(wxDataViewItem());
+  } /* if */
+  else
+    MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);
+ // done:
+  return true;
+} /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
+
+bool wxDataViewCtrl::ClearColumns(void)
+{
+  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:
   {
    // variable definition:
-    DataBrowserPropertyID                          NewPropertyID;
-    DataBrowserListViewColumnDesc                  columnDescription;
-    wxMacCFStringHolder                            cfTitle(dataViewColumnPtr->GetTitle(),(this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()));
+    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 */
+
+int wxDataViewCtrl::GetColumnPosition(wxDataViewColumn const* columnPtr) const
+{
+  if (columnPtr != NULL)
+  {
+   // variable definition and initialization:
+    DataBrowserTableViewColumnIndex                Position;
     wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
     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::GetColumnPosition(wxDataViewColumn const*) const */
 
 
-   // initialize column description:
-    wxCHECK_MSG(MacDataViewListCtrlPtr != NULL,                                    false,_("m_peer is not or incorrectly initialized"));
-    wxCHECK_MSG(MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr,false,_("Maximum number of columns reached."));
-    dataViewColumnPtr->SetPropertyID(NewPropertyID);
-    columnDescription.propertyDesc.propertyID = NewPropertyID;
-    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;
+bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
+{
+  DataBrowserListViewColumnDesc columnDescription;
+
+  DataBrowserPropertyID NewPropertyID;
+
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+#if wxCHECK_VERSION(2,9,0)
+  wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
+#else
+  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding());
 #endif
 #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())
+
+
+ // first, some error checking:
+  wxCHECK_MSG(MacDataViewListCtrlPtr != NULL,                                    false,_("m_peer is not or incorrectly initialized"));
+  wxCHECK_MSG(columnPtr != NULL,                                                 false,_("Column pointer must not be NULL."));
+  wxCHECK_MSG(columnPtr->GetRenderer() != NULL,                                  false,_("Column does not have a renderer."));
+  wxCHECK_MSG(this->GetModel() != NULL,                                          false,_("No model associated with control."));
+  wxCHECK_MSG((columnPtr->GetModelColumn() >= 0) &&
+              (columnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()),false,_("Column's model column has no equivalent in the associated model."));
+
+ // try to get new ID for the column:
+  wxCHECK_MSG(MacDataViewListCtrlPtr->GetFreePropertyID(&NewPropertyID) == noErr,false,_("Cannot create new column's ID. Probably max. number of columns reached."));
+ // full column variable initialization:
+  columnPtr->SetPropertyID(NewPropertyID);
+ // add column to wxWidget's internal structure:
+  wxCHECK_MSG(this->wxDataViewCtrlBase::AppendColumn(columnPtr) &&
+              this->m_ColumnPointers.insert(ColumnPointerHashMapType::value_type(NewPropertyID,columnPtr)).second,false,_("Could not add column to internal structures."));
+ // create a column description and add column to the native control:
+  wxCHECK_MSG(::InitializeColumnDescription(columnDescription,columnPtr,NewPropertyID,title),false,_("Column description could not be initialized."));
+  wxCHECK_MSG(MacDataViewListCtrlPtr->AddColumn(&columnDescription,0) == noErr,              false,_("Column could not be added."));
+
+ // final adjustments for the layout:
+  wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,columnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
+
+ // 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(columnPtr);
+    this->AddChildrenLevel(wxDataViewItem());
+  } /* if */
+  else
+    MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);
+ // done:
+  return true;
+} /* wxDataViewCtrl::PrependColumn(wxDataViewColumn*) */
+
+void wxDataViewCtrl::Collapse(wxDataViewItem const& item)
+{
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+  MacDataViewListCtrlPtr->CloseContainer(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+} /* wxDataViewCtrl::Collapse(wxDataViewItem const&) */
+
+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
+    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:
+    Rect                                           MacRectangle;
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+    
+    if (MacDataViewListCtrlPtr->GetPartBounds(reinterpret_cast<DataBrowserItemID>(item.GetID()),columnPtr->GetPropertyID(),kDataBrowserPropertyContentPart,&MacRectangle) == noErr)
     {
     {
-      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:
-    wxCHECK_MSG(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn) == noErr,false,_("Column could not be added."));
-
-   // final adjustments for the layout:
-    if (dataViewColumnPtr->GetWidth() <= 0)
-      dataViewColumnPtr->SetWidth(wxDVC_DEFAULT_WIDTH);
-    wxCHECK_MSG(MacDataViewListCtrlPtr->SetColumnWidth(NewPropertyID,dataViewColumnPtr->GetWidth()) == noErr,false,_("Column width could not be set."));
-    if (dataViewColumnPtr->IsSortable()) // if the current column is marked sortable this column will become the active sortable column, otherwise don't do anything
-      MacDataViewListCtrlPtr->SetSortProperty(NewPropertyID);
-    if (this->GetColumnCount()-1 == this->GetExpanderColumn()) // if the current column is marked expandable this column will become the active expandable column
-      MacDataViewListCtrlPtr->SetDisclosureColumn(NewPropertyID,true);
-
-   // 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 otherwise ask the control to 'update' the data in the newly appended column:
-    if (this->GetColumnCount() == 1)
-      this->AddChildrenLevel(wxDataViewItem());
+     // variable definition:
+      wxRect rectangle;
+      
+      ::wxMacNativeToRect(&MacRectangle,&rectangle);
+      return rectangle;
+    } /* if */
     else
     else
-      MacDataViewListCtrlPtr->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,NewPropertyID);
-   // done:
-    return true;
+      return wxRect();
   } /* if */
   else
   } /* if */
   else
-    return false;
-} /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
+    return wxRect();
+} /* wxDataViewCtrl::GetItemRect(wxDataViewItem const&, unsigned int) const */
 
 
-wxDataViewItem wxDataViewCtrl::GetSelection(void)
+wxDataViewItem wxDataViewCtrl::GetSelection(void) const
 {
   wxArrayDataBrowserItemID itemIDs;
   
 {
   wxArrayDataBrowserItemID itemIDs;
   
@@ -803,51 +1278,177 @@ wxDataViewItem wxDataViewCtrl::GetSelection(void)
     return wxDataViewItem(reinterpret_cast<void*>(itemIDs[0]));
   else
     return wxDataViewItem();
     return wxDataViewItem(reinterpret_cast<void*>(itemIDs[0]));
   else
     return wxDataViewItem();
-} /* wxDataViewCtrl::GetSelection(void) */
+} /* wxDataViewCtrl::GetSelection(void) const */
 
 
-bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model)
+int wxDataViewCtrl::GetSelections(wxDataViewItemArray& sel) const
 {
 {
-  if (!wxDataViewCtrlBase::AssociateModel(model))
-    return false;
+  size_t NoOfSelectedItems;
+
+  wxArrayDataBrowserItemID itemIDs;
+  
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
   
   
-  this->m_NotifierPtr = new wxMacDataViewModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer));
-  model->AddNotifier(this->m_NotifierPtr);
+  
+  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 */
 
 
-  return true;
-} /* wxDataViewCtrl::AssociateModel(wxDataViewModel*) */
+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 */
+
+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())
+  {
+   // 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 */
+} /* 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 and initialization:
+    DataBrowserItemID                              itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  
+    MacDataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsRemove);
+  } /* if */
+} /* wxDataViewCtrl::Unselect(wxDataViewItem const&) */
+
+void wxDataViewCtrl::UnselectAll(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,kDataBrowserItemsRemove);
+  HUnlock(handle);
+  DisposeHandle(handle);
+} /* wxDataViewCtrl::UnselectAll(void) */
 
 // data handling:
 void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const& parentItem)
 {
 
 // data handling:
 void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const& parentItem)
 {
-  wxDataViewItem item;
+  int NoOfChildren;
+
+  wxDataViewItemArray items;
   
   
   wxCHECK_RET(this->GetModel() != NULL,_("Model pointer not initialized."));
   
   
   wxCHECK_RET(this->GetModel() != NULL,_("Model pointer not initialized."));
-  item = this->GetModel()->GetFirstChild(parentItem);
-  while (item.IsOk())
-  {
-    (void) this->GetModel()->ItemAdded(parentItem,item);
-    item = this->GetModel()->GetNextSibling(item);
-  } /* while */
+  NoOfChildren = this->GetModel()->GetChildren(parentItem,items);
+#if 0
+  for (int i=0; i<NoOfChildren; ++i)
+    (void) this->GetModel()->ItemAdded(parentItem,items[i]);
+#else
+  (void) this->GetModel()->ItemsAdded(parentItem,items);
+#endif
 } /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
 
 } /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
 
+void wxDataViewCtrl::FinishCustomItemEditing(void)
+{
+  if (this->GetCustomRendererItem().IsOk())
+  {
+    this->GetCustomRendererPtr()->FinishEditing();
+    this->SetCustomRendererItem(wxDataViewItem());
+    this->SetCustomRendererPtr (NULL);
+  } /* if */
+} /* wxDataViewCtrl::FinishCustomItemEditing(void) */
+
+wxDataViewColumn* wxDataViewCtrl::GetColumnPtr(WXDataBrowserPropertyID propertyID) const
+{
+ // 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 */
+
 // inherited methods from wxDataViewCtrlBase
 void wxDataViewCtrl::DoSetExpanderColumn(void)
 {
 // inherited methods from wxDataViewCtrlBase
 void wxDataViewCtrl::DoSetExpanderColumn(void)
 {
-  if (this->GetExpanderColumn() < this->GetColumnCount())
+  if (this->GetExpanderColumn() != NULL)
   {
    // variable definition and initialization:
   {
    // variable definition and initialization:
-    DataBrowserPropertyID                          propertyID;
     wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
     wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
-    if (MacDataViewListCtrlPtr->GetPropertyID(this->GetExpanderColumn(),&propertyID) == noErr)
-      (void) MacDataViewListCtrlPtr->SetDisclosureColumn(propertyID);
+    (void) MacDataViewListCtrlPtr->SetDisclosureColumn(this->GetExpanderColumn()->GetPropertyID(),false); // second parameter explicitely passed to ensure that arrow is centered
   } /* if */
 } /* wxDataViewCtrl::DoSetExpanderColumn(void) */
 
 void wxDataViewCtrl::DoSetIndent(void)
 {
   } /* if */
 } /* wxDataViewCtrl::DoSetExpanderColumn(void) */
 
 void wxDataViewCtrl::DoSetIndent(void)
 {
-} /* wxDataViewCtrl::DoSetExpanderColumn(void) */
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));  
+
+
+  (void) MacDataViewListCtrlPtr->SetIndent(static_cast<float>(this->GetIndent()));
+} /* wxDataViewCtrl::DoSetIndent(void) */
 
 // event handling:
 void wxDataViewCtrl::OnSize(wxSizeEvent& event)
 
 // event handling:
 void wxDataViewCtrl::OnSize(wxSizeEvent& event)
@@ -869,6 +1470,19 @@ void wxDataViewCtrl::OnSize(wxSizeEvent& event)
         dataViewCustomRendererPtr->SetDC(NULL); // reset DC because DC has changed
     } /* if */
   } /* for */
         dataViewCustomRendererPtr->SetDC(NULL); // reset DC because DC has changed
     } /* if */
   } /* for */
+  
+  wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+  ControlRef ref = MacDataViewListCtrlPtr->GetControlRef();
+  if (NoOfColumns == 1)
+  {
+     ::SetDataBrowserHasScrollBars( ref, false, true );
+     ::AutoSizeDataBrowserListViewColumns( ref );
+  }
+  if (NoOfColumns > 1)
+  {
+     ::SetDataBrowserHasScrollBars( ref, true, true );
+  }
+  
   event.Skip();
 } /* wxDataViewCtrl::OnSize(wxSizeEvent&) */
 
   event.Skip();
 } /* wxDataViewCtrl::OnSize(wxSizeEvent&) */