File: dataviewctrl.tex

package info (click to toggle)
wxwidgets2.8 2.8.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 239,052 kB
  • ctags: 289,550
  • sloc: cpp: 1,838,857; xml: 396,717; python: 282,506; ansic: 126,171; makefile: 51,406; sh: 14,581; asm: 299; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 39; lisp: 38; tcl: 24; haskell: 20; java: 18; cs: 18; erlang: 17; ruby: 16; ada: 9; ml: 9; csh: 9
file content (230 lines) | stat: -rw-r--r-- 9,582 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230

\section{\class{wxDataViewCtrl}}\label{wxdataviewctrl}

This class and its documentation are work in progress and
certainly subject to change.

wxDataViewCtrl is planned to be a control to display data either
in a tree like fashion or in a tabular form or both. Currently,
only the tabular form is implemented. wxDataViewCtrl doesn't
get its data from the user through virtual functions or events,
instead you need to write your own 
\helpref{wxDataViewListModel}{wxdataviewlistmodel} and associate
it with this control. Then you need to add a number of
\helpref{wxDataViewColumn}{wxdataviewcolumn} to this control to
define what each column shall display. Each wxDataViewColumn
in turn owns 1 instance of a 
\helpref{wxDataViewRenderer}{wxdataviewrenderer} to render its
cells. A number of standard renderers for rendering text, dates,
images, toggle, a progress bar etc. are provided. Additionally,
the user can write custom renderes deriving from 
\helpref{wxDataViewCustomRenderer}{wxdataviewcustomrenderer}
for displaying anything.

All data transfer from the control to the model and the user
code is done through \helpref{wxVariant}{wxvariant} which can
be extended to support more data formats as necessary. 
Accordingly, all type information uses the strings returned
from \helpref{wxVariant::GetType}{wxvariantgettype}.

So far, this control has only be implemented for GTK+ and
there are only barely working stubs for a generic implementation.
It is planned to implement the control natively under OS X
and use generic code under Windows (and elsewhere).

\wxheading{Window styles}

\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxDV\_SINGLE}}{Single selection mode. This is the default.}
\twocolitem{\windowstyle{wxDV\_MULTIPLE}}{Multiple selection mode.}
\end{twocollist}


\wxheading{Event handling}

To process input from a dataview control, use the following event handler
macros to direct input to member functions that take a 
\helpref{wxDataViewEvent}{wxdataviewevent} argument.

\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt

\twocolitem{{\bf EVT\_DATAVIEW\_ROW\_SELECTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ROW\_SELECTED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_ROW\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ROW\_ACTIVATED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.}

\end{twocollist}



\wxheading{Derived from}

\helpref{wxControl}{wxcontrol}

\wxheading{Include files}

<wx/dataview.h>


\membersection{wxDataViewCtrl::wxDataViewCtrl}\label{wxdataviewctrlwxdataviewctrl}

\func{}{wxDataViewCtrl}{\void}

\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}}

Constructor. Calls \helpref{Create}{wxdataviewctrlcreate}.

\membersection{wxDataViewCtrl::\destruct{wxDataViewCtrl}}\label{wxdataviewctrldtor}

\func{}{\destruct{wxDataViewCtrl}}{\void}

Destructor.

\membersection{wxDataViewCtrl::AppendColumn}\label{wxdataviewctrlappendcolumn}

\func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}

Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Note
that there is a number of short cut methods which implicitly create
a \helpref{wxDataViewColumn}{wxdataviewcolumn} and a 
\helpref{wxDataViewRenderer}{wxdataviewrenderer} for it (see below).


\membersection{wxDataViewCtrl::AppendBitmapColumn}\label{wxdataviewctrlappendbitmapcolumn}

\func{bool}{AppendBitmapColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}

\func{bool}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}

Appends a column for rendering a bitmap.

\membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}

\func{bool}{AppendDateColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}

\func{bool}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}

Appends a column for rendering a date.

\membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}

\func{bool}{AppendProgressColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}

\func{bool}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}

Appends a column for rendering a progress indicator.

\membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}

\func{bool}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}

\func{bool}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}

Appends a column for rendering text.

\membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}

\func{bool}{AppendToggleColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}

\func{bool}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}

Appends a column for rendering a toggle.

\membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}

\func{virtual bool}{AssociateModel}{\param{wxDataViewListModel* }{model}}

Associates a \helpref{wxDataViewListModel}{wxdataviewlistmodel} with the
control. In the future this should be changed to supporting any data
model including a to-be-written wxDataViewTreeModel.

\membersection{wxDataViewCtrl::Create}\label{wxdataviewctrlcreate}

\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}}

Create the control. Useful for two step creation.

\membersection{wxDataViewCtrl::ClearColumns}\label{wxdataviewctrlclearcolumns}

\func{virtual bool}{ClearColumns}{\void}

Removes all columns.

\membersection{wxDataViewCtrl::ClearSelection}\label{wxdataviewctrlclearselection}

\func{void}{ClearSelection}{\void}

Unselects all rows.

\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}

\func{virtual bool}{DeleteColumn}{\param{unsigned int }{pos}}

Deletes given column.

\membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}

\func{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}

Returns pointer to the column.

\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}

\func{virtual wxDataViewListModel*}{GetModel}{\void}

Returns pointer to the data model associated with the
control (if any).

\membersection{wxDataViewCtrl::GetNumberOfColumns}\label{wxdataviewctrlgetnumberofcolumns}

\func{virtual unsigned int}{GetNumberOfColumns}{\void}

Returns the number of columns.

\membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}

\constfunc{virtual int}{GetSelection}{\void}

Returns the index of the currently selected row. It will 
return -1 if no row is selected and the index of the first
selected row if more than one row are selected.

\membersection{wxDataViewCtrl::GetSelections}\label{wxdataviewctrlgetselections}

\constfunc{virtual int}{GetSelections}{\param{wxArrayInt\& }{aSelections}}

Returns the number of selected rows and fills an array of int
with the indeces of the selected rows.

\membersection{wxDataViewCtrl::IsSelected}\label{wxdataviewctrlisselected}

\constfunc{virtual bool}{IsSelected}{\param{unsigned int }{row}}

Returns {\it true} if the row is selected, {\it false} otherwise.

\membersection{wxDataViewCtrl::SetSelection}\label{wxdataviewctrlsetselection}

\func{virtual void}{SetSelection}{\param{int }{row}}

Sets the selection. Use -1 to unselect all rows.

\membersection{wxDataViewCtrl::SetSelectionRange}\label{wxdataviewctrlsetselectionrange}

\func{virtual void}{SetSelectionRange}{\param{unsigned int }{from}, \param{unsigned int }{to}}

Set a range of selection.

\membersection{wxDataViewCtrl::SetSelections}\label{wxdataviewctrlsetselections}

\func{virtual void}{SetSelections}{\param{const wxArrayInt\& }{aSelections}}

Set the selection to the array of int.

\membersection{wxDataViewCtrl::Unselect}\label{wxdataviewctrlunselect}

\func{virtual void}{Unselect}{\param{unsigned int }{row}}

Unselect a particular row.