2 /////////////////////////////////////////////////////////////////////////////
3 // Name: wx/osx/core/dataview.h
4 // Purpose: wxDataViewCtrl native implementation header for OSX
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_DATAVIEWCTRL_CORE_H_
11 #define _WX_DATAVIEWCTRL_CORE_H_
13 #include "wx/dataview.h"
16 typedef wxMacControl wxWidgetImplType
;
18 typedef wxWidgetImpl wxWidgetImplType
;
21 // ---------------------------------------------------------
22 // Helper functions for dataview implementation on OSX
23 // ---------------------------------------------------------
24 wxWidgetImplType
* CreateDataView(wxWindowMac
* wxpeer
, wxWindowMac
* parent
, wxWindowID id
,
25 wxPoint
const& pos
, wxSize
const& size
,
26 long style
, long extraStyle
);
27 wxString
ConcatenateDataViewItemValues(wxDataViewCtrl
const* dataViewCtrlPtr
, wxDataViewItem
const& dataViewItem
); // concatenates all data of the visible columns of the passed control
28 // and item TAB separated into a string and returns it
30 // ---------------------------------------------------------
31 // wxDataViewWidgetImpl
32 // Common interface of the native dataview implementation
33 // for the carbon and cocoa environment.
35 // All methods assume that the passed column pointers are
36 // valid (unless a NULL pointer is explicitly allowed
39 // ---------------------------------------------------------
40 class WXDLLIMPEXP_CORE wxDataViewWidgetImpl
44 // constructors / destructor
46 virtual ~wxDataViewWidgetImpl(void)
51 // column related methods
53 virtual bool ClearColumns (void) = 0; // deletes all columns in the native control
54 virtual bool DeleteColumn (wxDataViewColumn
* columnPtr
) = 0; // deletes the column in the native control
55 virtual void DoSetExpanderColumn(wxDataViewColumn
const* columnPtr
) = 0; // sets the disclosure column in the native control
56 virtual wxDataViewColumn
* GetColumn (unsigned int pos
) const = 0; // returns the column belonging to 'pos' in the native control
57 virtual int GetColumnPosition (wxDataViewColumn
const* columnPtr
) const = 0; // returns the position of the passed column in the native control
58 virtual bool InsertColumn (unsigned int pos
, wxDataViewColumn
* columnPtr
) = 0; // inserts a column at pos in the native control;
59 // the method can assume that the column's owner is already set
60 virtual void FitColumnWidthToContent(unsigned int pos
) = 0; // resizes column to fit its content
63 // item related methods
65 virtual bool Add (wxDataViewItem
const& parent
, wxDataViewItem
const& item
) = 0; // adds an item to the native control
66 virtual bool Add (wxDataViewItem
const& parent
, wxDataViewItemArray
const& itesm
) = 0; // adds a items to the native control
67 virtual void Collapse (wxDataViewItem
const& item
) = 0; // collapses the passed item in the native control
68 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)
69 virtual void Expand (wxDataViewItem
const& item
) = 0; // expands the passed item in the native control
70 virtual unsigned int GetCount (void) const = 0; // returns the number of items in the native control
71 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
72 virtual bool IsExpanded (wxDataViewItem
const& item
) const = 0; // checks if the passed item is expanded in the native control
73 virtual bool Reload (void) = 0; // clears the native control and reloads all data
74 virtual bool Remove (wxDataViewItem
const& parent
, wxDataViewItem
const& item
) = 0; // removes an item from the native control
75 virtual bool Remove (wxDataViewItem
const& parent
, wxDataViewItemArray
const& item
) = 0; // removes items from the native control
76 virtual bool Update (wxDataViewColumn
const* columnPtr
) = 0; // updates the items in the passed column of the native control
77 virtual bool Update (wxDataViewItem
const& parent
, wxDataViewItem
const& item
) = 0; // updates the passed item in the native control
78 virtual bool Update (wxDataViewItem
const& parent
, wxDataViewItemArray
const& items
) = 0; // updates the passed items in the native control
81 // model related methods
83 virtual bool AssociateModel(wxDataViewModel
* model
) = 0; // informs the native control that a model is present
86 // selection related methods
88 virtual wxDataViewItem
GetCurrentItem() const = 0;
89 virtual void SetCurrentItem(const wxDataViewItem
& item
) = 0;
91 virtual wxDataViewColumn
*GetCurrentColumn() const = 0;
93 virtual int GetSelectedItemsCount() const = 0;
94 virtual int GetSelections(wxDataViewItemArray
& sel
) const = 0; // returns all selected items in the native control
95 virtual bool IsSelected (wxDataViewItem
const& item
) const = 0; // checks if the passed item is selected in the native control
96 virtual void Select (wxDataViewItem
const& item
) = 0; // selects the passed item in the native control
97 virtual void SelectAll (void) = 0; // selects all items in the native control
98 virtual void Unselect (wxDataViewItem
const& item
) = 0; // unselects the passed item in the native control
99 virtual void UnselectAll (void) = 0; // unselects all items in the native control
102 // sorting related methods
104 virtual wxDataViewColumn
* GetSortingColumn (void) const = 0; // returns the column that is primarily responsible for sorting in the native control
105 virtual void Resort (void) = 0; // asks the native control to start a resorting process
110 virtual void DoSetIndent (int indent
) = 0; // sets the indention in the native control
111 virtual void HitTest (wxPoint
const& point
, wxDataViewItem
& item
, wxDataViewColumn
*& columnPtr
) const = 0; // return the item and column pointer that contains with the passed point
112 virtual void SetRowHeight(wxDataViewItem
const& item
, unsigned int height
) = 0; // sets the height of the row containg the passed item in the native control
113 virtual void OnSize (void) = 0; // updates the layout of the native control after a size event
114 virtual void StartEditor( const wxDataViewItem
& item
, unsigned int column
) = 0; // starts editing the passed in item and column
117 #endif // _WX_DATAVIEWCTRL_CORE_H_