]> git.saurik.com Git - wxWidgets.git/commitdiff
Added initial OS X implementation of the wxDataViewCtrl
authorRobert Roebling <robert@roebling.de>
Wed, 6 Jun 2007 23:40:24 +0000 (23:40 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 6 Jun 2007 23:40:24 +0000 (23:40 +0000)
   in its current tabular form.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/dataview.h
include/wx/mac/carbon/databrow.h [new file with mode: 0644]
include/wx/mac/carbon/dataview.h [new file with mode: 0644]
include/wx/mac/dataview.h [new file with mode: 0644]
src/common/datavcmn.cpp
src/mac/carbon/databrow.cpp [new file with mode: 0644]
src/mac/carbon/dataview.cpp [new file with mode: 0644]

index c31e465d2c3195c7608a19ca608ba5327a2a0dc4..22798b1842477e4f014bd1d938fa40e8ad65c51b 100644 (file)
@@ -26,7 +26,6 @@
     // for testing
     // #define wxUSE_GENERICDATAVIEWCTRL 1
 #elif defined(__WXMAC__)
-    #define wxUSE_GENERICDATAVIEWCTRL 1
 #else
     #define wxUSE_GENERICDATAVIEWCTRL 1
 #endif
@@ -544,6 +543,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED, -1)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
+    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
     // notifications from the model to the control
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ROW_APPENDED, -1)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ROW_PREPENDED, -1)
@@ -567,6 +567,7 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
 #define EVT_DATAVIEW_ROW_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_ACTIVATED, id, fn)
 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
+#define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
 
 #define EVT_DATAVIEW_MODEL_ROW_APPENDED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ROW_APPENDED, id, fn)
 #define EVT_DATAVIEW_MODEL_ROW_PREPENDED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ROW_PREPENDED, id, fn)
@@ -583,8 +584,7 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
 #elif defined(__WXGTK20__)
     #include "wx/gtk/dataview.h"
 #elif defined(__WXMAC__)
-    // TODO
-    // #include "wx/mac/dataview.h"
+    #include "wx/mac/dataview.h"
 #else
     #include "wx/generic/dataview.h"
 #endif
diff --git a/include/wx/mac/carbon/databrow.h b/include/wx/mac/carbon/databrow.h
new file mode 100644 (file)
index 0000000..fb1bb27
--- /dev/null
@@ -0,0 +1,306 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        include/mac/carbon/databrow.h
+// Purpose:     Classes and functions for the Carbon data browser
+// Author:      
+// Modified by:
+// Created:     2007-05-18
+// RCS-ID:      $Id$
+// Copyright:   (c)
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATABROW_H_
+#define _WX_DATABROW_H_
+
+#include "wx/defs.h"
+
+#ifdef __DARWIN__
+#    include <Carbon/Carbon.h>
+#else
+#    include <Debugging.h>
+#    include <Appearance.h>
+#    include <Controls.h>
+#    include <ControlDefinitions.h>
+#    include <LowMem.h>
+#    include <Gestalt.h>
+#    include <CoreServices.h>
+#endif
+
+#if UNIVERSAL_INTERFACES_VERSION < 0x0342
+    #error "please update to Apple's latest universal headers from http://developer.apple.com/sdk/"
+#endif
+
+#ifndef MAC_OS_X_VERSION_10_3
+    #define MAC_OS_X_VERSION_10_3 1030
+#endif
+
+#ifndef MAC_OS_X_VERSION_10_4
+    #define MAC_OS_X_VERSION_10_4 1040
+#endif
+
+#ifndef MAC_OS_X_VERSION_10_5
+    #define MAC_OS_X_VERSION_10_5 1050
+#endif
+
+#ifdef __WXMAC_CARBON__
+#  include "wx/mac/corefoundation/cfstring.h"
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+typedef UInt32 URefCon;
+typedef SInt32 SRefCon;
+#endif
+
+#if wxUSE_GUI
+
+#include "wx/hashmap.h"
+
+#include "wx/mac/private.h"
+
+WX_DEFINE_ARRAY_SIZE_T(size_t,wxArrayDataBrowserItemID);
+
+// ============================================================================
+// DataBrowser Wrapper
+// ============================================================================
+//
+// basing on DataBrowserItemIDs
+//
+
+// data browser's property IDs have a reserved ID range from 0 - 1023
+// therefore, the first usable property ID is 'kMinPropertyID'
+DataBrowserPropertyID const kMinPropertyID = 1024;
+
+class wxMacDataBrowserTableViewControl : public wxMacControl
+{
+public:
+//
+// constructors / destructor
+//
+  wxMacDataBrowserTableViewControl(wxWindow* peer, const wxPoint& pos, const wxSize& size, long style);
+  wxMacDataBrowserTableViewControl(void)
+  {
+  }
+
+//
+// callback handling
+//
+  OSStatus SetCallbacks      (DataBrowserCallbacks const*       callbacks);
+  OSStatus SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks);
+
+//
+// header handling
+//
+  OSStatus GetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc) const;
+
+  OSStatus SetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc);
+
+//
+// layout handling
+//
+  OSStatus AutoSizeColumns();
+
+  OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false)
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  OSStatus GetAttributes        (OptionBits* attributes);
+#endif
+  OSStatus GetColumnWidth       (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels
+  OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels
+  OSStatus GetDefaultRowHeight  (UInt16 * height ) const;
+  OSStatus GetHeaderButtonHeight(UInt16 *height );
+  OSStatus GetRowHeight         (DataBrowserItemID item , UInt16 *height) const;
+  OSStatus GetScrollPosition    (UInt32* top, UInt32 *left) const;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  OSStatus SetAttributes (OptionBits attributes);
+#endif
+  OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels
+  OSStatus SetDefaultColumnWidth( UInt16 width );
+  OSStatus SetDefaultRowHeight( UInt16 height );
+  OSStatus SetHasScrollBars( bool horiz, bool vert );
+  OSStatus SetHeaderButtonHeight( UInt16 height );
+  OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle );
+  OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height);
+  OSStatus SetScrollPosition( UInt32 top , UInt32 left );
+
+//
+// column handling
+//
+  OSStatus GetColumnCount   (UInt32* numColumns) const;
+  OSStatus GetColumnID      (DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id);
+  OSStatus GetFreePropertyID(DataBrowserPropertyID* id) const; // this method returns a property id that is valid and currently not used; if it cannot be found 'errDataBrowerPropertyNotSupported' is returned
+  OSStatus GetPropertyColumn(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const;
+  OSStatus GetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags ) const;
+
+  OSStatus IsUsedPropertyID(DataBrowserPropertyID propertyID) const; // checks if passed property id is used by the control; no error is returned if the id exists
+
+  OSStatus RemoveColumn(DataBrowserTableViewColumnIndex position);
+
+  OSStatus SetColumnPosition  (DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position);
+  OSStatus SetDisclosureColumn(DataBrowserPropertyID property, Boolean expandableRows );
+  OSStatus SetPropertyFlags   (DataBrowserPropertyID property, DataBrowserPropertyFlags flags );
+
+//
+// item handling
+//
+  OSStatus AddItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // adds a single item
+  {
+    return this->AddItems(container,1,itemID,kDataBrowserItemNoProperty);
+  }
+  OSStatus AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); // adds items to the data browser
+
+  OSStatus GetFreeItemID(DataBrowserItemID* id) const; // this method returns an item id that is valid and currently not used; if it cannot be found 'errDataBrowserItemNotAdded' is returned
+  OSStatus GetItemCount (ItemCount* numItems) const
+  {
+    return this->GetItemCount(kDataBrowserNoItem,true,kDataBrowserItemAnyState,numItems);
+  }
+  OSStatus GetItemCount (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const;
+  OSStatus GetItemID    (DataBrowserTableViewRowIndex row, DataBrowserItemID * item) const;
+  OSStatus GetItems     (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const;
+  OSStatus GetItemRow   (DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const;
+
+  OSStatus IsUsedItemID(DataBrowserItemID itemID) const; // checks if the passed id is in use
+
+  OSStatus RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const;
+
+  OSStatus RemoveItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // removes a single item
+  {
+    return this->RemoveItems(container,1,itemID,kDataBrowserItemNoProperty);
+  }
+  OSStatus RemoveItems(void) // removes all items
+  {
+    return this->RemoveItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty);
+  }
+  OSStatus RemoveItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty);
+
+  OSStatus UpdateItems(void) // updates all items
+  {
+    return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserNoItem);
+  }
+  OSStatus UpdateItems(DataBrowserItemID const* item) // updates all columns of item
+  {
+    return this->UpdateItems(kDataBrowserNoItem,1,item,kDataBrowserItemNoProperty,kDataBrowserNoItem);
+  }
+  OSStatus UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const;
+
+//
+// item selection
+//
+  size_t   GetSelectedItemIDs(wxArrayDataBrowserItemID& itemIDs) const; // returns the number of selected item and the item IDs in the array
+  OSStatus GetSelectionAnchor(DataBrowserItemID *first, DataBrowserItemID *last) const;
+  OSStatus GetSelectionFlags (DataBrowserSelectionFlags* flags) const;
+
+  bool IsItemSelected(DataBrowserItemID item) const;
+
+  OSStatus SetSelectionFlags(DataBrowserSelectionFlags flags);
+  OSStatus SetSelectedItems (UInt32 numItems, DataBrowserItemID const* itemIDs, DataBrowserSetOption operation);
+
+//
+// item sorting
+//
+  OSStatus GetSortOrder   (DataBrowserSortOrder* order) const;
+  OSStatus GetSortProperty(DataBrowserPropertyID* column) const;
+
+  OSStatus SetSortOrder   (DataBrowserSortOrder  order);
+  OSStatus SetSortProperty(DataBrowserPropertyID column);
+
+protected :
+//
+// 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);
+
+  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
+//
+    DECLARE_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl)
+};
+
+// ============================================================================
+// Databrowser class for the list view control
+// ============================================================================
+//
+class wxMacDataBrowserListViewControl : public wxMacDataBrowserTableViewControl
+{
+public:
+//
+// constructors / destructor
+//
+  wxMacDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) : wxMacDataBrowserTableViewControl(peer,pos,size,style)
+  {
+  }
+
+//
+// column handling
+//
+  OSStatus AddColumn(DataBrowserListViewColumnDesc *columnDesc, DataBrowserTableViewColumnIndex position);
+
+protected:
+private:
+};
+
+
+// ============================================================================
+// Databrowser class for the data view list control model
+// ============================================================================
+//
+
+//
+// Hash maps used by the data browser for the data view model
+//
+WX_DECLARE_HASH_MAP(DataBrowserItemID,unsigned long,wxIntegerHash,wxIntegerEqual,ItemIDRowNumberHashMap); // stores for each item ID the model's row number
+
+class wxMacDataViewDataBrowserListViewControl : public wxMacDataBrowserListViewControl
+{
+public:
+//
+// constructors / destructor
+  wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style);
+
+//
+// item ID and model matching
+//
+  void ClearItemIDRowPairs(void); // removes all ID row pairs
+
+  bool DeleteItemIDRowPair(DataBrowserItemID itemID); // if the id has been removed, 'true' is returned, 'false' is returned if the id did not exist or another error occurred
+
+  bool GetRowIndex(unsigned long& rowIndex, DataBrowserItemID itemID) const; // returns 'true' and the rowIndex if the id has been found in the map, otherwise 'false' is returned and rowIndex remains untouched
+
+  bool InsertItemIDRowPair(DataBrowserItemID itemID, unsigned long rowIndex); // the pair will only be inserted if the item ID does not exist before the call
+
+  void RenumberItemIDRowIndices         (unsigned int* newIndices);        // for each item ID - row index pair the row index is changed
+  void RenumberItemIDRowIndicesDeletion (unsigned long decreaseFromIndex); // decreases all row indices by one that are equal or larger than 'decreaseFromIndex'
+  void RenumberItemIDRowIndicesInsertion(unsigned long increaseFromIndex); // increases all row indices by one that are equal or larger than 'increaseFromIndex'
+
+  void ReverseRowIndexNumbering(void); // reverses the order of the indices
+
+protected:
+//
+// callback functions (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);
+
+private:
+//
+// variables
+//
+  ItemIDRowNumberHashMap m_itemIDRowNumberMap; // contains for each data browser ID the corresponding line number in the model
+};
+
+typedef wxMacDataViewDataBrowserListViewControl* wxMacDataViewDataBrowserListViewControlPointer;
+
+
+#endif // WX_GUI
+  
+#endif // _WX_DATABROW_H_
diff --git a/include/wx/mac/carbon/dataview.h b/include/wx/mac/carbon/dataview.h
new file mode 100644 (file)
index 0000000..935aa9e
--- /dev/null
@@ -0,0 +1,555 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/mac/carbon/dataview.h
+// Purpose:     wxDataViewCtrl native implementation header
+// Author:      
+// Id:          $Id$
+// Copyright:   (c) 2007
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __MACCARBONDATAVIEWCTRL_H__
+#define __MACCARBONDATAVIEWCTRL_H__
+
+#include <Carbon/carbon.h>
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/control.h"
+#include "wx/scrolwin.h"
+#include "wx/icon.h"
+
+// ---------------------------------------------------------
+// classes
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCtrl;
+
+// ---------------------------------------------------------
+// wxDataViewRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
+{
+public:
+//
+// constructors / destructor
+//
+  wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited methods from wxDataViewRendererBase
+//
+  virtual int GetAlignment(void) const
+  {
+    return this->m_alignment;
+  }
+  virtual wxDataViewCellMode GetMode(void) const
+  {
+    return this->m_mode;
+  }
+  virtual bool GetValue(wxVariant& value) const
+  {
+    value = this->m_value;
+    return true;
+  }
+
+  virtual void SetAlignment(int WXUNUSED(align)) // is always identical to the header alignment
+  {
+  }
+  virtual void SetMode(wxDataViewCellMode mode);
+  virtual bool SetValue(wxVariant const& newValue)
+  {
+    this->m_value = newValue;
+    return true;
+  }
+
+//
+// implementation
+//
+  DataBrowserItemDataRef GetDataReference(void) const
+  {
+    return this->m_dataReference;
+  }
+  wxVariant const& GetValue(void) const
+  {
+    return this->m_value;
+  }
+
+  virtual DataBrowserPropertyType GetPropertyType(void) const = 0;
+
+  virtual bool Render(void) = 0; // a call to the appropriate data browser function filling the data reference with the stored datum;
+                                 // returns 'true' if the data value could be rendered, 'false' otherwise
+
+  void SetDataReference(DataBrowserItemDataRef const& newDataReference)
+  {
+    this->m_dataReference = newDataReference;
+  }
+
+private:
+//
+// variables
+//
+  DataBrowserItemDataRef m_dataReference; // data reference of the data browser; the data will be assigned to this reference during rendering
+
+  int m_alignment; // contains the alignment flags
+
+  wxDataViewCellMode m_mode; // storing the mode that determines how the cell is going to be shown
+
+  wxVariant m_value; // value that is going to be rendered
+
+//
+// wxWidget internal stuff
+//
+  DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewCustomRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
+{
+public:
+//
+// constructors / destructor
+//
+  wxDataViewCustomRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+  
+  virtual ~wxDataViewCustomRenderer(void);
+
+//
+// methods handling render space
+//
+  virtual wxSize GetSize() const = 0;
+
+//
+// methods handling user actions
+// 
+  virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
+
+  virtual bool Activate(wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row))
+  {
+    return false;
+  }
+
+  virtual bool LeftClick(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row))
+  {
+    return false;
+  }
+
+  virtual bool RightClick(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row))
+  {
+    return false;
+  }
+
+  virtual bool StartDrag(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewListModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row))
+  {
+    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(unsigned int WXUNUSED(row), wxRect WXUNUSED(labelRect)) 
+  {
+    return false;
+  }
+  
+//
+// device context handling
+//
+  virtual wxDC* GetDC(void); // creates a device context and keeps it
+
+//
+// implementation
+//
+  virtual bool Render(void); // declared in wxDataViewRenderer but will not be used here, therefore calling this function will
+                             // return 'false' without having done anything
+
+  virtual DataBrowserPropertyType GetPropertyType(void) const
+  {
+    return kDataBrowserCustomType;
+  }
+
+  void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
+
+protected:
+private:
+//
+// variables
+//
+  wxControl* m_editorCtrlPtr; // pointer to an in-place editor control
+
+  wxDC* m_DCPtr;
+
+//
+// wxWidget internal stuff
+//
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
+{
+public:
+//
+// constructors / destructor
+//
+    wxDataViewTextRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited functions from wxDataViewRenderer
+//
+  virtual bool Render(void);
+
+//
+// implementation
+//
+  virtual DataBrowserPropertyType GetPropertyType(void) const
+  {
+    return kDataBrowserTextType;
+  }
+
+protected:
+private:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
+{
+public:
+//
+// constructors / destructor
+//
+  wxDataViewBitmapRenderer(wxString const& varianttype=wxT("wxBitmap"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited functions from wxDataViewRenderer
+//
+  virtual bool Render(void);
+
+//
+// implementation
+//
+  virtual DataBrowserPropertyType GetPropertyType(void) const
+  {
+    return kDataBrowserIconType;
+  }
+
+protected:
+private:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
+{
+public:
+  wxDataViewToggleRenderer(wxString const& varianttype = wxT("bool"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited functions from wxDataViewRenderer
+//
+  virtual bool Render(void);
+
+//
+// implementation
+//
+  virtual DataBrowserPropertyType GetPropertyType(void) const
+  {
+    return kDataBrowserCheckboxType;
+  }
+
+protected:
+private:
+  DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
+{
+public:
+  wxDataViewProgressRenderer(wxString const& label = wxEmptyString, wxString const& varianttype=wxT("long"),
+                             wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited functions from wxDataViewRenderer
+//
+  virtual bool Render(void);
+
+//
+// implementation
+//
+  virtual DataBrowserPropertyType GetPropertyType(void) const
+  {
+    return kDataBrowserProgressBarType;
+  }
+
+protected:
+private:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewDateRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
+{
+public:
+  wxDataViewDateRenderer(wxString const& varianttype=wxT("datetime"), wxDataViewCellMode mode=wxDATAVIEW_CELL_ACTIVATABLE, int align=wxDVR_DEFAULT_ALIGNMENT);
+
+//
+// inherited functions from wxDataViewRenderer
+//
+  virtual bool Render(void);
+
+//
+// implementation
+//
+  virtual DataBrowserPropertyType GetPropertyType(void) const
+  {
+    return kDataBrowserDateTimeType;
+  }
+
+protected:
+private:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewColumn
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
+{
+public:
+//
+// constructors / destructor
+//
+  wxDataViewColumn(wxString const& title, wxDataViewRenderer* renderer, unsigned int model_column, int width=80, wxAlignment align=wxALIGN_CENTER,
+                   int flags=wxDATAVIEW_COL_RESIZABLE);
+  wxDataViewColumn(wxBitmap const& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width=80, wxAlignment align=wxALIGN_CENTER,
+                   int flags=wxDATAVIEW_COL_RESIZABLE);
+
+//
+// inherited methods from wxDataViewColumnBase
+//
+  virtual wxAlignment GetAlignment(void) const
+  {
+    return this->m_alignment;
+  }
+  virtual int GetFlags(void) const
+  {
+    return this->m_flags;
+  }
+  virtual int GetMaxWidth(void) const
+  {
+    return this->m_maxWidth;
+  }
+  virtual int GetMinWidth(void) const
+  {
+    return this->m_minWidth;
+  }
+  virtual wxString GetTitle(void) const
+  {
+    return this->m_title;
+  }
+  virtual int GetWidth(void) const
+  {
+    return this->m_width;
+  }
+
+  virtual bool IsHidden(void) const
+  {
+    return false; // not implemented
+  }
+  virtual bool IsResizeable(void) const
+  {
+    return ((this->m_flags & wxDATAVIEW_COL_RESIZABLE) != 0);
+  }
+  virtual bool IsSortable(void) const
+  {
+    return ((this->m_flags & wxDATAVIEW_COL_SORTABLE) != 0);
+  }
+  virtual bool IsSortOrderAscending(void) const
+  {
+    return this->m_ascending;
+  }
+
+  virtual void SetAlignment(wxAlignment align);
+  virtual void SetBitmap   (wxBitmap const& bitmap);
+  virtual void SetFlags    (int flags);
+  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);
+
+//
+// implementation
+//
+  DataBrowserPropertyID GetPropertyID(void) const
+  {
+    return this->m_propertyID;
+  }
+  
+  void SetPropertyID(DataBrowserPropertyID newID)
+  {
+    this->m_propertyID = newID;
+  }
+
+protected:
+private:
+//
+// variables
+//
+  bool m_ascending; // sorting order
+
+  DataBrowserPropertyID m_propertyID; // each column is identified by its unique property ID (NOT by the column index)
+  
+  int m_flags;    // flags for the column
+  int m_maxWidth; // maximum width for the column
+  int m_minWidth; // minimum width for the column
+  int m_width;    // column width
+
+  wxAlignment m_alignment; // column header alignment
+
+  wxString m_title; // column title
+
+ // wxWidget internal stuff:
+  DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
+};
+
+// ---------------------------------------------------------
+// wxDataViewCtrl
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
+{
+public:
+ // Constructors / destructor:
+    wxDataViewCtrl()
+    {
+      this->Init();
+    }
+    wxDataViewCtrl(wxWindow *parent, wxWindowID id, wxPoint const& pos = wxDefaultPosition, wxSize const& size = wxDefaultSize, long style = 0,
+                   wxValidator const& validator = wxDefaultValidator)
+    {
+      this->Init();
+      this->Create(parent, id, pos, size, style, validator );
+    }
+
+    bool Create(wxWindow *parent, wxWindowID id, wxPoint const& pos=wxDefaultPosition, wxSize const& size=wxDefaultSize, long style=0,
+                wxValidator const& validator=wxDefaultValidator);
+
+    virtual bool AppendColumn(wxDataViewColumn* columnPtr);
+
+    virtual bool AssociateModel(wxDataViewListModel* model);
+
+    virtual void SetSelection( int row ); // -1 for unselect
+    virtual void SetSelectionRange( unsigned int from, unsigned int to );
+    virtual void SetSelections( const wxArrayInt& aSelections);
+    virtual void Unselect( unsigned int row );
+    
+    virtual bool IsSelected( unsigned int row ) const;
+    virtual int GetSelection() const;
+    virtual int GetSelections(wxArrayInt& aSelections) const;
+
+    virtual wxControl* GetMainWindow(void) // should disappear as it is not of any use for the native implementation
+    {
+      return this;
+    }
+
+//
+// implementation
+//
+
+ // with CG, we need to get the context from an kEventControlDraw event
+ // unfortunately, the DataBrowser callbacks don't provide the context
+ // and we need it, so we need to set/remove it before and after draw 
+ // events so we can access it in the callbacks.
+  void MacSetDrawingContext(void* context)
+  {
+    this->m_cgContext = context;
+  }
+  void* MacGetDrawingContext(void) const
+  {
+    return this->m_cgContext;
+  }
+
+ // reverts the sorting order of the hash map if wxDataViewColumn data and control data do not match;
+ // wxDataViewColumn data will NOT be updated
+  void ReverseSorting(DataBrowserPropertyID columnID);
+
+protected:
+ // event handling:
+  void OnSize(wxSizeEvent &event);
+
+private:
+ // initializing of local variables:
+  void Init(void);
+
+///
+// variables
+//
+
+  wxDataViewListModelNotifier* m_NotifierPtr; // the notifier is NOT owned by this class but by the associated model
+
+  void* m_cgContext; // pointer to core graphics context
+
+ // wxWidget internal stuff:
+  DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
+  DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
+  DECLARE_EVENT_TABLE()
+};
+
+
+#endif // __MACDATAVIEWCTRL_H__
diff --git a/include/wx/mac/dataview.h b/include/wx/mac/dataview.h
new file mode 100644 (file)
index 0000000..8c19056
--- /dev/null
@@ -0,0 +1,5 @@
+#ifdef __WXMAC_CLASSIC__
+#  error "Native wxDataViewCtrl for classis environment not defined. Please use generic control."
+#else
+#  include "wx/mac/carbon/dataview.h"
+#endif
\ No newline at end of file
index 9d2b2020a59fce2d4dad8bf76b4a99e6f043fb66..e4b770d70468a0e646337d999443ca1e6b641d96 100644 (file)
@@ -614,8 +614,6 @@ wxString wxDataViewSortedListModel::GetColumnType( unsigned int col ) const
     return m_child->GetColumnType( col );
 }
 
-#include "wx/crt.h"
-
 void wxDataViewSortedListModel::GetValue( wxVariant &variant, unsigned int col, unsigned int row ) const
 {
     unsigned int child_row = m_array[row];
@@ -1131,6 +1129,7 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ROW_SELECTED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED)
 
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_APPENDED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_PREPENDED)
diff --git a/src/mac/carbon/databrow.cpp b/src/mac/carbon/databrow.cpp
new file mode 100644 (file)
index 0000000..8f18448
--- /dev/null
@@ -0,0 +1,906 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/mac/carbon/databrow.cpp
+// Purpose:     Classes and functions for the Carbon data browser
+// Author:      
+// Modified by:
+// Created:     2007-05-18
+// RCS-ID:      $Id$
+// Copyright:   (c)
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef wxUSE_GENERICDATAVIEWCTRL
+
+#include <ctype.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include "wx/wxprec.h"
+
+#include "wx/utils.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/toplevel.h"
+    #include "wx/font.h"
+#endif
+
+#include "wx/apptrait.h"
+
+#include "wx/mac/uma.h"
+
+
+#ifdef __DARWIN__
+    #include <Carbon/Carbon.h>
+#else
+    #include <ATSUnicode.h>
+    #include <TextCommon.h>
+    #include <TextEncodingConverter.h>
+#endif
+
+#include "wx/mac/private.h"
+
+#if defined(__MWERKS__) && wxUSE_UNICODE
+#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
+    #include <wtime.h>
+#endif
+#endif
+
+#include <limits>
+
+#include "wx/mac/carbon/databrow.h"
+
+#include "wx/dataview.h"
+
+// ============================================================================
+// DataBrowser Wrapper
+// ============================================================================
+//
+// basing on DataBrowserItemIDs
+//
+
+pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  if (ControlPtr != NULL)
+    return ControlPtr->DataBrowserCompareProc(itemOneID,itemTwoID,sortProperty);
+  else
+    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)
+{
+  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) */
+
+pascal OSStatus wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  if (ControlPtr != NULL)
+    return ControlPtr->DataBrowserGetSetItemDataProc(itemID,property,itemData,getValue);
+  else
+    return errDataBrowserPropertyNotSupported;
+} /* wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef, DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemDataRef, Boolean) */
+
+pascal void wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
+{
+  wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser)));
+
+
+  if (ControlPtr != NULL)
+    ControlPtr->DataBrowserItemNotificationProc(itemID,message,itemData);
+} /* wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc(ControlRef, DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
+
+DataBrowserDrawItemUPP         gDataBrowserTableViewDrawItemUPP         = NULL;
+DataBrowserItemCompareUPP      gDataBrowserTableViewItemCompareUPP      = NULL;
+DataBrowserItemDataUPP         gDataBrowserTableViewItemDataUPP         = NULL;
+DataBrowserItemNotificationUPP gDataBrowserTableViewItemNotificationUPP = NULL;
+
+wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style)
+                                 :wxMacControl(peer)
+{
+  Rect bounds = wxMacGetBoundsForControl(peer,pos,size);
+  OSStatus err = ::CreateDataBrowserControl(MAC_WXHWND(peer->MacGetTopLevelWindowRef()),&bounds,kDataBrowserListView,&(this->m_controlRef));
+
+
+  SetReferenceInNativeControl();
+  verify_noerr(err);
+  if (gDataBrowserTableViewDrawItemUPP         == NULL) gDataBrowserTableViewDrawItemUPP    = NewDataBrowserDrawItemUPP   (DataBrowserDrawItemProc);
+  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;
+  DataBrowserCustomCallbacks customCallbacks;
+
+  InitializeDataBrowserCallbacks      (&callbacks,      kDataBrowserLatestCallbacks);
+  InitializeDataBrowserCustomCallbacks(&customCallbacks,kDataBrowserLatestCallbacks);
+
+  callbacks.u.v1.itemDataCallback         = gDataBrowserTableViewItemDataUPP;
+  callbacks.u.v1.itemCompareCallback      = gDataBrowserTableViewItemCompareUPP;
+  callbacks.u.v1.itemNotificationCallback = gDataBrowserTableViewItemNotificationUPP;
+  this->SetCallbacks(&callbacks);
+
+  customCallbacks.u.v1.drawItemCallback = gDataBrowserTableViewDrawItemUPP;
+  this->SetCustomCallbacks(&customCallbacks);
+
+ // style setting:
+  this->EnableCellSizeModification();
+
+  DataBrowserSelectionFlags flags; // variable definition
+
+  if (this->GetSelectionFlags(&flags) == noErr) // get default settings
+  {
+    if ((style & wxDV_MULTIPLE) != 0)
+      flags &= ~kDataBrowserSelectOnlyOne;
+    else
+      flags |= kDataBrowserSelectOnlyOne;
+    (void) this->SetSelectionFlags(flags);
+  } /* if */
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  OptionBits attributes; // variable definition
+  
+  if (this->GetAttributes(&attributes) == noErr) // get default settings
+  {
+    if ((style & wxDV_VERT_RULES) != 0)
+      attributes |= kDataBrowserAttributeListViewDrawColumnDividers;
+    else
+      attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
+    (void) this->SetAttributes(attributes);
+  } /* if */
+#endif
+  if ((style & wxDV_NO_HEADER) != 0)
+    this->SetHeaderButtonHeight(0);
+} /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */
+
+//
+// callback handling
+//
+OSStatus wxMacDataBrowserTableViewControl::SetCallbacks(DataBrowserCallbacks const* callbacks)
+{
+  return ::SetDataBrowserCallbacks(this->m_controlRef,callbacks);
+} /* wxMacDataBrowserTableViewControl::SetCallbacks(DataBrowserCallbacks const*) */
+
+OSStatus wxMacDataBrowserTableViewControl::SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks)
+{
+  return ::SetDataBrowserCustomCallbacks(this->m_controlRef,customCallbacks);
+} /* xMacDataBrowserTableViewControl::SetCustomCallbacks(DataBrowserCustomCallbacks const*) */
+
+//
+// header handling
+//
+OSStatus wxMacDataBrowserTableViewControl::GetHeaderDesc(DataBrowserPropertyID property, 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);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc)
+{
+  return ::SetDataBrowserListViewHeaderDesc(this->m_controlRef,property,desc);
+}
+
+//
+// layout handling
+//
+OSStatus wxMacDataBrowserTableViewControl::AutoSizeColumns()
+{
+  return AutoSizeDataBrowserListViewColumns(this->m_controlRef);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool enableHeight, bool enableWidth)
+{
+  return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight);
+} /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes)
+{
+  return ::DataBrowserGetAttributes(this->GetControlRef(),attributes);
+} /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */
+#endif
+
+OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth( DataBrowserPropertyID column , UInt16 *width ) const
+{
+    return GetDataBrowserTableViewNamedColumnWidth( m_controlRef , column , width );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetDefaultRowHeight( UInt16 * height ) const
+{
+    return GetDataBrowserTableViewRowHeight( m_controlRef, height );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetHeaderButtonHeight(UInt16 *height)
+{
+    return GetDataBrowserListViewHeaderBtnHeight( m_controlRef, height );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetDefaultColumnWidth( UInt16 *width ) const
+{
+    return GetDataBrowserTableViewColumnWidth( m_controlRef , width );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetRowHeight( DataBrowserItemID item , UInt16 *height) const
+{
+    return GetDataBrowserTableViewItemRowHeight( m_controlRef, item , height);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetScrollPosition( UInt32 *top , UInt32 *left ) const
+{
+    return GetDataBrowserScrollPosition( m_controlRef , top , left );
+}
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes)
+{
+  return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes);
+} /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */
+#endif
+
+OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth( DataBrowserPropertyID column , UInt16 width )
+{
+    return SetDataBrowserTableViewNamedColumnWidth( m_controlRef , column , width );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetDefaultColumnWidth( UInt16 width )
+{
+    return SetDataBrowserTableViewColumnWidth( m_controlRef , width );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetDefaultRowHeight( UInt16 height )
+{
+    return SetDataBrowserTableViewRowHeight( m_controlRef , height );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars( bool horiz, bool vert )
+{
+    return SetDataBrowserHasScrollBars( m_controlRef, horiz, vert );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16 height)
+{
+    return SetDataBrowserListViewHeaderBtnHeight( m_controlRef, height );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle )
+{
+    return SetDataBrowserTableViewHiliteStyle( m_controlRef, hiliteStyle );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetRowHeight(DataBrowserItemID item, UInt16 height)
+{
+  return ::SetDataBrowserTableViewItemRowHeight(this->m_controlRef,item,height);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetScrollPosition(UInt32 top, UInt32 left)
+{
+  return ::SetDataBrowserScrollPosition(this->m_controlRef,top,left);
+}
+
+//
+// column handling
+//
+OSStatus wxMacDataBrowserTableViewControl::GetColumnCount(UInt32* numColumns) const
+{
+  return GetDataBrowserTableViewColumnCount(this->m_controlRef,numColumns);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetColumnID(DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id)
+{
+  return GetDataBrowserTableViewColumnProperty(this->m_controlRef,position,id);
+} /* wxMacDataBrowserTableViewControl::GetColumnID(DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id) */
+
+OSStatus wxMacDataBrowserTableViewControl::GetFreePropertyID(DataBrowserPropertyID* id) const
+{
+  for (*id=kMinPropertyID; *id<std::numeric_limits<DataBrowserPropertyID>::max(); ++(*id))
+    if (this->IsUsedPropertyID(*id) == errDataBrowserPropertyNotFound)
+      return noErr;
+  return errDataBrowserPropertyNotSupported;
+} /* wxMacDataBrowserTableViewControl::GetFreePropertyID(DataBrowserPropertyID*) const */
+
+OSStatus wxMacDataBrowserTableViewControl::GetPropertyColumn(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* column) const
+{
+  return GetDataBrowserTableViewColumnPosition(this->m_controlRef,propertyID,column);
+} /* wxMacDataBrowserTableViewControl::GetPropertyColumn(DataBrowserPropertyID, DataBrowserTableViewColumnIndex*) const */
+
+OSStatus wxMacDataBrowserTableViewControl::GetPropertyFlags(DataBrowserPropertyID property, DataBrowserPropertyFlags *flags) const
+{
+    return GetDataBrowserPropertyFlags( m_controlRef , property , flags );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::IsUsedPropertyID(DataBrowserPropertyID propertyID) const
+{
+ // as the Mac interface does not provide a function that checks if the property id is in use or not a function is chosen that should not
+ // 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 */
+
+OSStatus wxMacDataBrowserTableViewControl::RemoveColumn(DataBrowserTableViewColumnIndex position)
+{
+  DataBrowserTableViewColumnID id;
+  GetColumnID( position, &id );
+  return RemoveDataBrowserTableViewColumn( m_controlRef, id );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetColumnPosition(DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position)
+{
+  return ::SetDataBrowserTableViewColumnPosition(this->m_controlRef,column,position);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetPropertyFlags(DataBrowserPropertyID property, DataBrowserPropertyFlags flags)
+{
+  return ::SetDataBrowserPropertyFlags(this->m_controlRef,property,flags);
+} /* wxMacDataBrowserTableViewControl::SetPropertyFlags(DataBrowserPropertyID, DataBrowserPropertyFlags) */
+
+OSStatus wxMacDataBrowserTableViewControl::SetDisclosureColumn(DataBrowserPropertyID property, Boolean expandableRows)
+{
+  return SetDataBrowserListViewDisclosureColumn( m_controlRef, property, expandableRows);
+}
+
+//
+// item handling
+//
+OSStatus wxMacDataBrowserTableViewControl::AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty)
+{
+  return ::AddDataBrowserItems(this->m_controlRef,container,numItems,items,preSortProperty);
+} /* wxMacDataBrowserTableViewControl::AddItems(DataBrowserItemID, UInt32, DataBrowserItemID const*, DataBrowserPropertyID) */
+
+OSStatus wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID* id) const
+{
+  ItemCount NoOfItems;
+  
+  
+  verify_noerr(this->GetItemCount(&NoOfItems));
+  if (NoOfItems == 0)
+  {
+    *id = 1;
+    return noErr;
+  } /* if */
+  else
+  {
+   // as there might be a lot of items in the data browser and mostly the data is added item by item the largest used ID number is roughly in the order of magnitude
+   // as the number of items; therefore, start from the number of items to look for a new ID:
+    for (*id=NoOfItems; *id<std::numeric_limits<DataBrowserItemID>::max(); ++(*id))
+      if (this->IsUsedItemID(*id) == errDataBrowserItemNotFound)
+        return noErr;
+   // as the first approach was not successful, try from the beginning:
+    for (*id=0; *id<NoOfItems; ++(*id))
+      if (this->IsUsedItemID(*id) == errDataBrowserItemNotFound)
+        return noErr;
+   // sorry, data browser is full:
+    return errDataBrowserItemNotAdded;
+  } /* if */
+} /* wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID*) const */
+
+OSStatus wxMacDataBrowserTableViewControl::GetItemCount(DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const
+{
+  return GetDataBrowserItemCount(this->m_controlRef,container,recurse,state,numItems);
+} /* wxMacDataBrowserTableViewControl::GetItemCount(DataBrowserItemID, Boolean, DataBrowserItemState, ItemCount*) const */
+
+OSStatus wxMacDataBrowserTableViewControl::GetItemID( DataBrowserTableViewRowIndex row, DataBrowserItemID * item ) const
+{
+  return GetDataBrowserTableViewItemID(this->m_controlRef,row,item);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetItems(DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const
+{
+  return GetDataBrowserItems(this->m_controlRef,container,recurse,state,items);
+} /* wxMacDataBrowserTableViewControl::GetItems(DataBrowserItemID, Boolean, DataBrowserItemState, Handle) const */
+
+OSStatus wxMacDataBrowserTableViewControl::GetItemRow(DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const
+{
+  return GetDataBrowserTableViewItemRow(this->m_controlRef,item,row);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::IsUsedItemID(DataBrowserItemID itemID) const
+{
+ // as the Mac interface does not provide a function that checks if the property id is in use or not a function is chosen that should not
+ // 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 */
+
+OSStatus wxMacDataBrowserTableViewControl::RemoveItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty)
+{
+  return ::RemoveDataBrowserItems(this->m_controlRef,container,numItems,items,preSortProperty);
+}
+
+OSStatus wxMacDataBrowserTableViewControl::RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const
+{
+  return ::RevealDataBrowserItem(this->m_controlRef,item,propertyID,options);
+} /* wxMacDataBrowserTableViewControl::RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const */
+
+OSStatus wxMacDataBrowserTableViewControl::UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty,
+                                                       DataBrowserPropertyID propertyID) const
+{
+  return UpdateDataBrowserItems(this->m_controlRef,container,numItems,items,preSortProperty,propertyID);
+}
+
+//
+// item selection
+//
+size_t wxMacDataBrowserTableViewControl::GetSelectedItemIDs(wxArrayDataBrowserItemID& itemIDs) const
+{
+  DataBrowserItemID* itemIDPtr;
+  Handle handle(::NewHandle(0));
+  
+  size_t NoOfItems;
+
+
+  wxCHECK_MSG(this->GetItems(kDataBrowserNoItem,true,kDataBrowserItemIsSelected,handle) == noErr,0,_("Could not get selected items."));
+  NoOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID));
+  itemIDs.Empty();
+  itemIDs.Alloc(NoOfItems);
+  HLock(handle);
+  itemIDPtr = (DataBrowserItemID*) (*handle);
+  for (size_t i=0; i<NoOfItems; ++i)
+  {
+    itemIDs.Add(*itemIDPtr);
+    ++itemIDPtr;
+  } /* for */
+  HUnlock(handle);
+  DisposeHandle(handle);
+  return NoOfItems;
+} /* wxMacDataBrowserTableViewControl::GetSelectedItemIDs(wxArrayDataBrowserItemID&) const*/
+
+OSStatus wxMacDataBrowserTableViewControl::GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const
+{
+    return GetDataBrowserSelectionAnchor( m_controlRef, first, last );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetSelectionFlags(DataBrowserSelectionFlags* flags) const
+{
+  return ::GetDataBrowserSelectionFlags(this->m_controlRef,flags);
+} /* wxMacDataBrowserTableViewControl::GetSelectionFlags(DataBrowserSelectionFlags*) const */
+
+bool wxMacDataBrowserTableViewControl::IsItemSelected(DataBrowserItemID item) const
+{
+  return ::IsDataBrowserItemSelected(this->m_controlRef,item);
+} /* wxMacDataBrowserTableViewControl::IsItemSelected(DataBrowserItemID) const */
+
+OSStatus wxMacDataBrowserTableViewControl::SetSelectionFlags(DataBrowserSelectionFlags flags)
+{
+  return ::SetDataBrowserSelectionFlags(this->m_controlRef,flags);
+} /* wxMacDataBrowserTableViewControl::SetSelectionFlags(DataBrowserSelectionFlags) */
+
+OSStatus wxMacDataBrowserTableViewControl::SetSelectedItems(UInt32 numItems, DataBrowserItemID const* items, DataBrowserSetOption operation)
+{
+  return ::SetDataBrowserSelectedItems( m_controlRef, numItems, items, operation );
+} /* wxMacDataBrowserTableViewControl::SetSelectedItems(UInt32, DataBrowserItemID const*, DataBrowserSetOption) */
+
+OSStatus wxMacDataBrowserTableViewControl::GetSortProperty( DataBrowserPropertyID *column ) const
+{
+    return GetDataBrowserSortProperty( m_controlRef , column );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetSortProperty( DataBrowserPropertyID column )
+{
+    return SetDataBrowserSortProperty( m_controlRef , column );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::GetSortOrder( DataBrowserSortOrder *order ) const
+{
+    return GetDataBrowserSortOrder( m_controlRef , order );
+}
+
+OSStatus wxMacDataBrowserTableViewControl::SetSortOrder( DataBrowserSortOrder order )
+{
+    return SetDataBrowserSortOrder( m_controlRef , order );
+}
+
+IMPLEMENT_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl,wxMacControl)
+
+// ============================================================================
+// Databrowser class for the list view control
+// ============================================================================
+//
+#pragma mark -
+//
+// column handling
+//
+OSStatus wxMacDataBrowserListViewControl::AddColumn(DataBrowserListViewColumnDesc *columnDesc, DataBrowserTableViewColumnIndex position)
+{
+  return AddDataBrowserListViewColumn(this->m_controlRef,columnDesc,position);
+} /* wxMacDataBrowserListViewControl::AddColumn(DataBrowserListViewColumnDesc*, DataBrowserTableViewColumnIndex) */
+
+// ============================================================================
+// Databrowser class for the data view control
+// ============================================================================
+//
+#pragma mark -
+//
+// constructors / destructor
+//
+wxMacDataViewDataBrowserListViewControl::wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style)
+                                        :wxMacDataBrowserListViewControl(peer,pos,size,style)
+{
+} /* wxMacDataViewDataBrowserListViewControl::wxMacDataViewDataBrowserListViewControl(wxWindow* , const wxPoint&, const wxSize&, long) */
+
+//
+// item ID and model matching
+//
+void wxMacDataViewDataBrowserListViewControl::ClearItemIDRowPairs(void)
+{
+  this->m_itemIDRowNumberMap.clear();
+} /* wxMacDataViewDataBrowserListViewControl::ClearItemIDRowPairs(void) */
+
+bool wxMacDataViewDataBrowserListViewControl::DeleteItemIDRowPair(DataBrowserItemID itemID)
+{
+  return (this->m_itemIDRowNumberMap.erase(itemID) == 1);
+} /* wxMacDataViewDataBrowserListViewControl::DeleteItemIDRowPair(DataBrowseritemID) */
+
+bool wxMacDataViewDataBrowserListViewControl::GetRowIndex(unsigned long& rowIndex, DataBrowserItemID itemID) const
+{
+  ItemIDRowNumberHashMap::const_iterator iteratorHashMap(this->m_itemIDRowNumberMap.find(itemID));
+  
+  
+  if (iteratorHashMap == this->m_itemIDRowNumberMap.end())
+    return false;
+  else
+  {
+    rowIndex = iteratorHashMap->second;
+    return true;
+  } /* if */
+} /* wxMacDataViewDataBrowserListViewControl::GetRowIndex(unsigned int& rowIndex, DataBrowserItemID itemID) const */
+
+bool wxMacDataViewDataBrowserListViewControl::InsertItemIDRowPair(DataBrowserItemID itemID, unsigned long rowIndex)
+{
+  return this->m_itemIDRowNumberMap.insert(ItemIDRowNumberHashMap::value_type(itemID,rowIndex)).second;
+} /* wxMacDataViewDataBrowserListViewControl::InsertItemIDRowPair(DataBrowserItemID, unsigned long) */
+
+void wxMacDataViewDataBrowserListViewControl::RenumberItemIDRowIndices(unsigned int* newIndices)
+{
+  ItemIDRowNumberHashMap::iterator hashMapIterator(this->m_itemIDRowNumberMap.begin());
+  
+  
+  while (hashMapIterator != this->m_itemIDRowNumberMap.end())
+  {
+    hashMapIterator->second = newIndices[hashMapIterator->second];
+    ++hashMapIterator;
+  } /* while */
+} /* wxMacDataViewDataBrowserListViewControl::RenumberItemIDRowIndices(unsigned int*) */
+
+void wxMacDataViewDataBrowserListViewControl::RenumberItemIDRowIndicesDeletion (unsigned long decreaseFromIndex)
+{
+  ItemIDRowNumberHashMap::iterator hashMapIterator(this->m_itemIDRowNumberMap.begin());
+  
+  
+  while (hashMapIterator != this->m_itemIDRowNumberMap.end())
+  {
+    if (hashMapIterator->second >= decreaseFromIndex)
+      --(hashMapIterator->second);
+    ++hashMapIterator;
+  } /* while */
+} /* wxMacDataViewDataBrowserListViewControl::RenumberItemIDRowIndicesDeletion (unsigned int) */
+
+void wxMacDataViewDataBrowserListViewControl::RenumberItemIDRowIndicesInsertion(unsigned long increaseFromIndex)
+{
+  ItemIDRowNumberHashMap::iterator hashMapIterator(this->m_itemIDRowNumberMap.begin());
+  
+  
+  while (hashMapIterator != this->m_itemIDRowNumberMap.end())
+  {
+    if (hashMapIterator->second >= increaseFromIndex)
+      ++(hashMapIterator->second);
+    ++hashMapIterator;
+  } /* while */
+} /* wxMacDataViewDataBrowserListViewControl::RenumberItemIDRowIndicesInsertion(unsigned int) */
+
+void wxMacDataViewDataBrowserListViewControl::ReverseRowIndexNumbering(void)
+{
+  if (this->m_itemIDRowNumberMap.size() > 0)
+  {
+    size_t const maxIndex = this->m_itemIDRowNumberMap.size()-1;
+
+    ItemIDRowNumberHashMap::iterator hashMapIterator(this->m_itemIDRowNumberMap.begin());
+    
+    
+    while (hashMapIterator != this->m_itemIDRowNumberMap.end())
+    {
+      hashMapIterator->second = maxIndex-hashMapIterator->second;
+      ++hashMapIterator;
+    } /* while */
+  } /* if */
+} /* wxMacDataViewDataBrowserListViewControl::ReverseRowIndexNumbering(void) */
+
+//
+// callback functions (inherited from wxMacDataBrowserTableViewControl)
+//
+Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID WXUNUSED(sortProperty))
+{
+  unsigned long rowIndex1, rowIndex2;
+
+  bool result = (this->GetRowIndex(rowIndex1,itemOneID) && this->GetRowIndex(rowIndex2,itemTwoID) && (rowIndex1 < rowIndex2));
+  return result;
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID, DataBrowserItemID, DataBrowserPropertyID) */
+
+void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice)
+{
+  OSStatus errorStatus;
+
+  unsigned long column;
+  unsigned long row;
+
+  wxDataViewColumn* dataViewColumnPtr;
+
+  wxDataViewCtrl* dataViewCtrlPtr;
+  
+  wxDataViewCustomRenderer* dataViewCustomRendererPtr;
+
+  wxVariant dataToRender;
+
+
+  wxCHECK_RET(this->GetPropertyColumn(property,&column) == noErr,_("Could not determine column index."));
+  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."));
+  if (dynamic_cast<wxDataViewSortedListModel*>(dataViewCtrlPtr->GetModel()) == NULL)
+  {
+    wxCHECK_RET(this->GetRowIndex(row,itemID),_("Row index does not exist."));
+  } /* if */
+  else
+  {
+    wxCHECK_RET(this->GetItemRow(itemID,&row) == noErr,_("Row index does not exist."));
+  } /* if */
+  dataViewColumnPtr = dataViewCtrlPtr->GetColumn(column);
+  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,column,row);
+  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) */
+
+OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue)
+{
+  if (getValue)
+  {
+   // variable definition:
+    unsigned long     column;
+    unsigned long     row;
+    wxDataViewCtrl*   dataViewCtrlPtr;
+    wxDataViewColumn* dataViewColumnPtr;
+    
+    verify_noerr(this->GetPropertyColumn(property,&column));
+    dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());
+    wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
+    if (dynamic_cast<wxDataViewSortedListModel*>(dataViewCtrlPtr->GetModel()) == NULL)
+    {
+      wxCHECK_MSG(this->GetRowIndex(row,itemID),errDataBrowserNotConfigured,_("Row index does not exist."));
+    } /* if */
+    else
+    {
+      wxCHECK_MSG(this->GetItemRow(itemID,&row) == noErr,errDataBrowserNotConfigured,_("Row index does not exist."));
+    } /* if */
+    dataViewColumnPtr = dataViewCtrlPtr->GetColumn(column);
+    wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column for the specified column index."));
+    switch (dataViewColumnPtr->GetRenderer()->GetPropertyType())
+    {
+      case kDataBrowserCheckboxType:
+        {
+         // variable definitions:
+          ThemeButtonValue buttonValue;
+          OSStatus         errorStatus;
+
+          errorStatus = ::GetDataBrowserItemDataButtonValue(itemData,&buttonValue);
+          if (errorStatus == noErr)
+          {
+            if (buttonValue == kThemeButtonOn)
+            {
+             // variable definition and initialization:
+              wxVariant modifiedData(true);
+
+              return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,static_cast<unsigned int>(column),static_cast<unsigned int>(row)) ? noErr : errDataBrowserNotConfigured);
+            } /* if */
+            else if (buttonValue == kThemeButtonOff)
+            {
+             // variable definition and initialization:
+              wxVariant modifiedData(false);
+
+              return (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,static_cast<unsigned int>(column),static_cast<unsigned int>(row)) ? noErr : errDataBrowserNotConfigured);
+            } /* if */
+            else
+              return errDataBrowserInvalidPropertyData;
+          } /* if */
+          else
+            return errorStatus;
+        } /* block */
+      case kDataBrowserTextType:
+        {
+         // variable definitions:
+          CFStringRef stringReference;
+          OSStatus    errorStatus;
+
+          errorStatus = ::GetDataBrowserItemDataText(itemData,&stringReference);
+          if (errorStatus == noErr)
+          {
+           // variable definitions and initializations:
+            wxMacCFStringHolder modifiedString(stringReference);
+            wxVariant           modifiedData(modifiedString.AsString());
+
+            if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,static_cast<unsigned int>(column),static_cast<unsigned int>(row)))
+              return noErr;
+            else
+              return errDataBrowserNotConfigured;
+          } /* if */
+          else
+            return errorStatus;
+        } /* block */
+      default:
+        return errDataBrowserPropertyNotSupported;
+    } /* switch */
+  } /* if */
+  else
+  {
+    if (property >= kMinPropertyID) // in case of data columns set the data
+    {
+     // variable definitions:
+      OSStatus          errorStatus;
+      unsigned long     columnPosition;
+      unsigned long     rowPosition;
+      wxVariant         variant;
+      wxDataViewColumn* dataViewColumnPtr;
+      wxDataViewCtrl*   dataViewCtrlPtr;
+      
+      errorStatus = this->GetPropertyColumn(property,&columnPosition);
+      wxCHECK_MSG(errorStatus == noErr,errorStatus,_("Column index does not exist."));
+      dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer());wxCHECK_MSG(dataViewCtrlPtr   != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
+      dataViewColumnPtr = dataViewCtrlPtr->GetColumn(columnPosition);  wxCHECK_MSG(dataViewColumnPtr != NULL,errDataBrowserNotConfigured,_("No column for the specified column position existing."));
+      if (dynamic_cast<wxDataViewSortedListModel*>(dataViewCtrlPtr->GetModel()) == NULL)
+      {
+        wxCHECK_MSG(this->GetRowIndex(rowPosition,itemID),errDataBrowserNotConfigured,_("Row index does not exist."));
+      } /* if */
+      else
+      {
+        wxCHECK_MSG(this->GetItemRow(itemID,&rowPosition) == noErr,errDataBrowserNotConfigured,_("Row index does not exist."));
+      } /* if */
+      dataViewCtrlPtr->GetModel()->GetValue(variant,dataViewColumnPtr->GetModelColumn(),rowPosition);
+      wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,errDataBrowserNotConfigured,_("No renderer specified for column."));
+      dataViewColumnPtr->GetRenderer()->SetDataReference(itemData);
+      dataViewColumnPtr->GetRenderer()->SetValue(variant);
+      wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->Render(),errDataBrowserNotConfigured,_("Rendering failed."));
+    } /* if */
+    else // react on special system requests
+      switch (property)
+      {
+        case kDataBrowserItemIsContainerProperty:
+          return ::SetDataBrowserItemDataBooleanValue(itemData,false);
+        case kDataBrowserItemIsEditableProperty:
+          return ::SetDataBrowserItemDataBooleanValue(itemData,true);
+      } /* switch */
+  } /* if */
+  return errDataBrowserPropertyNotSupported;
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID, DataBrowserPropertyID, DataBrowserItemDataRef, Boolean) */
+
+void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef WXUNUSED(itemData))
+{
+  switch (message)
+  {
+    case kDataBrowserItemDoubleClicked:
+      {
+       // variable definitions:
+        unsigned long   row;
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+        
+        wxCHECK_RET(dataViewCtrlPtr != NULL,      _("Pointer to data view control not set correctly."));
+        wxCHECK_RET(this->GetRowIndex(row,itemID),_("Row index does not exist."));
+       // initialize wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED,dataViewCtrlPtr->GetId()); // variable defintion
+
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetRow(row);
+       // finally sent the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+      } /* block */
+      break;
+    case kDataBrowserItemSelected:
+      {
+       // variable definitions:
+        unsigned long   row;
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+        
+        wxCHECK_RET(dataViewCtrlPtr != NULL,      _("Pointer to data view control not set correctly."));
+        if (dynamic_cast<wxDataViewSortedListModel*>(dataViewCtrlPtr->GetModel()) == NULL)
+        {
+          wxCHECK_RET(this->GetRowIndex(row,itemID),_("Row index does not exist."));
+        } /* if */
+        else
+        {
+          wxCHECK_RET(this->GetItemRow(itemID,&row) == noErr,_("Row index does not exist."));
+        } /* if */
+       // initialize wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ROW_SELECTED,dataViewCtrlPtr->GetId()); // variable defintion
+
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetRow(row);
+       // finally sent the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+      } /* block */
+      break;
+    case kDataBrowserUserStateChanged:
+      {
+        DataBrowserPropertyID propertyId;
+        
+        if ((this->GetSortProperty(&propertyId) == noErr) && (propertyId >= kMinPropertyID))
+        {
+          DataBrowserSortOrder sortOrder;
+          unsigned long        column;
+          
+          if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetPropertyColumn(propertyId,&column) == noErr))
+          {
+            wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
+
+            if (  dataViewCtrlPtr->GetColumn(column)->IsSortOrderAscending()  && (sortOrder == kDataBrowserOrderDecreasing) ||
+                !(dataViewCtrlPtr->GetColumn(column)->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing))
+            {
+             // initialize wxWidget event:
+              wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
+
+              dataViewEvent.SetEventObject(dataViewCtrlPtr);
+              dataViewEvent.SetColumn(column);
+              dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumn(column));
+             // finally sent the equivalent wxWidget event:
+              dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+            } /* if */
+          } /* if */
+        } /* if */
+      } /* block */
+      break;
+  } /* switch */
+} /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */
+
+
+#endif
+ // wxUSE_GENERICDATAVIEWCTRL
diff --git a/src/mac/carbon/dataview.cpp b/src/mac/carbon/dataview.cpp
new file mode 100644 (file)
index 0000000..13644c5
--- /dev/null
@@ -0,0 +1,1103 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/mac/carbon/datavgen.cpp
+// Purpose:     wxDataViewCtrl native mac implementation
+// Author:      
+// Id:          $Id$
+// Copyright:   (c) 2007
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_DATAVIEWCTRL
+
+#include "wx/dataview.h"
+
+#if !defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0)
+
+#include <limits>
+
+#include "wx/mac/carbon/databrow.h"
+
+#ifndef WX_PRECOMP
+  #include "wx/timer.h"
+#endif
+
+#include "wx/icon.h"
+#include "wx/renderer.h"
+
+//-----------------------------------------------------------------------------
+// local constants
+//-----------------------------------------------------------------------------
+
+// a list of all catchable events:
+static EventTypeSpec const eventList[] =
+{
+  {kEventClassControl, kEventControlDraw},
+  {kEventClassControl, kEventControlHit}
+};
+
+//-----------------------------------------------------------------------------
+// local functions
+//-----------------------------------------------------------------------------
+
+static pascal OSStatus wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler, EventRef EventReference, void* Data)
+{
+  wxDataViewCtrl* DataViewCtrlPtr((wxDataViewCtrl*) Data); // the 'Data' variable always contains a pointer to the data view control that installed the handler 
+
+  wxMacCarbonEvent CarbonEvent(EventReference) ;
+
+
+  switch (GetEventKind(EventReference))
+  {
+    case kEventControlDraw:
+      {
+        OSStatus status;
+
+        DataViewCtrlPtr->MacSetDrawingContext(CarbonEvent.GetParameter<CGContextRef>(kEventParamCGContextRef,typeCGContextRef));
+        status = ::CallNextEventHandler(handler,EventReference);
+        DataViewCtrlPtr->MacSetDrawingContext(NULL);
+        return status;
+      } /* block */
+    case kEventControlHit :
+      if (CarbonEvent.GetParameter<ControlPartCode>(kEventParamControlPart,typeControlPartCode) == kControlButtonPart) // we only care about the header
+      {
+        ControlRef            controlReference;
+        DataBrowserPropertyID columnPropertyID;
+        unsigned long         columnIndex;
+        OSStatus              status;
+        wxDataViewEvent       DataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId());
+
+        CarbonEvent.GetParameter(kEventParamDirectObject,&controlReference);
+       // determine the column that triggered the event (this is the column that is responsible for sorting the data view):
+        status = ::GetDataBrowserSortProperty(controlReference,&columnPropertyID);
+        wxCHECK(status == noErr,status);
+        status = ::GetDataBrowserTableViewColumnPosition(controlReference,columnPropertyID,&columnIndex);
+        if (status == errDataBrowserPropertyNotFound) // user clicked into part of the header that does not have a property
+          return ::CallNextEventHandler(handler,EventReference);
+        wxCHECK(status == noErr,status);
+       // initialize wxWidget event handler:
+        DataViewEvent.SetEventObject(DataViewCtrlPtr);
+        DataViewEvent.SetColumn(columnIndex);
+        DataViewEvent.SetDataViewColumn(DataViewCtrlPtr->GetColumn(columnIndex));
+       // finally sent the equivalent wxWidget event:
+        DataViewCtrlPtr->GetEventHandler()->ProcessEvent(DataViewEvent);
+        return ::CallNextEventHandler(handler,EventReference);
+      } /* if */
+      else
+        return eventNotHandledErr;
+  } /* switch */
+
+  return eventNotHandledErr;
+} /* wxMacDataViewCtrlEventHandler(EventHandlerCallRef, EventRef, void*) */
+
+//-----------------------------------------------------------------------------
+// local function pointers
+//-----------------------------------------------------------------------------
+
+DEFINE_ONE_SHOT_HANDLER_GETTER(wxMacDataViewCtrlEventHandler)
+
+// ---------------------------------------------------------
+// wxMacDataViewListModelNotifier
+// ---------------------------------------------------------
+#pragma mark -
+class wxMacDataViewListModelNotifier : public wxDataViewListModelNotifier
+{
+public:
+  wxMacDataViewListModelNotifier(wxMacDataViewDataBrowserListViewControl* initDataViewControlPtr) : m_dataViewControlPtr(initDataViewControlPtr)
+  {
+  }
+
+  virtual bool RowAppended(void)
+  {
+    DataBrowserItemID newRowID;
+    
+    
+    if ((this->m_dataViewControlPtr->GetFreeItemID(&newRowID) == noErr) &&
+         this->m_dataViewControlPtr->InsertItemIDRowPair(newRowID,this->GetOwner()->GetRowCount()-1) &&
+        (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&newRowID) == noErr))
+    {
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      
+     // sent the equivalent wxWidget event:
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_APPENDED,dataViewCtrlPtr->GetId()); // variable defintion
+
+      dataViewEvent.SetEventObject(dataViewCtrlPtr);
+      dataViewEvent.SetRow(this->GetOwner()->GetRowCount()-1);
+     // sent the equivalent wxWidget event:
+      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+     // done
+      return true;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool RowChanged(unsigned int row)
+  {
+    DataBrowserItemID itemID;
+    
+    
+    if (this->m_dataViewControlPtr->GetItemID(row,&itemID) == noErr)
+    {
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      
+     // sent the equivalent wxWidget event:
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
+
+      dataViewEvent.SetEventObject(dataViewCtrlPtr);
+      dataViewEvent.SetRow(row);
+     // sent the equivalent wxWidget event:
+      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+     // done
+      return true;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool RowDeleted(unsigned int row)
+  {
+    DataBrowserItemID itemID;
+
+
+    if (this->m_dataViewControlPtr->GetItemID(row,&itemID) == noErr)
+    {
+     // variable definition:
+      unsigned long rowIndex;
+      
+      wxCHECK_MSG(this->m_dataViewControlPtr->GetRowIndex(rowIndex,itemID) && this->m_dataViewControlPtr->DeleteItemIDRowPair(itemID),false,_("Unable to delete row data."));
+      this->m_dataViewControlPtr->RenumberItemIDRowIndicesDeletion(rowIndex);
+      if (this->m_dataViewControlPtr->RemoveItem(kDataBrowserNoItem,&itemID) == noErr)
+      {
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+        
+       // sent the equivalent wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_DELETED,dataViewCtrlPtr->GetId()); // variable defintion
+
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetRow(row);
+       // sent the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+       // done
+        return true;
+      } /* if */
+      else
+        return false;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool RowInserted(unsigned int before)
+  {
+    DataBrowserItemID newRowID;
+
+
+    if (this->m_dataViewControlPtr->GetFreeItemID(&newRowID) == noErr)
+    {
+      this->m_dataViewControlPtr->RenumberItemIDRowIndicesInsertion(before);
+      if (this->m_dataViewControlPtr->InsertItemIDRowPair(newRowID,before) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&newRowID) == noErr))
+      {
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+        
+       // sent the equivalent wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_INSERTED,dataViewCtrlPtr->GetId()); // variable defintion
+
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetRow(before);
+       // sent the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+       // done
+        return true;
+      } /* if */
+      else
+        return false;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool RowPrepended(void)
+  {
+    DataBrowserItemID newRowID;
+
+
+    if (this->m_dataViewControlPtr->GetFreeItemID(&newRowID) == noErr)
+    {
+      this->m_dataViewControlPtr->RenumberItemIDRowIndicesInsertion(0);
+      if (this->m_dataViewControlPtr->InsertItemIDRowPair(newRowID,0) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&newRowID) == noErr))
+      {
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+        
+       // sent the equivalent wxWidget event:
+        wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROW_PREPENDED,dataViewCtrlPtr->GetId()); // variable defintion
+
+        dataViewEvent.SetEventObject(dataViewCtrlPtr);
+        dataViewEvent.SetRow(0);
+       // sent the equivalent wxWidget event:
+        dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+       // done
+        return true;
+      } /* if */
+      else
+        return false;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool ValueChanged(unsigned int col, unsigned int row)
+  {
+    DataBrowserItemID itemID;
+    
+    DataBrowserPropertyID propertyID;
+
+    
+    wxDataViewCtrl*  dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+    
+    if ((dataViewCtrlPtr != NULL) && (this->m_dataViewControlPtr->GetItemID(row,&itemID) == noErr) && (this->m_dataViewControlPtr->GetColumnID(col,&propertyID) == noErr) &&
+        (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
+    {
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      
+     // sent the equivalent wxWidget event:
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
+
+      dataViewEvent.SetEventObject(dataViewCtrlPtr);
+      dataViewEvent.SetColumn(col);
+      dataViewEvent.SetRow(row);
+     // sent the equivalent wxWidget event:
+      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+     // done
+      return true;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool RowsReordered(unsigned int* new_order)
+  {
+    DataBrowserPropertyID propertyId;
+
+        
+    if ((new_order != NULL) && (this->m_dataViewControlPtr->GetSortProperty(&propertyId) == noErr) && (propertyId >= kMinPropertyID))
+    {
+      DataBrowserSortOrder sortOrder;
+      unsigned long        column;
+          
+      if ((this->m_dataViewControlPtr->GetSortOrder(&sortOrder) == noErr) && (this->m_dataViewControlPtr->GetPropertyColumn(propertyId,&column) == noErr))
+      {
+        wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+        
+        if (dataViewCtrlPtr->GetColumn(column)->IsSortOrderAscending())
+          this->m_dataViewControlPtr->RenumberItemIDRowIndices(new_order);
+        else // the sort order of the control is descending but the passed sort order is always ordered top - down
+        {
+          ItemCount itemCount;
+
+          if (this->m_dataViewControlPtr->GetItemCount(&itemCount) != noErr)
+            return false;
+          unsigned int* reversedOrder(new unsigned int[itemCount]);
+          
+          for (ItemCount i=0; i<itemCount; ++i)
+            reversedOrder[i] = itemCount-new_order[i];
+          this->m_dataViewControlPtr->RenumberItemIDRowIndices(reversedOrder);
+          delete[] reversedOrder;
+        } /* if */
+        if (this->m_dataViewControlPtr->UpdateItems())
+        {
+         // sent the equivalent wxWidget event:
+          wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ROWS_REORDERED,dataViewCtrlPtr->GetId()); // variable defintion
+
+          dataViewEvent.SetEventObject(dataViewCtrlPtr);
+         // sent the equivalent wxWidget event:
+          dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+         // done
+          return true;
+        } /* if */
+        else
+          return false;
+      } /* if */
+      else
+        return false;
+    } /* if */
+    else
+      return false;
+  }
+  virtual bool Cleared(void)
+  {
+    this->m_dataViewControlPtr->ClearItemIDRowPairs();
+    if (this->m_dataViewControlPtr->RemoveItems() == noErr)
+    {
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      
+     // sent the equivalent wxWidget event:
+      wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED,dataViewCtrlPtr->GetId()); // variable defintion
+
+      dataViewEvent.SetEventObject(dataViewCtrlPtr);
+     // sent the equivalent wxWidget event:
+      dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
+     // done
+      return true;
+    } /* if */
+    else
+      return false;
+  }
+
+protected:
+private:
+//
+// variables
+//
+  wxMacDataViewDataBrowserListViewControl* m_dataViewControlPtr;
+};
+
+// ---------------------------------------------------------
+// wxDataViewRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewRenderer::wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                   :wxDataViewRendererBase(varianttype,mode,align), m_alignment(align), m_mode(mode)
+{
+} /* wxDataViewRenderer::wxDataViewRenderer(wxString const&, wxDataViewCellMode) */
+
+void wxDataViewRenderer::SetMode(wxDataViewCellMode mode)
+{
+  wxDataViewColumn* dataViewColumnPtr;
+
+
+  this->m_mode = mode;
+  dataViewColumnPtr = this->GetOwner();
+  if (dataViewColumnPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxDataViewCtrl* dataViewCtrlPtr(dataViewColumnPtr->GetOwner());
+    
+    if (dataViewCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+      
+      if (macDataViewListCtrlPtr != NULL)
+      {
+       // variable definition and initialization:
+        DataBrowserPropertyFlags flags;
+        
+        verify_noerr(macDataViewListCtrlPtr->GetPropertyFlags(dataViewColumnPtr->GetPropertyID(),&flags));
+        if (mode == wxDATAVIEW_CELL_EDITABLE)
+          flags |= kDataBrowserPropertyIsEditable;
+        else
+          flags &= ~kDataBrowserPropertyIsEditable;
+        verify_noerr(macDataViewListCtrlPtr->SetPropertyFlags(dataViewColumnPtr->GetPropertyID(),flags));
+      } /* if */
+    } /* if */
+  } /* if */
+} /* wxDataViewRenderer::SetMode(wxDataViewCellMode) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase)
+
+// ---------------------------------------------------------
+// wxDataViewCustomRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                         :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL)
+{
+} /* wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const&, wxDataViewCellMode) */
+
+wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void)
+{
+  if (this->m_DCPtr != NULL)
+    delete this->m_DCPtr;
+} /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) */
+
+wxDC* wxDataViewCustomRenderer::GetDC(void)
+{
+  if (this->m_DCPtr == NULL)
+  {
+    if ((GetOwner() == NULL) || (GetOwner()->GetOwner() == NULL))
+      return NULL;
+    this->m_DCPtr = new wxClientDC(this->GetOwner()->GetOwner());
+  } /* if */
+  return this->m_DCPtr;
+} /* wxDataViewCustomRenderer::GetDC(void) */
+
+bool wxDataViewCustomRenderer::Render(void)
+{
+  return false;
+} /* wxDataViewCustomRenderer::Render(void) */
+
+void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr)
+{
+  delete this->m_DCPtr;
+  this->m_DCPtr = newDCPtr;
+} /* wxDataViewCustomRenderer::SetDC(wxDC*) */
+
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer)
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                       :wxDataViewRenderer(varianttype,mode,align)
+{
+} /* wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const&, wxDataViewCellMode, int) */
+
+bool wxDataViewTextRenderer::Render(void)
+{
+  if (this->GetValue().GetType() == this->GetVariantType())
+  {
+   // variable definition:
+    wxMacCFStringHolder cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+
+    return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr);
+  } /* if */
+  else
+    return false;
+} /* wxDataViewTextRenderer::Render(void) */
+
+IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer)
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                         :wxDataViewRenderer(varianttype,mode,align)
+{
+}
+
+bool wxDataViewBitmapRenderer::Render(void)
+{
+  if (this->GetValue().GetType() == this->GetVariantType())
+  {
+    wxBitmap bitmap;
+    
+    bitmap << this->GetValue();
+    if (bitmap.Ok())
+      return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetBitmapData()->GetIconRef()) == noErr);
+    else
+      return false;
+  } /* if */
+  else
+    return false;
+} /* wxDataViewBitmapRenderer::Render(void) */
+
+IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer)
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                         :wxDataViewRenderer(varianttype,mode)
+{
+}
+
+bool wxDataViewToggleRenderer::Render(void)
+{
+  if (this->GetValue().GetType() == this->GetVariantType())
+    return (::SetDataBrowserItemDataButtonValue(this->GetDataReference(),this->GetValue().GetBool()) == noErr);
+  else
+    return false;
+} /* wxDataViewToggleRenderer::Render(void) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer)
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString const& label, wxString const& varianttype, wxDataViewCellMode mode, int align)
+                           :wxDataViewRenderer(varianttype,mode,align)
+{
+}
+
+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;
+} /* wxDataViewProgressRenderer::Render(void) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer)
+
+// ---------------------------------------------------------
+// wxDataViewDateRenderer
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewDateRenderer::wxDataViewDateRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
+                       :wxDataViewRenderer(varianttype,mode,align)
+{
+}
+
+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;
+} /* wxDataViewDateRenderer::Render(void) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer)
+
+// ---------------------------------------------------------
+// wxDataViewColumn
+// ---------------------------------------------------------
+#pragma mark -
+wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer *cell, unsigned int model_column, int width, wxAlignment align, int flags)
+                 :wxDataViewColumnBase(title,cell,model_column,width,wxALIGN_CENTER,flags), m_alignment(align), m_ascending(true),
+                  m_flags(flags & ~(wxDATAVIEW_COL_HIDDEN | wxDATAVIEW_COL_RESIZABLE)), m_minWidth(0), m_maxWidth(std::numeric_limits<int>::max()), m_width(width), m_title(title)
+{
+} /* wxDataViewColumn::wxDataViewColumn(wxString const &title, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
+
+wxDataViewColumn::wxDataViewColumn(wxBitmap const& bitmap, wxDataViewRenderer *cell, unsigned int model_column, int width, wxAlignment align, int flags)
+                 :wxDataViewColumnBase(bitmap,cell,model_column,width,wxALIGN_CENTER,flags), m_ascending(true), m_alignment(align),
+                  m_flags(flags & (wxDATAVIEW_COL_HIDDEN | wxDATAVIEW_COL_RESIZABLE)), m_minWidth(0), m_maxWidth(std::numeric_limits<int>::max()), m_width(width)
+{
+} /* wxDataViewColumn::wxDataViewColumn(wxBitmap const&, wxDataViewRenderer*, unsigned int, int, wxAlignment, int) */
+
+void wxDataViewColumn::SetAlignment(wxAlignment align)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+  
+  this->m_alignment = align;
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    if (macDataViewListCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      DataBrowserListViewHeaderDesc headerDescription;
+
+      wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
+      switch (align)
+      {
+        case wxALIGN_CENTER:
+        case wxALIGN_CENTER_HORIZONTAL:
+          headerDescription.btnFontStyle.just = teCenter;
+          break;
+        case wxALIGN_LEFT:
+          headerDescription.btnFontStyle.just = teFlushLeft;
+          break;
+        case wxALIGN_RIGHT:
+          headerDescription.btnFontStyle.just = teFlushRight;
+          break;
+        default:
+          headerDescription.btnFontStyle.just = teFlushDefault;
+      } /* switch */
+      wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set alignment."));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetAlignment(wxAlignment) */
+
+void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+
+  wxDataViewColumnBase::SetBitmap(bitmap);
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    if (macDataViewListCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      DataBrowserListViewHeaderDesc headerDescription;
+
+      wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
+      if (this->GetBitmap().Ok())
+        headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetBitmapData()->GetIconRef();
+      else
+        headerDescription.btnContentInfo.u.iconRef = NULL;
+      wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon."));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetBitmap(wxBitmap const&) */
+
+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);
+} /* wxDataViewColumn::SetFlags(int) */
+
+void wxDataViewColumn::SetMaxWidth(int maxWidth)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+  
+  this->m_maxWidth = maxWidth;
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    if (macDataViewListCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      DataBrowserListViewHeaderDesc headerDescription;
+      
+      wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
+      headerDescription.maximumWidth = static_cast<UInt16>(maxWidth);
+      wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set maximum width."));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetMaxWidth(int) */
+
+void wxDataViewColumn::SetMinWidth(int minWidth)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+  
+  this->m_minWidth = minWidth;
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    if (macDataViewListCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      DataBrowserListViewHeaderDesc headerDescription;
+      
+      wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
+      headerDescription.minimumWidth = static_cast<UInt16>(minWidth);
+      wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set minimum width."));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetMaxWidth(int) */
+
+void wxDataViewColumn::SetResizeable(bool WXUNUSED(resizeable))
+{
+} /* wxDataViewColumn::SetResizeable(bool) */
+
+void wxDataViewColumn::SetSortable(bool sortable)
+{
+ // variable definition and initialization:
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+  
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    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 */
+  } /* if */
+} /* wxDataViewColumn::SetSortable(bool) */
+
+void wxDataViewColumn::SetSortOrder(bool ascending)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+  
+  this->m_ascending = ascending;
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    if (macDataViewListCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      DataBrowserListViewHeaderDesc headerDescription;
+      
+      verify_noerr(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription));
+      if (ascending)
+        headerDescription.initialOrder = kDataBrowserOrderIncreasing;
+      else
+        headerDescription.initialOrder = kDataBrowserOrderDecreasing;
+      verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetSortOrder(bool) */
+
+void wxDataViewColumn::SetTitle(wxString const& title)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+  
+  this->m_title = title;
+  if (dataViewCtrlPtr != NULL)
+  {
+   // variable definition and initialization:
+    wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+    
+    if (macDataViewListCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      DataBrowserListViewHeaderDesc headerDescription;
+      wxMacCFStringHolder           cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
+      
+      wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
+      headerDescription.titleString = cfTitle;
+      wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set header description."));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetTitle(wxString const&) */
+
+void wxDataViewColumn::SetWidth(int width)
+{
+  wxDataViewCtrl* dataViewCtrlPtr(this->GetOwner());
+
+  
+  if ((width >= this->m_minWidth) && (width <= this->m_maxWidth))
+  {
+    this->m_width = width;
+    if (dataViewCtrlPtr != NULL)
+    {
+     // variable definition and initialization:
+      wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer()));
+      
+      if (macDataViewListCtrlPtr != NULL)
+        wxCHECK_RET(macDataViewListCtrlPtr->SetColumnWidth(this->GetPropertyID(),static_cast<UInt16>(width)) == noErr,_("Could not set column width."));
+    } /* if */
+  } /* if */
+} /* wxDataViewColumn::SetWidth(int) */
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn,wxDataViewColumnBase)
+
+//-----------------------------------------------------------------------------
+// wxDataViewCtrl
+//-----------------------------------------------------------------------------
+#pragma mark -
+void wxDataViewCtrl::Init(void)
+{
+  this->m_macIsUserPane = false;
+  this->m_NotifierPtr   = NULL;
+  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 )
+{
+  if (!(this->wxControl::Create(parent,id,pos,size,(style | wxSUNKEN_BORDER) & ~(wxHSCROLL | wxVSCROLL),validator)))
+    return false;
+
+#ifdef __WXMAC__
+  MacSetClipChildren(true) ;
+#endif
+
+  this->m_peer = new wxMacDataViewDataBrowserListViewControl(this,pos,size,style);
+  this->MacPostControlCreate(pos,size);
+
+  InstallControlEventHandler(this->m_peer->GetControlRef(),GetwxMacDataViewCtrlEventHandlerUPP(),GetEventTypeCount(eventList),eventList,this,NULL);
+
+  return true;
+} /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */
+
+void wxDataViewCtrl::OnSize(wxSizeEvent& event)
+{
+  unsigned int const NoOfColumns = this->GetColumnCount();
+
+
+  for (unsigned int i=0; i<NoOfColumns; ++i)
+  {
+   // variable definition and initialization:
+    wxDataViewColumn* dataViewColumnPtr(this->GetColumn(i));
+    
+    if (dataViewColumnPtr != NULL)
+    {
+     // variable definition and initialization:
+      wxDataViewCustomRenderer* dataViewCustomRendererPtr(dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer()));
+    
+      if (dataViewCustomRendererPtr != NULL)
+        dataViewCustomRendererPtr->SetDC(NULL); // reset DC because DC has changed
+    } /* if */
+  } /* for */
+  event.Skip();
+} /* wxDataViewCtrl::OnSize(wxSizeEvent&) */
+
+bool wxDataViewCtrl::AssociateModel(wxDataViewListModel *model)
+{
+  if (!wxDataViewCtrlBase::AssociateModel(model))
+    return false;
+  
+  this->m_NotifierPtr = new wxMacDataViewListModelNotifier(dynamic_cast<wxMacDataViewDataBrowserListViewControl*>(this->m_peer));
+  model->AddNotifier(this->m_NotifierPtr);
+
+  return true;
+}
+
+bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
+{
+  wxCHECK_MSG(dataViewColumnPtr != NULL,               false,_("Column pointer must not be NULL."));
+  wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,false,_("Column does not have a renderer."));
+  if (this->wxDataViewCtrlBase::AppendColumn(dataViewColumnPtr))
+  {
+   // variable definition:
+    DataBrowserPropertyID                          FreeID;
+    DataBrowserListViewColumnDesc                  columnDescription;
+    wxMacCFStringHolder                            cfTitle(dataViewColumnPtr->GetTitle(),(this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()));
+    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+   // initialize column description:
+    wxCHECK_MSG (MacDataViewListCtrlPtr != NULL,false,_("m_peer is not or incorrectly initialized"));
+    verify_noerr(MacDataViewListCtrlPtr->GetFreePropertyID(&FreeID));
+    dataViewColumnPtr->SetPropertyID(FreeID);
+    columnDescription.propertyDesc.propertyID = FreeID;
+    columnDescription.propertyDesc.propertyType = dataViewColumnPtr->GetRenderer()->GetPropertyType();
+    columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn;
+    if (dataViewColumnPtr->IsSortable())
+      columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn;
+    if (dataViewColumnPtr->IsResizeable())
+      columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn;
+    if (dataViewColumnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE)
+      columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable;
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+    if ((columnDescription.propertyDesc.propertyType == kDataBrowserTextType) ||
+        (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
+        (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType))
+      columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+    columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
+#endif
+    columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
+    columnDescription.headerBtnDesc.minimumWidth = 0;
+    columnDescription.headerBtnDesc.maximumWidth = 30000;
+    columnDescription.headerBtnDesc.titleOffset = 0;
+    columnDescription.headerBtnDesc.titleString = cfTitle; // we cannot directly use the wxMacCFStringHolder constructor call because then the CFStringRef is released
+                                                           // having called 'AddColumn' where the title (CFStringRef) is going to be used
+    columnDescription.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing;
+    columnDescription.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask;
+    switch (dataViewColumnPtr->GetAlignment())
+    {
+      case wxALIGN_CENTER:
+      case wxALIGN_CENTER_HORIZONTAL:
+        columnDescription.headerBtnDesc.btnFontStyle.just = teCenter;
+        break;
+      case wxALIGN_LEFT:
+        columnDescription.headerBtnDesc.btnFontStyle.just = teFlushLeft;
+        break;
+      case wxALIGN_RIGHT:
+        columnDescription.headerBtnDesc.btnFontStyle.just = teFlushRight;
+        break;
+      default:
+        columnDescription.headerBtnDesc.btnFontStyle.just = teFlushDefault;
+    } /* switch */
+    columnDescription.headerBtnDesc.btnFontStyle.font  = kControlFontViewSystemFont;
+    columnDescription.headerBtnDesc.btnFontStyle.style = normal;
+    columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
+    if (dataViewColumnPtr->GetBitmap().Ok())
+      columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = dataViewColumnPtr->GetBitmap().GetBitmapData()->GetIconRef();
+   // add column:
+    verify_noerr(MacDataViewListCtrlPtr->AddColumn(&columnDescription,kDataBrowserListViewAppendColumn));
+   // final adjustments for the layout:
+    if (dataViewColumnPtr->GetWidth() <= 0)
+    {
+     // variable definition:
+      UInt16 defaultColumnWidth;
+      
+      MacDataViewListCtrlPtr->GetDefaultColumnWidth(&defaultColumnWidth);
+      dataViewColumnPtr->SetWidth(defaultColumnWidth);
+    } /* if */
+    verify_noerr(MacDataViewListCtrlPtr->SetColumnWidth(dataViewColumnPtr->GetPropertyID(),dataViewColumnPtr->GetWidth()));
+    if (dataViewColumnPtr->IsSortable()) // if the current column is sortable and there is no active sortable column yet, the new column will become active
+    {
+     // variable definition:
+      DataBrowserPropertyID sortedProperty;
+
+      if ((MacDataViewListCtrlPtr->GetSortProperty(&sortedProperty) == noErr) && (sortedProperty < kMinPropertyID))
+        MacDataViewListCtrlPtr->SetSortProperty(dataViewColumnPtr->GetPropertyID());
+    } /* if */
+
+   // now, make sure that data is shown in the newly appended column:
+    if ((this->GetModel() != NULL) && (this->m_NotifierPtr != NULL) && (dataViewColumnPtr->GetModelColumn() >= 0) && (dataViewColumnPtr->GetModelColumn() < this->GetModel()->GetColumnCount()))
+      if (this->GetColumnCount() == 1) // the newly appended column is the only one and this means that no data has been inserted yet, so do it now:
+      {
+       // variable definition:
+        DataBrowserItemID newID;
+        
+        for (size_t i=0; i<this->GetModel()->GetRowCount(); ++i)
+          if (!((MacDataViewListCtrlPtr->GetFreeItemID(&newID) == noErr) && MacDataViewListCtrlPtr->InsertItemIDRowPair(newID,i) && (MacDataViewListCtrlPtr->AddItem(kDataBrowserNoItem,&newID) == noErr)))
+            return false;
+      } /* if */
+      else
+        for (size_t i=0; i<this->GetModel()->GetRowCount(); ++i)
+          (void) this->m_NotifierPtr->ValueChanged(dataViewColumnPtr->GetModelColumn(),i);
+   // done:
+    return true;
+  } /* if */
+  else
+    return false;
+} /* wxDataViewCtrl::AppendColumn(wxDataViewColumn*) */
+
+int wxDataViewCtrl::GetSelection(void) const
+{
+  wxArrayInt selectedRows;
+
+
+  if (this->GetSelections(selectedRows) > 0)
+    return selectedRows[0];
+  else
+    return wxNOT_FOUND;
+} /* wxDataViewCtrl::GetSelection(void) const */
+
+int wxDataViewCtrl::GetSelections(wxArrayInt& selectedRows) const
+{
+  size_t NoOfSelections;
+  wxArrayDataBrowserItemID itemIDs;
+
+  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+  if (dataViewListCtrlPtr == NULL)
+    NoOfSelections = 0;
+  else
+    NoOfSelections = dataViewListCtrlPtr->GetSelectedItemIDs(itemIDs);
+  selectedRows.Empty();
+  selectedRows.Alloc(NoOfSelections);
+  for (size_t i=0; i<NoOfSelections; ++i)
+  {
+   // variable definition:
+    DataBrowserTableViewRowIndex rowIndex;
+    
+    wxCHECK_MSG(dataViewListCtrlPtr->GetRowIndex(rowIndex,itemIDs[i]),0,_("Could not determine row index."));
+    selectedRows[i] = static_cast<int>(rowIndex);
+  } /* for */
+  return static_cast<int>(NoOfSelections);
+} /* wxDataViewCtrl::GetSelections(wxArrayInt&) const */
+
+bool wxDataViewCtrl::IsSelected(unsigned int row) const
+{
+  DataBrowserItemID itemID;
+  
+  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+  
+  return ((dataViewListCtrlPtr != NULL) && (dataViewListCtrlPtr->GetItemID(row,&itemID) == noErr) && dataViewListCtrlPtr->IsItemSelected(itemID));
+} /* wxDataViewCtrl::IsSelected(unsigned int row) const */
+
+void wxDataViewCtrl::SetSelection(int row)
+{
+  wxArrayDataBrowserItemID selectedItemIDs;
+  
+  size_t NoOfSelections;
+  
+  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+
+  wxCHECK_RET(dataViewListCtrlPtr != NULL,_("Peer pointer not initialized."));  
+  if (row == -1) // unselect all selected items
+  {
+    NoOfSelections = dataViewListCtrlPtr->GetSelectedItemIDs(selectedItemIDs);
+    for (size_t i=0; i<NoOfSelections; ++i)
+      (void) dataViewListCtrlPtr->SetSelectedItems(1,&(selectedItemIDs[i]),kDataBrowserItemsRemove);
+  } /* if */
+  else if (row >= 0) // select specified item
+  {
+   // variable definition:
+    DataBrowserItemID itemID;
+    
+    verify_noerr(dataViewListCtrlPtr->GetItemID(row,&itemID));
+    verify_noerr(dataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsAdd)); // should also deselect automatically all other items
+  } /* if */
+} /* wxDataViewCtrl::SetSelection(int) */
+
+void wxDataViewCtrl::SetSelectionRange(unsigned int from, unsigned int to)
+{
+  wxCHECK_RET(from <= to,_("Invalid specified range ('from' has to be smaller or equal to 'to')."));
+  
+ // variable definition:
+  wxArrayInt selectedRows;
+  
+  selectedRows.Alloc(to-from+1);
+  for (unsigned int i=from; i<=to; ++i)
+    selectedRows.Add(i);
+  this->SetSelections(selectedRows);
+} /* wxDataViewCtrl::SetSelectionRange(unsigned int, unsigned int) */
+
+void wxDataViewCtrl::SetSelections(wxArrayInt const& selectedRows)
+{
+  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+  wxCHECK_RET(dataViewListCtrlPtr != NULL,_("Peer pointer not initialized."));  
+ // unselect all selected items:
+  this->SetSelection(-1);
+  for (size_t i=0; i<selectedRows.GetCount(); ++i)
+  {
+   // variable definition:
+    DataBrowserItemID itemID;
+    
+    verify_noerr(dataViewListCtrlPtr->GetItemID(selectedRows[i],&itemID));
+    verify_noerr(dataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsAssign));
+  } /* if */
+} /* wxDataViewCtrl::SetSelections(wxArrayInt const&) */
+
+void wxDataViewCtrl::Unselect(unsigned int row)
+{
+  DataBrowserItemID itemID;
+
+  wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+  wxCHECK_RET( dataViewListCtrlPtr != NULL,                                                                                                                 _("Peer pointer not initialized."));  
+  wxCHECK_RET((dataViewListCtrlPtr->GetItemID(row,&itemID) == noErr) && (dataViewListCtrlPtr->SetSelectedItems(1,&itemID,kDataBrowserItemsRemove) == noErr),_("Unselection impossible."));
+} /* wxDataViewCtrl::Unselect(unsigned int) */
+
+void wxDataViewCtrl::ReverseSorting(DataBrowserPropertyID columnID)
+{
+
+  if (columnID >= kMinPropertyID)
+  {
+   // variable definition and initialization:
+    DataBrowserPropertyID                          sortPropertyID;
+    wxMacDataViewDataBrowserListViewControlPointer dataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
+
+    wxCHECK_RET(dataViewListCtrlPtr != NULL,_("Peer pointer not initialized."));
+    wxCHECK_RET(dataViewListCtrlPtr->GetSortProperty(&sortPropertyID) == noErr,_("Determination of sort property impossible."));
+    if (sortPropertyID == columnID)
+    {
+     // variable defintion:
+      DataBrowserSortOrder         sortOrderCtrl;
+      DataBrowserTableViewColumnID columnIndex;
+      wxDataViewColumn*            dataViewColumnPtr;
+
+      wxCHECK_RET(dataViewListCtrlPtr->GetPropertyColumn(columnID,&columnIndex) == noErr,_("Determination of column index impossible"));
+      wxCHECK_RET(dataViewListCtrlPtr->GetSortOrder(&sortOrderCtrl)             == noErr,_("Determination of sort order impossible"));
+      dataViewColumnPtr = this->GetColumn(columnIndex);
+      wxCHECK_RET(dataViewColumnPtr != NULL,_("Column could not be obtained."));
+      if ((sortOrderCtrl == kDataBrowserOrderIncreasing) && !(dataViewColumnPtr->IsSortOrderAscending()) ||
+          (sortOrderCtrl == kDataBrowserOrderDecreasing) &&   dataViewColumnPtr->IsSortOrderAscending())
+        dataViewListCtrlPtr->ReverseRowIndexNumbering();
+    } /* if */
+  } /* if */
+} /* wxDataViewCtrl::ReverseSorting(DataBrowserPropertyID columnID) */
+
+IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase)
+
+BEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase)
+  EVT_SIZE(wxDataViewCtrl::OnSize)
+END_EVENT_TABLE()
+
+#endif
+    // !wxUSE_GENERICDATAVIEWCTRL
+
+#endif
+    // wxUSE_DATAVIEWCTRL
+