]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | ///////////////////////////////////////////////////////////////////////////// | |
3 | // Name: wx/osx/core/dataview.h | |
4 | // Purpose: wxDataViewCtrl native implementation header for OSX | |
5 | // Author: | |
6 | // Copyright: (c) 2009 | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_DATAVIEWCTRL_CORE_H_ | |
11 | #define _WX_DATAVIEWCTRL_CORE_H_ | |
12 | ||
13 | #include "wx/dataview.h" | |
14 | ||
15 | #if wxOSX_USE_CARBON | |
16 | typedef wxMacControl wxWidgetImplType; | |
17 | #else | |
18 | typedef wxWidgetImpl wxWidgetImplType; | |
19 | #endif | |
20 | ||
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 | |
29 | ||
30 | // --------------------------------------------------------- | |
31 | // wxDataViewWidgetImpl | |
32 | // Common interface of the native dataview implementation | |
33 | // for the carbon and cocoa environment. | |
34 | // ATTENTION | |
35 | // All methods assume that the passed column pointers are | |
36 | // valid (unless a NULL pointer is explicitly allowed | |
37 | // to be passed)! | |
38 | // ATTENTION | |
39 | // --------------------------------------------------------- | |
40 | class WXDLLIMPEXP_CORE wxDataViewWidgetImpl | |
41 | { | |
42 | public: | |
43 | // | |
44 | // constructors / destructor | |
45 | // | |
46 | virtual ~wxDataViewWidgetImpl(void) | |
47 | { | |
48 | } | |
49 | ||
50 | // | |
51 | // column related methods | |
52 | // | |
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 | |
61 | ||
62 | // | |
63 | // item related methods | |
64 | // | |
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 | |
79 | ||
80 | // | |
81 | // model related methods | |
82 | // | |
83 | virtual bool AssociateModel(wxDataViewModel* model) = 0; // informs the native control that a model is present | |
84 | ||
85 | // | |
86 | // selection related methods | |
87 | // | |
88 | virtual wxDataViewItem GetCurrentItem() const = 0; | |
89 | virtual void SetCurrentItem(const wxDataViewItem& item) = 0; | |
90 | ||
91 | virtual wxDataViewColumn *GetCurrentColumn() const = 0; | |
92 | ||
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 | |
100 | ||
101 | // | |
102 | // sorting related methods | |
103 | // | |
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 | |
106 | ||
107 | // | |
108 | // other methods | |
109 | // | |
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 | |
115 | }; | |
116 | ||
117 | #endif // _WX_DATAVIEWCTRL_CORE_H_ |