From 99c75ebc5e447e1bb25439e22f07130583dc5783 Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Wed, 26 Dec 2007 18:30:56 +0000
Subject: [PATCH] Patch from Hartwig and me for implementing reorderable
 dataview columns. Works on OS X and GTK+, breaks OS X a litte

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dataviewcolumn.tex |  14 +
 include/wx/dataview.h            |   6 +-
 include/wx/generic/dataview.h    |   5 +-
 include/wx/gtk/dataview.h        |   3 +
 include/wx/mac/carbon/databrow.h |  52 ++--
 include/wx/mac/carbon/dataview.h |  86 +++---
 samples/dataview/dataview.cpp    | 139 +++++-----
 src/common/datavcmn.cpp          |  11 +-
 src/generic/datavgen.cpp         |   5 +
 src/gtk/dataview.cpp             |   9 +
 src/mac/carbon/databrow.cpp      | 435 +++++++++++++++++++------------
 src/mac/carbon/dataview.cpp      | 268 ++++++++++++-------
 12 files changed, 637 insertions(+), 396 deletions(-)

diff --git a/docs/latex/wx/dataviewcolumn.tex b/docs/latex/wx/dataviewcolumn.tex
index 7bb5ed2d58..479e4de5a7 100644
--- a/docs/latex/wx/dataviewcolumn.tex
+++ b/docs/latex/wx/dataviewcolumn.tex
@@ -82,6 +82,12 @@ Returns the renderer of this wxDataViewColumn.
 
 See also \helpref{wxDataViewRenderer}{wxdataviewrenderer}.
 
+\membersection{wxDataViewColumn::GetReorderable}\label{wxdataviewcolumngetreorderable}
+
+\func{bool}{GetReorderable}{\void}
+
+Returns true if the column is reorderable.
+
 \membersection{wxDataViewColumn::GetSortable}\label{wxdataviewcolumngetsortable}
 
 \func{bool}{GetSortable}{\void}
@@ -116,6 +122,14 @@ Set the alignment of the column header.
 
 Set the bitmap of the column header.
 
+\membersection{wxDataViewColumn::SetReorderable}\label{wxdataviewcolumnsetreorderable}
+
+\func{void}{SetReorderable}{\param{bool }{reorderable}}
+
+Indicate wether the column can be reordered by the
+user using the mouse. This is typically implemented 
+visually by dragging the header button around.
+
 \membersection{wxDataViewColumn::SetSortOrder}\label{wxdataviewcolumnsetsortorder}
 
 \func{void}{SetSortOrder}{\param{bool }{ascending}}
diff --git a/include/wx/dataview.h b/include/wx/dataview.h
index 575251cf15..97d9d5b36b 100644
--- a/include/wx/dataview.h
+++ b/include/wx/dataview.h
@@ -448,6 +448,7 @@ public:
     virtual void SetTitle( const wxString &title ) = 0;
     virtual void SetAlignment( wxAlignment align ) = 0;
     virtual void SetSortable( bool sortable ) = 0;
+    virtual void SetReorderable(bool reorderable) = 0;
     virtual void SetResizeable( bool resizeable ) = 0;
     virtual void SetHidden( bool hidden ) = 0;
     virtual void SetSortOrder( bool ascending ) = 0;
@@ -470,9 +471,10 @@ public:
 
     virtual int GetFlags() const;
 
-    virtual bool IsSortable() const = 0;
-    virtual bool IsResizeable() const = 0;
     virtual bool IsHidden() const = 0;
+    virtual bool IsReorderable() const = 0;
+    virtual bool IsResizeable() const = 0;
+    virtual bool IsSortable() const = 0;
     virtual bool IsSortOrderAscending() const = 0;
 
     const wxBitmap &GetBitmap() const       { return m_bitmap; }
diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h
index 10e8bbf970..7bf0e396d8 100644
--- a/include/wx/generic/dataview.h
+++ b/include/wx/generic/dataview.h
@@ -328,7 +328,7 @@ public:
     virtual void SetResizeable( bool resizeable );
     virtual void SetHidden( bool hidden );
     virtual void SetSortOrder( bool ascending );
-
+    virtual void SetReorderable( bool reorderable );
 
     // getters:
 
@@ -347,7 +347,8 @@ public:
     virtual bool IsHidden() const
         { return (m_flags & wxDATAVIEW_COL_HIDDEN) != 0; }
     virtual bool IsSortOrderAscending() const;
-
+    virtual bool IsReorderable() const
+        { return (m_flags & wxDATAVIEW_COL_REORDERABLE) != 0; }
 
 private:
     int                      m_width;
diff --git a/include/wx/gtk/dataview.h b/include/wx/gtk/dataview.h
index 293ff6e141..d20ee24a77 100644
--- a/include/wx/gtk/dataview.h
+++ b/include/wx/gtk/dataview.h
@@ -301,6 +301,7 @@ public:
     virtual void SetMinWidth( int minWidth );
     virtual void SetWidth( int width );
 
+    virtual void SetReorderable( bool reorderable );
 
     // getters:
 
@@ -314,6 +315,8 @@ public:
 
     virtual int GetWidth() const;
     virtual int GetMinWidth() const;
+    
+    virtual bool IsReorderable() const;
 
     // implementation
     GtkWidget* GetGtkHandle() { return m_column; }
diff --git a/include/wx/mac/carbon/databrow.h b/include/wx/mac/carbon/databrow.h
index dcf94af9bb..bdecc4cab0 100644
--- a/include/wx/mac/carbon/databrow.h
+++ b/include/wx/mac/carbon/databrow.h
@@ -140,7 +140,7 @@ public:
   OSStatus RemoveColumnByIndex   (DataBrowserTableViewColumnIndex index);
 
   OSStatus SetColumnIndex     (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index);
-  OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=true);
+  OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=false);
   OSStatus SetPropertyFlags   (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags);
 
 //
@@ -218,17 +218,31 @@ public:
 
 protected :
 //
-// callback functions
+// standard callback functions
 //
-  static pascal Boolean  DataBrowserCompareProc         (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty);
-  static pascal void     DataBrowserDrawItemProc        (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice);
-  static pascal OSStatus DataBrowserGetSetItemDataProc  (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue);
-  static pascal void     DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData);
+  static pascal Boolean  DataBrowserCompareProc          (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty);
+  static pascal void     DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection);
+  static pascal OSStatus DataBrowserGetSetItemDataProc   (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue);
+  static pascal void     DataBrowserItemNotificationProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData);
+
+  virtual Boolean  DataBrowserCompareProc          (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0;
+  virtual void     DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) = 0;
+  virtual OSStatus DataBrowserGetSetItemDataProc   (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0;
+  virtual void     DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0;
+
+//
+// callback functions for customized types
+//
+  static pascal void                      DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice);
+  static pascal Boolean                   DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit);
+  static pascal Boolean                   DataBrowserHitTestProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect);
+  static pascal DataBrowserTrackingResult DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers);
+
+  virtual void                      DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0;
+  virtual Boolean                   DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) = 0;
+  virtual Boolean                   DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) = 0;
+  virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) = 0;
 
-  virtual Boolean  DataBrowserCompareProc         (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0;
-  virtual void     DataBrowserDrawItemProc        (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0;
-  virtual OSStatus DataBrowserGetSetItemDataProc  (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0;
-  virtual void     DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0;
 private:
 //
 // wxWidget internal stuff
@@ -282,12 +296,20 @@ public:
 
 protected:
 //
-// callback functions (inherited from wxMacDataBrowserTableViewControl)
+// standard callback functions (inherited from wxMacDataBrowserTableViewControl)
+//
+  virtual Boolean  DataBrowserCompareProc          (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty);
+  virtual void     DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData);
+  virtual void     DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection);
+  virtual OSStatus DataBrowserGetSetItemDataProc   (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue);
+
+//
+// callback functions for customized types (inherited from wxMacDataBrowserTableViewControl)
 //
-  virtual Boolean  DataBrowserCompareProc         (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty);
-  virtual void     DataBrowserDrawItemProc        (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice);
-  virtual void     DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData);
-  virtual OSStatus DataBrowserGetSetItemDataProc  (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue);
+  virtual void                      DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice);
+  virtual Boolean                   DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit);
+  virtual Boolean                   DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect);
+  virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers);
 
 private:
 };
diff --git a/include/wx/mac/carbon/dataview.h b/include/wx/mac/carbon/dataview.h
index 24a5a673af..7a8fbeffaa 100644
--- a/include/wx/mac/carbon/dataview.h
+++ b/include/wx/mac/carbon/dataview.h
@@ -143,42 +143,6 @@ public:
     return false;
   }
 
-//
-// in-place editing
-//
-  virtual void CancelEditing()
-  {
-  }
-
-  virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent), wxRect WXUNUSED(labelRect), const wxVariant& WXUNUSED(value))
-  {
-    return NULL;
-  }
-
-  virtual bool FinishEditing()
-  {
-    return false;
-  }
-
-  wxControl* GetEditorCtrl(void) const
-  {
-    return this->m_editorCtrlPtr;
-  }
-  virtual bool GetValueFromEditorCtrl(wxControl* WXUNUSED(editor), wxVariant& WXUNUSED(value))
-  {
-    return false;
-  }
-
-  virtual bool HasEditorCtrl(void)
-  {
-    return false;
-  }
-
-  virtual bool StartEditing(wxDataViewItem const& WXUNUSED(item), wxRect WXUNUSED(labelRect)) 
-  {
-    return false;
-  }
-  
 //
 // device context handling
 //
@@ -423,6 +387,10 @@ public:
   {
     return false; // not implemented
   }
+  virtual bool IsReorderable(void) const
+  {
+    return ((this->m_flags & wxDATAVIEW_COL_REORDERABLE) != 0);
+  }
   virtual bool IsResizeable(void) const
   {
     return ((this->m_flags & wxDATAVIEW_COL_RESIZABLE) != 0);
@@ -442,13 +410,14 @@ public:
   virtual void SetHidden(bool WXUNUSED(hidden))
   {
   }
-  virtual void SetMaxWidth  (int maxWidth);
-  virtual void SetMinWidth  (int minWidth);
-  virtual void SetResizeable(bool resizeable);
-  virtual void SetSortable  (bool sortable);
-  virtual void SetSortOrder (bool ascending);
-  virtual void SetTitle     (wxString const& title);
-  virtual void SetWidth     (int  width);
+  virtual void SetMaxWidth   (int maxWidth);
+  virtual void SetMinWidth   (int minWidth);
+  virtual void SetReorderable(bool reorderable);
+  virtual void SetResizeable (bool resizeable);
+  virtual void SetSortable   (bool sortable);
+  virtual void SetSortOrder  (bool ascending);
+  virtual void SetTitle      (wxString const& title);
+  virtual void SetWidth      (int  width);
 
 //
 // implementation
@@ -496,7 +465,7 @@ class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
 {
 public:
  // Constructors / destructor:
-  wxDataViewCtrl()
+  wxDataViewCtrl(void)
   {
     this->Init();
   }
@@ -556,9 +525,22 @@ public:
  // adds all children of the passed parent to the control; if 'parentItem' is invalid the root(s) is/are added:
   void AddChildrenLevel(wxDataViewItem const& parentItem);
 
+ // finishes editing of custom items; if no custom item is currently edited the method does nothing
+  void FinishCustomItemEditing(void);
+
  // returns a pointer to a column;
  // in case the pointer cannot be found NULL is returned:
   wxDataViewColumn* GetColumnPtr(WXDataBrowserPropertyID propertyID) const;
+ // returns the current being rendered item of the customized renderer (this item is only valid during editing)
+  wxDataViewItem const& GetCustomRendererItem(void) const
+  {
+    return this->m_CustomRendererItem;
+  }
+ // returns a pointer to a customized renderer (this pointer is only valid during editing)
+  wxDataViewCustomRenderer* GetCustomRendererPtr(void) const
+  {
+    return this->m_CustomRendererPtr;
+  }
 
  // checks if currently a delete process is running:
   bool IsDeleting(void) const
@@ -579,7 +561,17 @@ public:
     return this->m_cgContext;
   }
 
- /// sets the flag indicating a deletion process:
+ // sets the currently being edited item of the custom renderer
+  void SetCustomRendererItem(wxDataViewItem const& NewItem)
+  {
+    this->m_CustomRendererItem = NewItem;
+  }
+ // sets the custom renderer
+  void SetCustomRendererPtr(wxDataViewCustomRenderer* NewCustomRendererPtr)
+  {
+    this->m_CustomRendererPtr = NewCustomRendererPtr;
+  }
+ // sets the flag indicating a deletion process:
   void SetDeleting(bool deleting)
   {
     this->m_Deleting = deleting;
@@ -609,7 +601,11 @@ private:
                    // try to update data into variables that are already deleted; this flag will ignore all variable update requests during item deletion
 
   void* m_cgContext; // pointer to core graphics context
+
+  wxDataViewCustomRenderer* m_CustomRendererPtr; // pointer to a valid custom renderer while editing; this class does NOT own the pointer
   
+  wxDataViewItem m_CustomRendererItem; // currently edited item by the customerenderer; it is invalid while not editing
+
   ColumnPointerHashMapType m_ColumnPointers; // all column pointers are stored in a hash map with the property ID as a key
 
  // wxWidget internal stuff:
diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp
index 3f4e207444..4b8f7a5473 100644
--- a/samples/dataview/dataview.cpp
+++ b/samples/dataview/dataview.cpp
@@ -153,19 +153,19 @@ public:
 
     MyMusicModel() 
     {
-        m_root = new MyMusicModelNode( NULL, "My Music" );
-        m_pop = new MyMusicModelNode( m_root, "Pop music" );
+        m_root = new MyMusicModelNode( NULL, wxT("My Music" ));
+        m_pop = new MyMusicModelNode( m_root, wxT("Pop music") );
         m_root->Append( m_pop );
         m_pop->Append( new MyMusicModelNode( m_pop, 
-            "You are not alone", "Michael Jackson", 1995 ) );
+            wxT("You are not alone"), wxT("Michael Jackson"), 1995 ) );
         m_pop->Append( new MyMusicModelNode( m_pop, 
-            "Take a bow", "Madonna", 1994 ) );
-        m_classical = new MyMusicModelNode( m_root, "Classical music" );
+            wxT("Take a bow"), wxT("Madonna"), 1994 ) );
+        m_classical = new MyMusicModelNode( m_root, wxT("Classical music") );
         m_root->Append( m_classical );
         m_classical->Append( new MyMusicModelNode( m_classical, 
-            "Ninth symphony", "Ludwig van Beethoven", 1824 ) );
+            wxT("Ninth symphony"), wxT("Ludwig van Beethoven"), 1824 ) );
         m_classical->Append( new MyMusicModelNode( m_classical, 
-            "German Requiem", "Johannes Brahms", 1868 ) );
+            wxT("German Requiem"), wxT("Johannes Brahms"), 1868 ) );
         m_classicalMusicIsKnownToControl = false;
     }
     
@@ -247,9 +247,9 @@ public:
     virtual wxString GetColumnType( unsigned int col ) const
     {
         if (col == 2)
-            return "long";
+            return wxT("long");
             
-        return "string";
+        return wxT("string");
     }
 
     virtual void GetValue( wxVariant &variant, 
@@ -263,7 +263,7 @@ public:
             case 2: variant = (long) node->m_year; break;
             default: 
             {
-                wxLogError( "MyMusicModel::GetValue: wrong column" );
+                wxLogError( wxT("MyMusicModel::GetValue: wrong column" ));
                 
                 // provoke a crash when mouse button down
                 wxMouseState state = wxGetMouseState();
@@ -285,7 +285,7 @@ public:
             case 0: node->m_title = variant.GetString(); return true;
             case 1: node->m_artist  = variant.GetString(); return true;
             case 2: node->m_year  = variant.GetLong(); return true;
-            default: wxLogError( "MyMusicModel::SetValue: wrong column" );
+            default: wxLogError( wxT("MyMusicModel::SetValue: wrong column") );
         }
         return false;
     }
@@ -384,7 +384,7 @@ public:
         for (i = 0; i < 100; i++)
         {
             wxString str;
-            str.Printf( "Test %d", i );
+            str.Printf( wxT("row number %d"), i );
             m_array.Add( str );
         }
         
@@ -450,9 +450,14 @@ public:
     virtual wxString GetColumnType( unsigned int col ) const
     {
         if (col == 1)
-            return "wxDataViewIconText";
+            return wxT("wxDataViewIconText");
             
-        return "string";
+        return wxT("string");
+    }
+    
+    virtual unsigned int GetRowCount()
+    {
+        return m_array.GetCount();
     }
     
     virtual void GetValue( wxVariant &variant, 
@@ -463,7 +468,7 @@ public:
             if (row >= m_array.GetCount())
             {
                 wxString str;
-                str.Printf( "row %d", row - m_array.GetCount() );
+                str.Printf(wxT("row %d"), row - m_array.GetCount() );
                 variant = str;
             }
             else
@@ -473,15 +478,15 @@ public:
         } else
         if (col==1)
         {
-            wxDataViewIconText data( "test", m_icon );
+            wxDataViewIconText data( wxT("test"), m_icon );
             variant << data;
         } else
         if (col==2)
         {
             if (row >= m_array.GetCount())
-                variant = "plain";
+                variant = wxT("plain");
             else
-                variant = "blue";
+                variant = wxT("blue");
         }
     }
     
@@ -679,12 +684,12 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
     // build the menus:
 
     wxMenu *file_menu = new wxMenu;
-    file_menu->Append(ID_ABOUT, "&About");
+    file_menu->Append(ID_ABOUT, wxT("&About"));
     file_menu->AppendSeparator();
-    file_menu->Append(ID_EXIT, "E&xit");
+    file_menu->Append(ID_EXIT, wxT("E&xit"));
 
     wxMenuBar *menu_bar = new wxMenuBar;
-    menu_bar->Append(file_menu, "&File");
+    menu_bar->Append(file_menu, wxT("&File"));
 
     SetMenuBar(menu_bar);
     CreateStatusBar();
@@ -697,23 +702,25 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
 
     m_musicCtrl = new wxDataViewCtrl( this, ID_MUSIC_CTRL, wxDefaultPosition,
                                     wxDefaultSize, wxDV_MULTIPLE );
-                                    
+
     m_music_model = new MyMusicModel;
     m_musicCtrl->AssociateModel( m_music_model.get() );
 
-    /* wxDataViewColumn *col = */ m_musicCtrl->AppendTextColumn( "Title", 0, wxDATAVIEW_CELL_INERT, 200, 
-                                     DEFAULT_ALIGN, wxDATAVIEW_COL_SORTABLE );
 #if 0 
     // Call this and sorting is enabled
     // immediatly upon start up.                                    
+    wxDataViewColumn *col = m_musicCtrl->AppendTextColumn( wxT("Title"), 0, wxDATAVIEW_CELL_INERT, 200, 
+                                     DEFAULT_ALIGN, wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE);
     col->SetSortOrder( true );
+#else
+    m_musicCtrl->AppendTextColumn(wxT("Title"),0,wxDATAVIEW_CELL_INERT,200,DEFAULT_ALIGN,wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE);
 #endif
     
-    m_musicCtrl->AppendTextColumn( "Artist", 1, wxDATAVIEW_CELL_EDITABLE, 150,
-                                     DEFAULT_ALIGN, wxDATAVIEW_COL_SORTABLE );
+    m_musicCtrl->AppendTextColumn( wxT("Artist"), 1, wxDATAVIEW_CELL_EDITABLE, 150,
+                                     DEFAULT_ALIGN, wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE);
 
     wxDataViewSpinRenderer *sr = new wxDataViewSpinRenderer( 0, 2010 );
-    wxDataViewColumn *column = new wxDataViewColumn( "year", sr, 2, -1, wxALIGN_CENTRE, wxDATAVIEW_COL_SORTABLE );
+    wxDataViewColumn *column = new wxDataViewColumn( wxT("year"), sr, 2, -1, wxALIGN_CENTRE, wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE);
     m_musicCtrl->AppendColumn( column );
 
     data_sizer->Add( m_musicCtrl, 3, wxGROW );
@@ -723,16 +730,16 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
     // MyList
     
     m_listCtrl = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition,
-                                     wxDefaultSize, wxDV_MULTIPLE ); 
+                                     wxDefaultSize, wxDV_MULTIPLE | wxDV_ROW_LINES); 
     
     m_list_model = new MyListModel;
     m_listCtrl->AssociateModel( m_list_model.get() );
     
-    m_listCtrl->AppendTextColumn( "editable string", 0, wxDATAVIEW_CELL_EDITABLE, 120 );
-    m_listCtrl->AppendIconTextColumn( "icon", 1, wxDATAVIEW_CELL_INERT, 60 );
+    m_listCtrl->AppendTextColumn    (wxT("editable string"), 0, wxDATAVIEW_CELL_EDITABLE, 120 );
+    m_listCtrl->AppendIconTextColumn(wxT("icon"),            1, wxDATAVIEW_CELL_INERT,     60 );
     
     wxDataViewTextRendererAttr *ra = new wxDataViewTextRendererAttr;
-    column = new wxDataViewColumn( "attributes", ra, 2 );
+    column = new wxDataViewColumn(wxT("attributes"), ra, 2 );
     m_listCtrl->AppendColumn( column );
     
     data_sizer->Add( m_listCtrl, 2, wxGROW );
@@ -743,24 +750,24 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
     
     wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
     
-    button_sizer->Add( new wxButton( this, ID_ADD_MOZART, "Add Mozart"), 0, wxALL, 10 );
-    button_sizer->Add( new wxButton( this, ID_DELETE_MUSIC, "Delete selected"), 0, wxALL, 10 );
-    button_sizer->Add( new wxButton( this, ID_DELETE_YEAR, "Delete \"Year\" column"), 0, wxALL, 10 );
+    button_sizer->Add( new wxButton( this, ID_ADD_MOZART,  _("Add Mozart")),             0, wxALL, 10 );
+    button_sizer->Add( new wxButton( this, ID_DELETE_MUSIC,_("Delete selected")),        0, wxALL, 10 );
+    button_sizer->Add( new wxButton( this, ID_DELETE_YEAR, _("Delete \"Year\" column")), 0, wxALL, 10 );
     button_sizer->Add( 10, 10, 1 );
     wxFlexGridSizer *grid_sizer = new wxFlexGridSizer( 2, 2 );
-    grid_sizer->Add( new wxButton( this, ID_PREPEND_LIST, "Prepend"), 0, wxALL, 2 );
-    grid_sizer->Add( new wxButton( this, ID_DELETE_LIST, "Delete selected"), 0, wxALL, 2 );
-    grid_sizer->Add( new wxButton( this, ID_GOTO, "Goto 50"), 0, wxALL, 2 );
-    grid_sizer->Add( new wxButton( this, ID_ADD_MANY, "Add 1000"), 0, wxALL, 2 );
+    grid_sizer->Add( new wxButton( this, ID_PREPEND_LIST,_("Prepend")),         0, wxALL, 2 );
+    grid_sizer->Add( new wxButton( this, ID_DELETE_LIST, _("Delete selected")), 0, wxALL, 2 );
+    grid_sizer->Add( new wxButton( this, ID_GOTO,        _("Goto 50")),         0, wxALL, 2 );
+    grid_sizer->Add( new wxButton( this, ID_ADD_MANY,    _("Add 1000")),        0, wxALL, 2 );
     button_sizer->Add( grid_sizer, 0, wxALL, 10 );
     
     main_sizer->Add( button_sizer, 0, wxGROW, 0 );
 
     wxBoxSizer *bottom_sizer = new wxBoxSizer( wxHORIZONTAL );
     
-    m_log = new wxTextCtrl( this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
+    m_log = new wxTextCtrl( this, -1,wxString(), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
     m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_log));
-    wxLogMessage("This is the log window");
+    wxLogMessage(_("This is the log window"));
 
     bottom_sizer->Add( m_log, 1, wxGROW );
  
@@ -770,14 +777,14 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
         wxDefaultPosition, wxSize(300,200), wxDV_NO_HEADER );
         
     wxDataViewTreeStore *store = new wxDataViewTreeStore;
-    wxDataViewItem parent = store->AppendContainer( wxDataViewItem(0), "Root 1", wxIcon(small1_xpm) );
-    wxDataViewItem child = store->AppendItem( parent, "Child 1", wxIcon(small1_xpm) );
-    child = store->AppendItem( parent, "Child 2", wxIcon(small1_xpm) );
-    child = store->AppendItem( parent, "Child 3", wxIcon(small1_xpm) );
+    wxDataViewItem parent = store->AppendContainer( wxDataViewItem(0),wxT("Root 1"), wxIcon(small1_xpm) );
+    wxDataViewItem child = store->AppendItem( parent,wxT("Child 1"), wxIcon(small1_xpm) );
+    child = store->AppendItem( parent,wxT("Child 2"), wxIcon(small1_xpm) );
+    child = store->AppendItem( parent,wxT("Child 3"), wxIcon(small1_xpm) );
     treectrl->AssociateModel( store );
     store->DecRef();
 
-    treectrl->AppendIconTextColumn( "no label", 0, wxDATAVIEW_CELL_INERT, 200 );
+    treectrl->AppendIconTextColumn(wxT("no label"), 0, wxDATAVIEW_CELL_INERT, 200 );
 
     bottom_sizer->Add( treectrl );
 
@@ -789,10 +796,10 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
     ilist->Add( wxIcon(small1_xpm) );
     treectrl2->SetImageList( ilist );
     
-    parent = treectrl2->AppendContainer( wxDataViewItem(0), "Root 1", 0 );
-    child = treectrl2->AppendItem( parent, "Child 1", 0 );
-    child = treectrl2->AppendItem( parent, "Child 2", 0 );
-    child = treectrl2->AppendItem( parent, "Child 3", 0 );
+    parent = treectrl2->AppendContainer( wxDataViewItem(0),wxT("Root 1"), 0 );
+    child = treectrl2->AppendItem( parent,wxT("Child 1"), 0 );
+    child = treectrl2->AppendItem( parent,wxT("Child 2"), 0 );
+    child = treectrl2->AppendItem( parent,wxT("Child 3"), 0 );
     
     bottom_sizer->Add( treectrl2 );
     
@@ -810,7 +817,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
 
 void MyFrame::OnAddMozart(wxCommandEvent& WXUNUSED(event) )
 {
-    m_music_model->AddToClassical( "Kleine Nachtmusik", "Wolfgang Mozart", 1787 );
+    m_music_model->AddToClassical( wxT("Kleine Nachtmusik"), wxT("Wolfgang Mozart"), 1787 );
 }
 
 void MyFrame::OnDeleteMusic(wxCommandEvent& WXUNUSED(event) )
@@ -830,7 +837,7 @@ void MyFrame::OnDeleteYear( wxCommandEvent& WXUNUSED(event) )
 
 void MyFrame::OnPrependList( wxCommandEvent& WXUNUSED(event) )
 {
-    m_list_model->Prepend( "Test" );
+    m_list_model->Prepend(wxT("Test"));
 }
 
 void MyFrame::OnDeleteList( wxCommandEvent& WXUNUSED(event) )
@@ -846,7 +853,7 @@ void MyFrame::OnValueChanged( wxDataViewEvent &event )
     if (!m_log)
         return;
         
-    wxLogMessage( "EVT_DATAVIEW_ITEM_VALUE_CHANGED, Item Id: %d;  Column: %d", event.GetItem().GetID(), event.GetColumn() );
+    wxLogMessage( wxT("EVT_DATAVIEW_ITEM_VALUE_CHANGED, Item Id: %d;  Column: %d"), event.GetItem().GetID(), event.GetColumn() );
 }
 
 void MyFrame::OnActivated( wxDataViewEvent &event )
@@ -855,7 +862,7 @@ void MyFrame::OnActivated( wxDataViewEvent &event )
         return;
 
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item: %s"), title.GetData());
 }
 
 void MyFrame::OnSelectionChanged( wxDataViewEvent &event )
@@ -865,9 +872,9 @@ void MyFrame::OnSelectionChanged( wxDataViewEvent &event )
 
     wxString title = m_music_model->GetTitle( event.GetItem() );
     if (title.empty())
-        title = "None";
+        title = wxT("None");
         
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, First selected Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, First selected Item: %s"), title.GetData() );
 }
 
 void MyFrame::OnExpanding( wxDataViewEvent &event )
@@ -876,7 +883,7 @@ void MyFrame::OnExpanding( wxDataViewEvent &event )
         return;
         
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, Item: %s"), title.GetData() );
 }
 
 
@@ -886,7 +893,7 @@ void MyFrame::OnEditingStarted( wxDataViewEvent &event )
         return;
         
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, Item: %s"), title.GetData() );
 }
 
 void MyFrame::OnEditingDone( wxDataViewEvent &event )
@@ -895,7 +902,7 @@ void MyFrame::OnEditingDone( wxDataViewEvent &event )
         return;
         
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, Item: %s"), title.GetData() );
 }
 
 void MyFrame::OnExpanded( wxDataViewEvent &event )
@@ -904,7 +911,7 @@ void MyFrame::OnExpanded( wxDataViewEvent &event )
         return;
         
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, Item: %s"), title.GetData() );
 }
 
 void MyFrame::OnCollapsing( wxDataViewEvent &event )
@@ -913,7 +920,7 @@ void MyFrame::OnCollapsing( wxDataViewEvent &event )
         return;
         
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, Item: %s"), title.GetData() );
 }
 
 void MyFrame::OnCollapsed( wxDataViewEvent &event )
@@ -922,7 +929,7 @@ void MyFrame::OnCollapsed( wxDataViewEvent &event )
         return;
     
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, Item: %s"),title.GetData());
 }
 
 void MyFrame::OnContextMenu( wxDataViewEvent &event )
@@ -931,7 +938,7 @@ void MyFrame::OnContextMenu( wxDataViewEvent &event )
         return;
     
     wxString title = m_music_model->GetTitle( event.GetItem() );
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, Item: %s", title );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, Item: %s"),title.GetData());
 }
 
 void MyFrame::OnHeaderClick( wxDataViewEvent &event )
@@ -941,7 +948,7 @@ void MyFrame::OnHeaderClick( wxDataViewEvent &event )
         
     int pos = m_musicCtrl->GetColumnPosition( event.GetDataViewColumn() );
 
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column position: %d", pos );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column position: %d"), pos );
 }
 
 void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )
@@ -951,7 +958,7 @@ void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )
 
     int pos = m_musicCtrl->GetColumnPosition( event.GetDataViewColumn() );
 
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, Column position: %d", pos );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, Column position: %d"), pos );
 }
 
 void MyFrame::OnSorted( wxDataViewEvent &event )
@@ -961,7 +968,7 @@ void MyFrame::OnSorted( wxDataViewEvent &event )
 
     int pos = m_musicCtrl->GetColumnPosition( event.GetDataViewColumn() );
 
-    wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, Column position: %d", pos );
+    wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, Column position: %d"), pos );
 }
 
 void MyFrame::OnRightClick( wxMouseEvent &event )
@@ -969,7 +976,7 @@ void MyFrame::OnRightClick( wxMouseEvent &event )
     if(!m_log)
         return;
 
-    wxLogMessage("wxEVT_MOUSE_RIGHT_UP, Click Point is X: %d, Y: %d", event.GetX(), event.GetY());
+    wxLogMessage(wxT("wxEVT_MOUSE_RIGHT_UP, Click Point is X: %d, Y: %d"), event.GetX(), event.GetY());
 }
 
 void MyFrame::OnGoto(wxCommandEvent& WXUNUSED(event))
diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp
index 27174d8963..a74d7ae71d 100644
--- a/src/common/datavcmn.cpp
+++ b/src/common/datavcmn.cpp
@@ -40,7 +40,7 @@ bool operator == (const wxDataViewItem &left, const wxDataViewItem &right)
 #ifdef __WXDEBUG__
 void wxDataViewItem::Print(const wxString& text) const
 {
-    wxPrintf("item %s: %l\n", text, (long)m_id);
+    wxPrintf(wxT("item %s: %l\n"), text.GetData(), (long)m_id);
 }
 #endif
 
@@ -801,6 +801,7 @@ void wxDataViewColumnBase::SetFlags(int flags)
     SetSortable((flags & wxDATAVIEW_COL_SORTABLE) != 0);
     SetResizeable((flags & wxDATAVIEW_COL_RESIZABLE) != 0);
     SetHidden((flags & wxDATAVIEW_COL_HIDDEN) != 0);
+    SetReorderable((flags & wxDATAVIEW_COL_REORDERABLE) != 0);
 }
 
 // ---------------------------------------------------------
@@ -1162,7 +1163,7 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED)
 // -------------------------------------
 
 wxDataViewSpinRenderer::wxDataViewSpinRenderer( int min, int max, wxDataViewCellMode mode, int alignment ) :
-   wxDataViewCustomRenderer( "long", mode, alignment )
+   wxDataViewCustomRenderer(wxT("long"), mode, alignment )
 {
     m_min = min;
     m_max = max;
@@ -1186,7 +1187,7 @@ bool wxDataViewSpinRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVarian
 bool wxDataViewSpinRenderer::Render( wxRect rect, wxDC *dc, int state )
 {
     wxString str;
-    str.Printf( "%d", (int) m_data );
+    str.Printf(wxT("%d"), (int) m_data );
     RenderText( str, 0, rect, dc, state );
     return true;
 }
@@ -1647,12 +1648,12 @@ wxDataViewTreeCtrl::wxDataViewTreeCtrl( wxWindow *parent, wxWindowID id,
     store->DecRef();
     
 #if !defined(__WXGTK20__) || defined(wxUSE_GENERICDATAVIEWCTRL)
-    wxDataViewColumn *col = AppendIconTextColumn( "", 0, wxDATAVIEW_CELL_INERT, 40 );
+    wxDataViewColumn *col = AppendIconTextColumn(wxString(),0,wxDATAVIEW_CELL_INERT,40);
     
     wxSize cient_size = GetClientSize();
     col->SetWidth( size.x );
 #else
-    AppendIconTextColumn( "", 0, wxDATAVIEW_CELL_INERT, 40 );
+    AppendIconTextColumn(wxString(),0,wxDATAVIEW_CELL_INERT,40);
 #endif    
 }
 
diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp
index e3c3a80579..ae4feb9d10 100644
--- a/src/generic/datavgen.cpp
+++ b/src/generic/datavgen.cpp
@@ -1199,6 +1199,11 @@ void wxDataViewColumn::SetSortable( bool sortable )
         GetOwner()->OnColumnChange();
 }
 
+void wxDataViewColumn::SetReorderable( bool reorderable )
+{
+    // TODO
+}
+
 void wxDataViewColumn::SetSortOrder( bool ascending )
 {
     m_ascending = ascending;
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index f50c4fd07e..74db40819d 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -2509,6 +2509,15 @@ void wxDataViewColumn::SetWidth( int width )
     gtk_tree_view_column_set_fixed_width( GTK_TREE_VIEW_COLUMN(m_column), width );
 }
 
+void wxDataViewColumn::SetReorderable( bool reorderable )
+{
+    gtk_tree_view_column_set_reorderable( GTK_TREE_VIEW_COLUMN(m_column), reorderable );
+}
+
+bool wxDataViewColumn::IsReorderable() const
+{
+    return gtk_tree_view_column_get_reorderable( GTK_TREE_VIEW_COLUMN(m_column) );
+}
 
 //-----------------------------------------------------------------------------
 // wxGtkTreeModelNode
diff --git a/src/mac/carbon/databrow.cpp b/src/mac/carbon/databrow.cpp
index 0a70c51159..180327d493 100644
--- a/src/mac/carbon/databrow.cpp
+++ b/src/mac/carbon/databrow.cpp
@@ -1,7 +1,7 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/mac/carbon/databrow.cpp
 // Purpose:     Classes and functions for the Carbon data browser
-// Author:
+// Author:      
 // Modified by:
 // Created:     2007-05-18
 // RCS-ID:      $Id$
@@ -9,17 +9,15 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#include "wx/wxprec.h"
-
-#if wxUSE_DATAVIEWCTRL && !defined(wxUSE_GENERICDATAVIEWCTRL)
+#ifndef wxUSE_GENERICDATAVIEWCTRL
 
 #include <limits>
 
+#include "wx/wxprec.h"
 #ifndef WX_PRECOMP
     #include "wx/app.h"
     #include "wx/toplevel.h"
     #include "wx/font.h"
-    #include "wx/settings.h"
 #endif
 
 #include "wx/dataview.h"
@@ -29,6 +27,19 @@
 #include "wx/mac/private.h"
 #include "wx/mac/uma.h"
 
+// ============================================================================
+// Variables used globally in databrow.cpp
+// ============================================================================
+DataBrowserGetContextualMenuUPP gDataBrowserTableViewGetContextualMenuUPP = NULL;
+DataBrowserItemCompareUPP       gDataBrowserTableViewItemCompareUPP       = NULL;
+DataBrowserItemDataUPP          gDataBrowserTableViewItemDataUPP          = NULL;
+DataBrowserItemNotificationUPP  gDataBrowserTableViewItemNotificationUPP  = NULL;
+
+DataBrowserDrawItemUPP gDataBrowserTableViewDrawItemUPP = NULL;
+DataBrowserEditItemUPP gDataBrowserTableViewEditItemUPP = NULL;
+DataBrowserHitTestUPP  gDataBrowserTableViewHitTestUPP  = NULL;
+DataBrowserTrackingUPP gDataBrowserTableViewTrackingUPP = NULL;
+
 // ============================================================================
 // wxMacDataBrowserTableViewControl
 // ============================================================================
@@ -44,22 +55,22 @@ pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlR
     return errDataBrowserPropertyNotSupported;
 } /* wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlRef, DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */
 
-pascal void wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice)
+pascal void wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection)
 {
   wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
 
 
   if (ControlPtr != NULL)
-    ControlPtr->DataBrowserDrawItemProc(itemID,property,state,rectangle,bitDepth,colorDevice);
-} /* wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemState, Rect const*, SInt16, Boolean) */
+    ControlPtr->DataBrowserGetContextualMenuProc(menu,helpType,helpItemString,selection);
+} /* wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc(ControlRef, MenuRef*, UInt32*, CFStringRef*, AEDesc*) */
 
-pascal OSStatus wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue)
+pascal OSStatus wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue)
 {
   wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
 
 
   if (ControlPtr != NULL)
-    return ControlPtr->DataBrowserGetSetItemDataProc(itemID,property,itemData,getValue);
+    return ControlPtr->DataBrowserGetSetItemDataProc(itemID,propertyID,itemData,getValue);
   else
     return errDataBrowserPropertyNotSupported;
 } /* wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemDataRef, Boolean) */
@@ -73,10 +84,41 @@ pascal void wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc(Co
     ControlPtr->DataBrowserItemNotificationProc(itemID,message,itemData);
 } /* wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc(ControlRef, DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
 
-DataBrowserDrawItemUPP         gDataBrowserTableViewDrawItemUPP         = NULL;
-DataBrowserItemCompareUPP      gDataBrowserTableViewItemCompareUPP      = NULL;
-DataBrowserItemDataUPP         gDataBrowserTableViewItemDataUPP         = NULL;
-DataBrowserItemNotificationUPP gDataBrowserTableViewItemNotificationUPP = NULL;
+pascal void wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  if (ControlPtr != NULL)
+    ControlPtr->DataBrowserDrawItemProc(itemID,propertyID,state,rectangle,bitDepth,colorDevice);
+} /* wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemState, Rect const*, SInt16, Boolean) */
+
+pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  return ((ControlPtr != NULL) && ControlPtr->DataBrowserEditItemProc(itemID,propertyID,theString,maxEditTextRect,shrinkToFit));
+} /* wxMacDataBrowserTableViewControl::DataBrowserEditItemProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, CFStringRef, Rect*, Boolean*) */
+
+pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserHitTestProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  return ((ControlPtr != NULL) && ControlPtr->DataBrowserHitTestProc(itemID,propertyID,theRect,mouseRect));
+} /* wxMacDataBrowserTableViewControl::DataBrowserHitTestProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, Rect const*, Rect const*) */
+
+pascal DataBrowserTrackingResult wxMacDataBrowserTableViewControl::DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  if (ControlPtr != NULL)
+    return ControlPtr->DataBrowserTrackingProc(itemID,propertyID,theRect,startPt,modifiers);
+  else
+    return kDataBrowserNothingHit; 
+} /* wxMacDataBrowserTableViewControl::DataBrowserTrackingProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, Rect const*, Point, EventModifiers) */
 
 wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style)
                                  :wxMacControl(peer)
@@ -87,27 +129,41 @@ wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* pee
 
   SetReferenceInNativeControl();
   verify_noerr(err);
-  if (gDataBrowserTableViewDrawItemUPP         == NULL) gDataBrowserTableViewDrawItemUPP    = NewDataBrowserDrawItemUPP   (DataBrowserDrawItemProc);
-  if (gDataBrowserTableViewItemCompareUPP      == NULL) gDataBrowserTableViewItemCompareUPP = NewDataBrowserItemCompareUPP(wxMacDataBrowserTableViewControl::DataBrowserCompareProc);
-  if (gDataBrowserTableViewItemDataUPP         == NULL) gDataBrowserTableViewItemDataUPP    = NewDataBrowserItemDataUPP   (wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc);
+ // setup standard callbacks:
+  if (gDataBrowserTableViewGetContextualMenuUPP == NULL) gDataBrowserTableViewGetContextualMenuUPP = NewDataBrowserGetContextualMenuUPP(wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc);
+  if (gDataBrowserTableViewItemCompareUPP       == NULL) gDataBrowserTableViewItemCompareUPP       = NewDataBrowserItemCompareUPP      (wxMacDataBrowserTableViewControl::DataBrowserCompareProc);
+  if (gDataBrowserTableViewItemDataUPP          == NULL) gDataBrowserTableViewItemDataUPP          = NewDataBrowserItemDataUPP         (wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc);
   if (gDataBrowserTableViewItemNotificationUPP == NULL)
   {
     gDataBrowserTableViewItemNotificationUPP =
+#if TARGET_API_MAC_OSX
       (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc);
+#else
+      NewDataBrowserItemNotificationUPP(wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc);
+#endif
   }
+  DataBrowserCallbacks callbacks; // variable definition
 
-  DataBrowserCallbacks       callbacks;
-  DataBrowserCustomCallbacks customCallbacks;
+  InitializeDataBrowserCallbacks(&callbacks,kDataBrowserLatestCallbacks);
+  callbacks.u.v1.getContextualMenuCallback = gDataBrowserTableViewGetContextualMenuUPP;
+  callbacks.u.v1.itemDataCallback          = gDataBrowserTableViewItemDataUPP;
+  callbacks.u.v1.itemCompareCallback       = gDataBrowserTableViewItemCompareUPP;
+  callbacks.u.v1.itemNotificationCallback  = gDataBrowserTableViewItemNotificationUPP;
+  this->SetCallbacks(&callbacks);
 
-  InitializeDataBrowserCallbacks      (&callbacks,      kDataBrowserLatestCallbacks);
-  InitializeDataBrowserCustomCallbacks(&customCallbacks,kDataBrowserLatestCallbacks);
+ // setup callbacks for customized items:
+  if (gDataBrowserTableViewDrawItemUPP == NULL) gDataBrowserTableViewDrawItemUPP = NewDataBrowserDrawItemUPP(wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc);
+  if (gDataBrowserTableViewEditItemUPP == NULL) gDataBrowserTableViewEditItemUPP = NewDataBrowserEditItemUPP(wxMacDataBrowserTableViewControl::DataBrowserEditItemProc);
+  if (gDataBrowserTableViewHitTestUPP  == NULL) gDataBrowserTableViewHitTestUPP  = NewDataBrowserHitTestUPP (wxMacDataBrowserTableViewControl::DataBrowserHitTestProc);
+  if (gDataBrowserTableViewTrackingUPP == NULL) gDataBrowserTableViewTrackingUPP = NewDataBrowserTrackingUPP(wxMacDataBrowserTableViewControl::DataBrowserTrackingProc);
 
-  callbacks.u.v1.itemDataCallback         = gDataBrowserTableViewItemDataUPP;
-  callbacks.u.v1.itemCompareCallback      = gDataBrowserTableViewItemCompareUPP;
-  callbacks.u.v1.itemNotificationCallback = gDataBrowserTableViewItemNotificationUPP;
-  this->SetCallbacks(&callbacks);
+  DataBrowserCustomCallbacks customCallbacks; // variable definition
 
+  InitializeDataBrowserCustomCallbacks(&customCallbacks,kDataBrowserLatestCallbacks);
   customCallbacks.u.v1.drawItemCallback = gDataBrowserTableViewDrawItemUPP;
+  customCallbacks.u.v1.editTextCallback = gDataBrowserTableViewEditItemUPP;
+  customCallbacks.u.v1.hitTestCallback  = gDataBrowserTableViewHitTestUPP;
+  customCallbacks.u.v1.trackingCallback = gDataBrowserTableViewTrackingUPP;
   this->SetCustomCallbacks(&customCallbacks);
 
  // style setting:
@@ -125,17 +181,17 @@ wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* pee
   } /* if */
 
   OptionBits attributes; // variable definition
-
+  
   if (this->GetAttributes(&attributes) == noErr) // get default settings
   {
     if ((style & wxDV_VERT_RULES) != 0)
       attributes |= kDataBrowserAttributeListViewDrawColumnDividers;
     else
       attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
-      
     if ((style & wxDV_ROW_LINES) != 0)
       attributes |= kDataBrowserAttributeListViewAlternatingRowColors;
-      
+    else
+      attributes &= ~kDataBrowserAttributeListViewAlternatingRowColors;
     (void) this->SetAttributes(attributes);
   } /* if */
 
@@ -159,15 +215,15 @@ OSStatus wxMacDataBrowserTableViewControl::SetCustomCallbacks(DataBrowserCustomC
 //
 // header handling
 //
-OSStatus wxMacDataBrowserTableViewControl::GetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc) const
+OSStatus wxMacDataBrowserTableViewControl::GetHeaderDesc(DataBrowserPropertyID propertyID, DataBrowserListViewHeaderDesc* desc) const
 {
   desc->version = kDataBrowserListViewLatestHeaderDesc; // if this statement is missing the next call will fail (NOT DOCUMENTED!!)
-  return ::GetDataBrowserListViewHeaderDesc(this->m_controlRef,property,desc);
+  return ::GetDataBrowserListViewHeaderDesc(this->m_controlRef,propertyID,desc);
 }
 
-OSStatus wxMacDataBrowserTableViewControl::SetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc)
+OSStatus wxMacDataBrowserTableViewControl::SetHeaderDesc(DataBrowserPropertyID propertyID, DataBrowserListViewHeaderDesc* desc)
 {
-  return ::SetDataBrowserListViewHeaderDesc(this->m_controlRef,property,desc);
+  return ::SetDataBrowserListViewHeaderDesc(this->m_controlRef,propertyID,desc);
 }
 
 //
@@ -208,9 +264,9 @@ OSStatus wxMacDataBrowserTableViewControl::GetHeaderButtonHeight(UInt16 *height)
   return ::GetDataBrowserListViewHeaderBtnHeight(this->m_controlRef,height);
 }
 
-OSStatus wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect* bounds)
+OSStatus wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserPropertyPart part, Rect* bounds)
 {
-  return ::GetDataBrowserItemPartBounds(this->m_controlRef,item,property,part,bounds);
+  return ::GetDataBrowserItemPartBounds(this->m_controlRef,item,propertyID,part,bounds);
 } /* wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID, DataBrowswerPropertyID, DataBrowserPropertyPart, Rect*) */
 
 OSStatus wxMacDataBrowserTableViewControl::GetRowHeight(DataBrowserItemID item, UInt16* height) const
@@ -315,7 +371,7 @@ OSStatus wxMacDataBrowserTableViewControl::IsUsedPropertyID(DataBrowserPropertyI
  // lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns
  // the column position for the property id:
   DataBrowserTableViewColumnIndex index;
-
+  
   return ::GetDataBrowserTableViewColumnPosition(this->m_controlRef,propertyID,&index);
 } /* wxMacDataBrowserTableViewControl::IsUsedPropertyId(DataBrowserPropertyID) const */
 
@@ -359,9 +415,12 @@ OSStatus wxMacDataBrowserTableViewControl::AddItems(DataBrowserItemID container,
 OSStatus wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID* id) const
 {
   ItemCount NoOfItems;
-
-
-  verify_noerr(this->GetItemCount(&NoOfItems));
+ 
+  OSStatus status;
+  
+  
+  status = this->GetItemCount(&NoOfItems);
+  wxCHECK_MSG(status == noErr,status,_("Could not retrieve number of items"));
   if (NoOfItems == 0)
   {
     *id = 1;
@@ -409,7 +468,7 @@ OSStatus wxMacDataBrowserTableViewControl::IsUsedItemID(DataBrowserItemID itemID
  // lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns
  // the column position for the property id:
   DataBrowserTableViewColumnIndex index;
-
+  
   return ::GetDataBrowserTableViewItemRow(this->m_controlRef,itemID,&index);
 } /* wxMacDataBrowserTableViewControl::IsUsedItemID(DataBrowserItemID) const */
 
@@ -436,7 +495,7 @@ size_t wxMacDataBrowserTableViewControl::GetSelectedItemIDs(wxArrayDataBrowserIt
 {
   DataBrowserItemID* itemIDPtr;
   Handle handle(::NewHandle(0));
-
+  
   size_t NoOfItems;
 
 
@@ -553,9 +612,9 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow
   DataBrowserSortOrder sortOrder;
 
   DataBrowserTableViewColumnIndex columnIndex;
-
+  
   wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
-
+  
 
   wxCHECK_MSG(dataViewCtrlPtr != NULL,            false,_("Pointer to data view control not set correctly."));
   wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly."));
@@ -570,97 +629,30 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow
                               columnIndex,sortOrder != kDataBrowserOrderDecreasing) < 0);
 } /* wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */
 
-void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 WXUNUSED(bitDepth), Boolean WXUNUSED(colorDevice))
+void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* WXUNUSED(selection))
+ // In this method we do not supply a contextual menu handler at all but only send a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU.
 {
-  DataBrowserTableViewColumnIndex columnIndex;
+  wxArrayDataBrowserItemID itemIDs;
 
-  wxDataViewColumn* dataViewColumnPtr;
-
-  wxDataViewCtrl* dataViewCtrlPtr;
-
-  wxDataViewCustomRenderer* dataViewCustomRendererPtr;
-
-  wxVariant dataToRender;
-
-  dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
-  wxCHECK_RET(dataViewCtrlPtr != NULL,                               _("Pointer to data view control not set correctly."));
-  wxCHECK_RET(dataViewCtrlPtr->GetModel() != NULL,                   _("Pointer to model not set correctly."));
-  wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex) == noErr,_("Could not determine column index."));
-  dataViewColumnPtr = dataViewCtrlPtr->GetColumn(columnIndex);
-  wxCHECK_RET(dataViewColumnPtr != NULL,_("No column for the specified column index existing."));
-  dataViewCustomRendererPtr = dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer());
-  wxCHECK_RET(dataViewCustomRendererPtr != NULL,_("No renderer or invalid renderer type specified for custom data column."));
-
-  wxDataViewItem dataitem( reinterpret_cast<void*>(itemID) );
-  dataViewCtrlPtr->GetModel()->GetValue(dataToRender,dataitem,columnIndex);
-  dataViewCustomRendererPtr->SetValue(dataToRender);
-
- // try to determine the content's size (drawable part):
-  Rect      content;
-  RgnHandle rgn(NewRgn());
-  UInt16    headerHeight;
-
-  if (this->GetRegion(kControlContentMetaPart,rgn) == noErr)
-    GetRegionBounds(rgn,&content);
-  else
-    this->GetRect(&content);
-  ::DisposeRgn(rgn);
- // space for the header
-  this->GetHeaderButtonHeight(&headerHeight);
-  content.top += headerHeight;
- // extra space for the frame (todo: do not how to determine the space automatically from the control)
-  content.top    += 5;
-  content.left   += 5;
-  content.right  -= 3;
-  content.bottom -= 3;
- // extra space for the scrollbars:
-  content.bottom -= wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
-  content.right  -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
+  wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
 
-  wxDC *dc = dataViewCustomRendererPtr->GetDC();
-  
-  wxRect cellrect( static_cast<int>(rectangle->left),
-                   static_cast<int>(rectangle->top+2),
-                   static_cast<int>(1+rectangle->right-rectangle->left),
-                   static_cast<int>(rectangle->bottom-rectangle->top) );
-                   
-  bool is_active = IsControlActive( this->m_controlRef );
-  if (state == kDataBrowserItemIsSelected)
-  {
-      
-      wxColour col( wxMacCreateCGColorFromHITheme( (is_active) ? 
-                             kThemeBrushAlternatePrimaryHighlightColor
-                             : kThemeBrushSecondaryHighlightColor ) );
-      
-      wxRect rect = cellrect;
-      Rect itemrect;
-      GetDataBrowserItemPartBounds( this->m_controlRef, itemID, propertyID,
-         kDataBrowserPropertyEnclosingPart, &itemrect );
-      rect.x = itemrect.left;
-      rect.width = itemrect.right-itemrect.left+1;
-      
-      wxBrush selBrush( col );
-      wxPen oldpen( dc->GetPen() );
-      wxBrush oldbrush( dc->GetBrush() );
-      dc->SetPen( *wxTRANSPARENT_PEN );
-      dc->SetBrush( selBrush );
-      dc->DrawRectangle(rect);
-      dc->SetBrush( oldbrush );
-      dc->SetPen( oldpen );
-  }
 
-  wxDataViewModel *model = dataViewCtrlPtr->GetModel();
-  if ((columnIndex == 0) || !model->IsContainer(dataitem) || model->HasContainerColumns(dataitem))
-  {  
-      // make sure that 'Render' can draw only in the allowed area:
-      dc->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
-      (void) (dataViewCustomRendererPtr->Render( cellrect, dc, 
-                                            ((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0)));
-      dc->DestroyClippingRegion(); // probably not necessary
-  }
+  wxCHECK_RET(dataViewCtrlPtr != NULL,_("wxWidget control pointer is not a data view pointer"));
+ // initialize parameters so that no context menu will be displayed automatically by the native data browser:
+  *menu           = NULL;
+  *helpType       = kCMHelpItemNoHelp;
+  *helpItemString = NULL;
+ // create information for a context menu event:
+  wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
   
-  dataViewCustomRendererPtr->SetDC(NULL);
-} /* wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemState, Rect const*, SInt16, Boolean) */
+  dataViewEvent.SetModel(dataViewCtrlPtr->GetModel());
+ // get the item information;
+ // theoretically more than one ID can be returned but the event can only handle one item, therefore all item related data is using the data of the first item in the array:
+  if (this->GetSelectedItemIDs(itemIDs) > 0)
+    dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemIDs[0])));
+ // finally send the equivalent wxWidget event:
+  dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef*, UInt32*, CFStringRef*, AEDesc*) */
 
 OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue)
 {
@@ -668,7 +660,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
   {
    // variable definitions:
     wxDataViewCtrl* dataViewCtrlPtr;
-
+    
     dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
     wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
     if (dataViewCtrlPtr->IsDeleting())
@@ -679,7 +671,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
       DataBrowserTableViewColumnIndex columnIndex;
       OSStatus                        errorStatus;
       wxDataViewColumn*               dataViewColumnPtr;
-
+      
       wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
       errorStatus = this->GetColumnIndex(propertyID,&columnIndex);
       wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Could not determine column index"));
@@ -724,7 +716,11 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
             if (errorStatus == noErr)
             {
              // variable definitions and initializations:
+#if wxCHECK_VERSION(2,9,0)
               wxCFStringRef modifiedString(stringReference);
+#else
+              wxMacCFStringHolder modifiedString(stringReference);
+#endif
               wxVariant           modifiedData(modifiedString.AsString());
 
               if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)))
@@ -748,7 +744,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
       wxVariant         variant;
       wxDataViewColumn* dataViewColumnPtr;
       wxDataViewCtrl*   dataViewCtrlPtr;
-
+      
       dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
       wxCHECK_MSG(dataViewCtrlPtr             != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
       wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
@@ -772,15 +768,16 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
           {
            // variable definitions:
             wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
-
+            
             wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
            // initialize wxWidget event:
             wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
-
+            
             dataViewEvent.SetEventObject(dataViewCtrlPtr);
-            dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+            dataViewEvent.SetItem       (wxDataViewItem(reinterpret_cast<void*>(itemID)));
+            dataViewEvent.SetModel      (dataViewCtrlPtr->GetModel());
            // finally send the equivalent wxWidget event:
-            dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+            dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
            // opening the container is allowed if not vetoed:
             return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
           } /* block */
@@ -788,15 +785,16 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
           {
            // variable definitions:
             wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
-
+            
             wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
            // initialize wxWidget event:
             wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
 
             dataViewEvent.SetEventObject(dataViewCtrlPtr);
-            dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
+            dataViewEvent.SetItem       (wxDataViewItem(reinterpret_cast<void*>(itemID)));
+            dataViewEvent.SetModel      (dataViewCtrlPtr->GetModel());
            // finally send the equivalent wxWidget event:
-            dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+            dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
            // opening the container is allowed if not vetoed:
             return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed());
           } /* block */
@@ -804,7 +802,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
           {
            // variable definition:
             wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
-
+            
             wxCHECK_MSG(dataViewCtrlPtr             != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
             wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
             return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewCtrlPtr->GetModel()->IsContainer(wxDataViewItem(reinterpret_cast<void*>(itemID))));
@@ -827,56 +825,59 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
     switch (message)
     {
       case kDataBrowserContainerClosed:
+        dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
         {
          // initialize wxWidget event:
           wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
-
+          
           dataViewEvent.SetEventObject(dataViewCtrlPtr);
           dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
          // finally send the equivalent wxWidget event:
-          dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
         } /* block */
         break;
       case kDataBrowserContainerOpened:
+        dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
         {
          // initialize wxWidget event:
           wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
-
+          
           dataViewEvent.SetEventObject(dataViewCtrlPtr);
           dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
          // finally send the equivalent wxWidget event:
-          dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
          // add children to the expanded container:
           dataViewCtrlPtr->AddChildrenLevel(wxDataViewItem(reinterpret_cast<void*>(itemID)));
         } /* block */
         break;
       case kDataBrowserEditStarted:
+        dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
         {
          // initialize wxWidget event:
-          DataBrowserPropertyID propertyID;
+          DataBrowserPropertyID propertyID;  
           wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition
-
+          
           dataViewEvent.SetEventObject(dataViewCtrlPtr);
           dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
           if (this->GetPropertyID(itemData,&propertyID) == noErr)
           {
            // variable definition and initialization:
             DataBrowserTableViewColumnIndex columnIndex;
-
+            
             wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
             dataViewEvent.SetColumn(columnIndex);
-            dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));
+            dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));          
           } /* if */
          // finally send the equivalent wxWidget event:
-          dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
         } /* block */
         break;
       case kDataBrowserEditStopped:
         {
          // initialize wxWidget event:
-          DataBrowserPropertyID propertyID;
+          DataBrowserPropertyID propertyID;  
           wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
-
+          
           dataViewEvent.SetEventObject(dataViewCtrlPtr);
           dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
           if (this->GetPropertyID(itemData,&propertyID) == noErr)
@@ -886,16 +887,18 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
 
             wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
             dataViewEvent.SetColumn(columnIndex);
-            dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));
+            dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));          
           } /* if */
          // finally send the equivalent wxWidget event:
-          dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
         } /* block */
         break;
       case kDataBrowserItemAdded:
-        break; // not used anymore
+        dataViewCtrlPtr->FinishCustomItemEditing();
+        break;
       case kDataBrowserItemDeselected:
-        break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged
+        dataViewCtrlPtr->FinishCustomItemEditing();
+        break;
       case kDataBrowserItemDoubleClicked:
         {
          // initialize wxWidget event:
@@ -904,11 +907,12 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
           dataViewEvent.SetEventObject(dataViewCtrlPtr);
           dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
          // finally send the equivalent wxWidget event:
-          dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
         } /* block */
         break;
       case kDataBrowserItemRemoved:
-        break; // not used anymore
+        dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary)
+        break;
       case kDataBrowserItemSelected:
         break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged
       case kDataBrowserSelectionSetChanged:
@@ -919,11 +923,15 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
           dataViewEvent.SetEventObject(dataViewCtrlPtr);
           dataViewEvent.SetModel      (dataViewCtrlPtr->GetModel());
          // finally send the equivalent wxWidget event:
-          dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
         } /* block */
         break;
+      case kDataBrowserTargetChanged: // no idea if this notification is ever sent
+        break;
       case kDataBrowserUserStateChanged:
         {
+         // finish custom item editing if necessary:
+          dataViewCtrlPtr->FinishCustomItemEditing();
          // update column widths:
           for (size_t i=0; i<dataViewCtrlPtr->GetColumnCount(); ++i)
           {
@@ -931,18 +939,18 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
             wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumn(i);
            // variable definition:
             UInt16 columnWidth;
-
+            
             wxCHECK_RET(this->GetColumnWidth(columnPtr->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
             columnPtr->SetWidthVariable(columnWidth);
           } /* for */
-         // update order status:
+         // update sorting orders:
           DataBrowserPropertyID propertyID; // variable definition
 
           if ((this->GetSortProperty(&propertyID) == noErr) && (propertyID >= kMinPropertyID))
           {
             DataBrowserSortOrder            sortOrder;
             DataBrowserTableViewColumnIndex columnIndex;
-
+            
             if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetColumnIndex(propertyID,&columnIndex) == noErr))
             {
              // variable definition and initialization:
@@ -960,7 +968,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
                 dataViewEvent.SetColumn(columnIndex);
                 dataViewEvent.SetDataViewColumn(columnPtr);
                // finally send the equivalent wxWidget event:
-                dataViewCtrlPtr->HandleWindowEvent(dataViewEvent);
+                dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
               } /* if */
             } /* if */
           } /* if */
@@ -969,5 +977,108 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
     } /* switch */
 } /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
 
+void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice)
+{
+  wxDataViewColumn* dataViewColumnPtr;
+
+  wxDataViewCtrl* dataViewCtrlPtr;
+  
+  wxDataViewCustomRenderer* dataViewCustomRendererPtr;
+
+  wxVariant dataToRender;
+
+
+  dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
+  wxCHECK_RET(dataViewCtrlPtr != NULL,            _("Pointer to data view control not set correctly."));
+  wxCHECK_RET(dataViewCtrlPtr->GetModel() != NULL,_("Pointer to model not set correctly."));
+  dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
+  wxCHECK_RET(dataViewColumnPtr != NULL,_("No column for the specified column index existing."));
+  dataViewCustomRendererPtr = dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer());
+  wxCHECK_RET(dataViewCustomRendererPtr != NULL,_("No renderer or invalid renderer type specified for custom data column."));
+  dataViewCtrlPtr->GetModel()->GetValue(dataToRender,wxDataViewItem(reinterpret_cast<void*>(itemID)),dataViewColumnPtr->GetModelColumn());
+  dataViewCustomRendererPtr->SetValue(dataToRender);
+
+ // try to determine the content's size (drawable part):
+  Rect      content;
+  RgnHandle rgn(NewRgn());
+  UInt16    headerHeight;
+
+  if (this->GetRegion(kControlContentMetaPart,rgn) == noErr)
+    GetRegionBounds(rgn,&content);
+  else
+    this->GetRect(&content);
+  ::DisposeRgn(rgn);
+ // space for the header
+  this->GetHeaderButtonHeight(&headerHeight);
+  content.top += headerHeight;
+ // extra space for the frame (todo: do not how to determine the space automatically from the control)
+  content.top    += 5;
+  content.left   += 5;
+  content.right  -= 3;
+  content.bottom -= 3;
+ // extra space for the scrollbars: 
+  content.bottom -= wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
+  content.right  -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
+
+ // make sure that 'Render' can draw only in the allowed area:  
+  dataViewCustomRendererPtr->GetDC()->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1);
+  (void) (dataViewCustomRendererPtr->Render(wxRect(static_cast<int>(rectangle->left),static_cast<int>(rectangle->top),
+                                                   static_cast<int>(1+rectangle->right-rectangle->left),static_cast<int>(1+rectangle->bottom-rectangle->top)),
+                                            dataViewCustomRendererPtr->GetDC(),((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0)));
+  dataViewCustomRendererPtr->GetDC()->DestroyClippingRegion(); // probably not necessary
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemState, Rect const*, SInt16, Boolean) */
+
+Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit)
+{
+  return false;
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc(DataBrowserItemID, DataBrowserPropertyID, CFStringRef, Rect*, Boolean*) */
+
+Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserHitTestProc(DataBrowserItemID WXUNUSED(itemID), DataBrowserPropertyID WXUNUSED(property), Rect const* WXUNUSED(theRect), Rect const* WXUNUSED(mouseRect))
+{
+  return true;
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserHitTestProc(DataBrowserItemID, DataBrowserPropertyID, Rect const*, Rect const*) */
+
+DataBrowserTrackingResult wxMacDataViewDataBrowserListViewControl::DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point WXUNUSED(startPt), EventModifiers WXUNUSED(modifiers))
+{
+  wxDataViewColumn* dataViewColumnPtr;
+
+  wxDataViewCtrl* dataViewCtrlPtr;
+  
+  wxDataViewCustomRenderer* dataViewCustomRendererPtr;
+  
+  wxDataViewItem dataViewCustomRendererItem;
+
+
+  dataViewCustomRendererItem = reinterpret_cast<void*>(itemID);
+  wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item"));
+  dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
+  wxCHECK_MSG(dataViewCtrlPtr != NULL,kDataBrowserNothingHit,_("Pointer to data view control not set correctly."));
+  dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
+  wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing."));
+  dataViewCustomRendererPtr = dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer());
+  wxCHECK_MSG(dataViewCustomRendererPtr != NULL,kDataBrowserNothingHit,_("No renderer or invalid renderer type specified for custom data column."));
+ // if the currently edited item is identical to the to be edited nothing is done (this hit should only be handled in the control itself):
+  if (dataViewCtrlPtr->GetCustomRendererItem() == dataViewCustomRendererItem)
+    return kDataBrowserContentHit;
+ // an(other) item is going to be edited and therefore the current editing - if existing - has to be finished:
+  if (dataViewCtrlPtr->GetCustomRendererPtr() != NULL)
+  {
+    dataViewCtrlPtr->GetCustomRendererPtr()->FinishEditing();
+    dataViewCtrlPtr->SetCustomRendererItem(wxDataViewItem());
+    dataViewCtrlPtr->SetCustomRendererPtr (NULL);
+  } /* if */
+ // check if renderer has got a valid editor control for editing; if this is the case start editing of the new item:
+  if (dataViewCustomRendererPtr->HasEditorCtrl())
+  {
+   // variable definition:
+    wxRect wxRectangle;
+    
+    ::wxMacNativeToRect(theRect,&wxRectangle);
+    dataViewCustomRendererPtr->StartEditing(dataViewCustomRendererItem,wxRectangle);
+    dataViewCtrlPtr->SetCustomRendererItem(dataViewCustomRendererItem);
+    dataViewCtrlPtr->SetCustomRendererPtr (dataViewCustomRendererPtr);
+  } /* if */
+  return kDataBrowserContentHit;
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserTrackingProc(DataBrowserItemID, DataBrowserPropertyID, Rect const*, Point, EventModifiers) */
 
-#endif // wxUSE_DATAVIEWCTRL && !wxUSE_GENERICDATAVIEWCTRL
+#endif // wxUSE_GENERICDATAVIEWCTRL
diff --git a/src/mac/carbon/dataview.cpp b/src/mac/carbon/dataview.cpp
index 9b4a88fff9..e54cc745f7 100644
--- a/src/mac/carbon/dataview.cpp
+++ b/src/mac/carbon/dataview.cpp
@@ -84,7 +84,11 @@ static pascal OSStatus wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
         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);
+#endif
         return ::CallNextEventHandler(handler,EventReference);
       } /* if */
       else
@@ -113,29 +117,18 @@ static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDa
   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->IsSortable())
-    columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn;
-#if 0
-  if (columnPtr->IsMovable())
+  if (columnPtr->IsReorderable())
     columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn;
-#endif
-  if (columnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE)
-    columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable;
-  if ((columnDescription.propertyDesc.propertyType == kDataBrowserTextType) ||
-      (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
-      (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType))
-    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;
   if (columnPtr->IsResizeable())
   {
     columnDescription.headerBtnDesc.minimumWidth = 0;
@@ -146,6 +139,20 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
     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)
@@ -169,10 +176,14 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
   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, wxCFStringRef const&) */
+} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
 
 //-----------------------------------------------------------------------------
 // local function pointers
@@ -238,7 +249,11 @@ public:
       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);
+#endif
      // done
       return true;
     } /* if */
@@ -270,7 +285,11 @@ public:
       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:
@@ -357,7 +376,11 @@ public:
       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);
+#endif
      // done
       return true;
     } /* if */
@@ -450,7 +473,7 @@ 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) ? *wxWHITE : view->GetForegroundColour();
+    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));
 }
@@ -495,15 +518,15 @@ wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const& varianttype, wxDa
 
 bool wxDataViewTextRenderer::Render(void)
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-  {
-   // variable definition:
-    wxCFStringRef 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) */
 
 WXDataBrowserPropertyType wxDataViewTextRenderer::GetPropertyType(void) const
@@ -534,19 +557,25 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString const& varianttype,
 }
 
 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.GetIconRef()) == noErr);
-    else
-      return true;
-  } /* 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
-    return false;
+    return true;
 } /* wxDataViewBitmapRenderer::Render(void) */
 
 WXDataBrowserPropertyType wxDataViewBitmapRenderer::GetPropertyType(void) const
@@ -567,26 +596,24 @@ wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString const& variantty
 
 bool wxDataViewIconTextRenderer::Render(void)
 {
-  if (this->GetValue().GetType() == this->GetVariantType())
-  {
-   // variable definition:
-    wxDataViewIconText iconText;
-    
-    iconText << this->GetValue();
+  wxCHECK_MSG(this->GetValue().GetType() == this->GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << this->GetValue().GetType());
 
-   // variable definition:
-    wxCFStringRef cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+ // variable definition:
+  wxDataViewIconText iconText;
+  
+  iconText << this->GetValue();
 
-    if (iconText.GetIcon().IsOk())
-    {
-       if (::SetDataBrowserItemDataIcon(this->GetDataReference(),MAC_WXHICON(iconText.GetIcon().GetHICON())) != noErr)
-          return false;
-    }
-    
-    return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr);
-  } /* if */
-  else
-    return false;
+ // 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
@@ -608,10 +635,8 @@ wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString const& varianttype,
 
 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) */
 
 WXDataBrowserPropertyType wxDataViewToggleRenderer::GetPropertyType(void) const
@@ -632,12 +657,10 @@ wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString const& label, wx
 
 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) */
 
 WXDataBrowserPropertyType wxDataViewProgressRenderer::GetPropertyType(void) const
@@ -658,10 +681,8 @@ wxDataViewDateRenderer::wxDataViewDateRenderer(wxString const& varianttype, wxDa
 
 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) */
 
 WXDataBrowserPropertyType wxDataViewDateRenderer::GetPropertyType(void) const
@@ -676,14 +697,14 @@ 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_ascending(true),
+                 :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)
-                 :wxDataViewColumnBase(bitmap,cell,model_column,width,wxALIGN_CENTER,flags), m_ascending(true),
+                 :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)
 {
@@ -744,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())
+#if wxCHECK_VERSION(2,9,0)
         headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetIconRef();
+#else
+        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."));
@@ -754,9 +779,10 @@ void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap)
 
 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)
@@ -805,38 +831,59 @@ void wxDataViewColumn::SetMinWidth(int minWidth)
   } /* 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)
 {
- // 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:
+    DataBrowserPropertyFlags                       flags;
     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) */
 
@@ -882,7 +929,11 @@ void wxDataViewColumn::SetTitle(wxString const& title)
     {
      // 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()));
+#endif
       
       wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
       headerDescription.titleString = cfTitle;
@@ -918,9 +969,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn,wxDataViewColumnBase)
 #pragma mark -
 void wxDataViewCtrl::Init(void)
 {
-  this->m_Deleting      = false;
-  this->m_macIsUserPane = false;
-  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 )
@@ -961,7 +1013,11 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr)
 
   wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
+#if wxCHECK_VERSION(2,9,0)
   wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+#else
+  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+#endif
 
 
  // first, some error checking:
@@ -1077,7 +1133,11 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
 
   wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
+#if wxCHECK_VERSION(2,9,0)
   wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+#else
+  wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
+#endif
 
 
  // first, some error checking:
@@ -1335,6 +1395,16 @@ void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const& parentItem)
 #endif
 } /* 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:
@@ -1354,7 +1424,7 @@ void wxDataViewCtrl::DoSetExpanderColumn(void)
    // variable definition and initialization:
     wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
 
-    (void) MacDataViewListCtrlPtr->SetDisclosureColumn(this->GetExpanderColumn()->GetPropertyID());
+    (void) MacDataViewListCtrlPtr->SetDisclosureColumn(this->GetExpanderColumn()->GetPropertyID(),false); // second parameter explicitely passed to ensure that arrow is centered
   } /* if */
 } /* wxDataViewCtrl::DoSetExpanderColumn(void) */
 
-- 
2.50.0

