]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dataviewctrl.tex
GetMenuCount() returns size_t, not int
[wxWidgets.git] / docs / latex / wx / dataviewctrl.tex
CommitLineData
b6b9d556
RR
1
2\section{\class{wxDataViewCtrl}}\label{wxdataviewctrl}
3
4This class and its documentation are work in progress and
305c49a1 5therefore subject to change.
b6b9d556
RR
6
7wxDataViewCtrl is planned to be a control to display data either
305c49a1
RR
8in a tree like fashion or in a tabular form or both. So far,
9only the tabular form is implemented.
10
11Unlike \helpref{wxListCtrl}{wxlistctrl} wxDataViewCtrl doesn't
b6b9d556
RR
12get its data from the user through virtual functions or events,
13instead you need to write your own
14\helpref{wxDataViewListModel}{wxdataviewlistmodel} and associate
15it with this control. Then you need to add a number of
16\helpref{wxDataViewColumn}{wxdataviewcolumn} to this control to
17define what each column shall display. Each wxDataViewColumn
18in turn owns 1 instance of a
19\helpref{wxDataViewRenderer}{wxdataviewrenderer} to render its
20cells. A number of standard renderers for rendering text, dates,
21images, toggle, a progress bar etc. are provided. Additionally,
22the user can write custom renderes deriving from
23\helpref{wxDataViewCustomRenderer}{wxdataviewcustomrenderer}
24for displaying anything.
25
26All data transfer from the control to the model and the user
27code is done through \helpref{wxVariant}{wxvariant} which can
28be extended to support more data formats as necessary.
29Accordingly, all type information uses the strings returned
30from \helpref{wxVariant::GetType}{wxvariantgettype}.
31
305c49a1
RR
32So far, this control has been implemented for GTK+ and there
33is an almost complete generic implementation including several
34additions for a native Windows look and feel (in particular
35concerning the header). It is planned to implement the control
36natively under OS X.
b6b9d556
RR
37
38\wxheading{Window styles}
39
40\twocolwidtha{5cm}
41\begin{twocollist}\itemsep=0pt
42\twocolitem{\windowstyle{wxDV\_SINGLE}}{Single selection mode. This is the default.}
43\twocolitem{\windowstyle{wxDV\_MULTIPLE}}{Multiple selection mode.}
44\end{twocollist}
45
46
47\wxheading{Event handling}
48
49To process input from a dataview control, use the following event handler
50macros to direct input to member functions that take a
51\helpref{wxDataViewEvent}{wxdataviewevent} argument.
52
53\twocolwidtha{7cm}
54\begin{twocollist}\itemsep=0pt
55
56\twocolitem{{\bf EVT\_DATAVIEW\_ROW\_SELECTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ROW\_SELECTED event.}
57\twocolitem{{\bf EVT\_DATAVIEW\_ROW\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ROW\_ACTIVATED event.}
58\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.}
59\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.}
60
61\end{twocollist}
62
63
64
65\wxheading{Derived from}
66
67\helpref{wxControl}{wxcontrol}
68
69\wxheading{Include files}
70
71<wx/dataview.h>
72
73
74\membersection{wxDataViewCtrl::wxDataViewCtrl}\label{wxdataviewctrlwxdataviewctrl}
75
76\func{}{wxDataViewCtrl}{\void}
77
78\func{}{wxDataViewCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}}
79
80Constructor. Calls \helpref{Create}{wxdataviewctrlcreate}.
81
82\membersection{wxDataViewCtrl::\destruct{wxDataViewCtrl}}\label{wxdataviewctrldtor}
83
84\func{}{\destruct{wxDataViewCtrl}}{\void}
85
86Destructor.
87
88\membersection{wxDataViewCtrl::AppendColumn}\label{wxdataviewctrlappendcolumn}
89
90\func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}
91
92Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Note
93that there is a number of short cut methods which implicitly create
94a \helpref{wxDataViewColumn}{wxdataviewcolumn} and a
314cd032 95\helpref{wxDataViewRenderer}{wxdataviewrenderer} for it (see below).
b6b9d556
RR
96
97
98\membersection{wxDataViewCtrl::AppendBitmapColumn}\label{wxdataviewctrlappendbitmapcolumn}
99
100\func{bool}{AppendBitmapColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
101
102\func{bool}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
103
104Appends a column for rendering a bitmap.
105
106\membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}
107
108\func{bool}{AppendDateColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
109
110\func{bool}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
111
112Appends a column for rendering a date.
113
114\membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}
115
116\func{bool}{AppendProgressColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
117
118\func{bool}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
119
120Appends a column for rendering a progress indicator.
121
122\membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}
123
124\func{bool}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
125
126\func{bool}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
127
128Appends a column for rendering text.
129
130\membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}
131
132\func{bool}{AppendToggleColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
133
134\func{bool}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
135
136Appends a column for rendering a toggle.
137
138\membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}
139
140\func{virtual bool}{AssociateModel}{\param{wxDataViewListModel* }{model}}
141
142Associates a \helpref{wxDataViewListModel}{wxdataviewlistmodel} with the
143control. In the future this should be changed to supporting any data
144model including a to-be-written wxDataViewTreeModel.
145
146\membersection{wxDataViewCtrl::Create}\label{wxdataviewctrlcreate}
147
148\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}}
149
150Create the control. Useful for two step creation.
151
152\membersection{wxDataViewCtrl::ClearColumns}\label{wxdataviewctrlclearcolumns}
153
154\func{virtual bool}{ClearColumns}{\void}
155
156Removes all columns.
157
158\membersection{wxDataViewCtrl::ClearSelection}\label{wxdataviewctrlclearselection}
159
160\func{void}{ClearSelection}{\void}
161
162Unselects all rows.
163
164\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}
165
166\func{virtual bool}{DeleteColumn}{\param{unsigned int }{pos}}
167
168Deletes given column.
169
170\membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}
171
172\func{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}
173
174Returns pointer to the column.
175
176\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}
177
178\func{virtual wxDataViewListModel*}{GetModel}{\void}
179
180Returns pointer to the data model associated with the
181control (if any).
182
183\membersection{wxDataViewCtrl::GetNumberOfColumns}\label{wxdataviewctrlgetnumberofcolumns}
184
185\func{virtual unsigned int}{GetNumberOfColumns}{\void}
186
187Returns the number of columns.
188
189\membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}
190
191\constfunc{virtual int}{GetSelection}{\void}
192
193Returns the index of the currently selected row. It will
194return -1 if no row is selected and the index of the first
195selected row if more than one row are selected.
196
197\membersection{wxDataViewCtrl::GetSelections}\label{wxdataviewctrlgetselections}
198
199\constfunc{virtual int}{GetSelections}{\param{wxArrayInt\& }{aSelections}}
200
201Returns the number of selected rows and fills an array of int
202with the indeces of the selected rows.
203
204\membersection{wxDataViewCtrl::IsSelected}\label{wxdataviewctrlisselected}
205
206\constfunc{virtual bool}{IsSelected}{\param{unsigned int }{row}}
207
208Returns {\it true} if the row is selected, {\it false} otherwise.
209
210\membersection{wxDataViewCtrl::SetSelection}\label{wxdataviewctrlsetselection}
211
212\func{virtual void}{SetSelection}{\param{int }{row}}
213
214Sets the selection. Use -1 to unselect all rows.
215
216\membersection{wxDataViewCtrl::SetSelectionRange}\label{wxdataviewctrlsetselectionrange}
217
218\func{virtual void}{SetSelectionRange}{\param{unsigned int }{from}, \param{unsigned int }{to}}
219
220Set a range of selection.
221
222\membersection{wxDataViewCtrl::SetSelections}\label{wxdataviewctrlsetselections}
223
224\func{virtual void}{SetSelections}{\param{const wxArrayInt\& }{aSelections}}
225
226Set the selection to the array of int.
227
228\membersection{wxDataViewCtrl::Unselect}\label{wxdataviewctrlunselect}
229
230\func{virtual void}{Unselect}{\param{unsigned int }{row}}
231
232Unselect a particular row.
233