2 /////////////////////////////////////////////////////////////////////////////
3 // Name: wx/osx/core/dataview.h
4 // Purpose: wxDataViewCtrl native implementation header for OSX
6 // Id: $Id: dataview.h 57374 2009-01-27
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DATAVIEWCTRL_CORE_H_
12 #define _WX_DATAVIEWCTRL_CORE_H_
14 #include "wx/dataview.h"
17 typedef wxMacControl wxWidgetImplType
;
19 typedef wxWidgetImpl wxWidgetImplType
;
22 // ---------------------------------------------------------
23 // Helper functions for dataview implementation on OSX
24 // ---------------------------------------------------------
25 wxWidgetImplType
* CreateDataView(wxWindowMac
* wxpeer
, wxWindowMac
* parent
, wxWindowID id
,
26 wxPoint
const& pos
, wxSize
const& size
,
27 long style
, long extraStyle
);
28 wxString
ConcatenateDataViewItemValues(wxDataViewCtrl
const* dataViewCtrlPtr
, wxDataViewItem
const& dataViewItem
); // concatenates all data of the visible columns of the passed control
29 // and item TAB separated into a string and returns it
31 // ---------------------------------------------------------
32 // wxDataViewWidgetImpl
33 // Common interface of the native dataview implementation
34 // for the carbon and cocoa environment.
36 // All methods assume that the passed column pointers are
37 // valid (unless a NULL pointer is explicitly allowed
40 // ---------------------------------------------------------
41 class WXDLLIMPEXP_CORE wxDataViewWidgetImpl
45 // constructors / destructor
47 virtual ~wxDataViewWidgetImpl(void)
52 // column related methods
54 virtual bool ClearColumns (void) = 0; // deletes all columns in the native control
55 virtual bool DeleteColumn (wxDataViewColumn
* columnPtr
) = 0; // deletes the column in the native control
56 virtual void DoSetExpanderColumn(wxDataViewColumn
const* columnPtr
) = 0; // sets the disclosure column in the native control
57 virtual wxDataViewColumn
* GetColumn (unsigned int pos
) const = 0; // returns the column belonging to 'pos' in the native control
58 virtual int GetColumnPosition (wxDataViewColumn
const* columnPtr
) const = 0; // returns the position of the passed column in the native control
59 virtual bool InsertColumn (unsigned int pos
, wxDataViewColumn
* columnPtr
) = 0; // inserts a column at pos in the native control;
60 // the method can assume that the column's owner is already set
61 virtual void FitColumnWidthToContent(unsigned int pos
) = 0; // resizes column to fit its content
64 // item related methods
66 virtual bool Add (wxDataViewItem
const& parent
, wxDataViewItem
const& item
) = 0; // adds an item to the native control
67 virtual bool Add (wxDataViewItem
const& parent
, wxDataViewItemArray
const& itesm
) = 0; // adds a items to the native control
68 virtual void Collapse (wxDataViewItem
const& item
) = 0; // collapses the passed item in the native control
69 virtual void EnsureVisible(wxDataViewItem
const& item
, wxDataViewColumn
const* columnPtr
) = 0; // ensures that the passed item's value in the passed column is visible (column pointer can be NULL)
70 virtual void Expand (wxDataViewItem
const& item
) = 0; // expands the passed item in the native control
71 virtual unsigned int GetCount (void) const = 0; // returns the number of items in the native control
72 virtual wxRect
GetRectangle (wxDataViewItem
const& item
, wxDataViewColumn
const* columnPtr
) = 0; // returns the rectangle that is used by the passed item and column in the native control
73 virtual bool IsExpanded (wxDataViewItem
const& item
) const = 0; // checks if the passed item is expanded in the native control
74 virtual bool Reload (void) = 0; // clears the native control and reloads all data
75 virtual bool Remove (wxDataViewItem
const& parent
, wxDataViewItem
const& item
) = 0; // removes an item from the native control
76 virtual bool Remove (wxDataViewItem
const& parent
, wxDataViewItemArray
const& item
) = 0; // removes items from the native control
77 virtual bool Update (wxDataViewColumn
const* columnPtr
) = 0; // updates the items in the passed column of the native control
78 virtual bool Update (wxDataViewItem
const& parent
, wxDataViewItem
const& item
) = 0; // updates the passed item in the native control
79 virtual bool Update (wxDataViewItem
const& parent
, wxDataViewItemArray
const& items
) = 0; // updates the passed items in the native control
82 // model related methods
84 virtual bool AssociateModel(wxDataViewModel
* model
) = 0; // informs the native control that a model is present
87 // selection related methods
89 virtual wxDataViewItem
GetCurrentItem() const = 0;
90 virtual void SetCurrentItem(const wxDataViewItem
& item
) = 0;
92 virtual wxDataViewColumn
*GetCurrentColumn() const = 0;
94 virtual int GetSelectedItemsCount() const = 0;
95 virtual int GetSelections(wxDataViewItemArray
& sel
) const = 0; // returns all selected items in the native control
96 virtual bool IsSelected (wxDataViewItem
const& item
) const = 0; // checks if the passed item is selected in the native control
97 virtual void Select (wxDataViewItem
const& item
) = 0; // selects the passed item in the native control
98 virtual void SelectAll (void) = 0; // selects all items in the native control
99 virtual void Unselect (wxDataViewItem
const& item
) = 0; // unselects the passed item in the native control
100 virtual void UnselectAll (void) = 0; // unselects all items in the native control
103 // sorting related methods
105 virtual wxDataViewColumn
* GetSortingColumn (void) const = 0; // returns the column that is primarily responsible for sorting in the native control
106 virtual void Resort (void) = 0; // asks the native control to start a resorting process
111 virtual void DoSetIndent (int indent
) = 0; // sets the indention in the native control
112 virtual void HitTest (wxPoint
const& point
, wxDataViewItem
& item
, wxDataViewColumn
*& columnPtr
) const = 0; // return the item and column pointer that contains with the passed point
113 virtual void SetRowHeight(wxDataViewItem
const& item
, unsigned int height
) = 0; // sets the height of the row containg the passed item in the native control
114 virtual void OnSize (void) = 0; // updates the layout of the native control after a size event
115 virtual void StartEditor( const wxDataViewItem
& item
, unsigned int column
) = 0; // starts editing the passed in item and column
118 #endif // _WX_DATAVIEWCTRL_CORE_H_