2 \section{\class{wxDataViewCtrl
}}\label{wxdataviewctrl
}
4 wxDataViewCtrl is a control to display data either
5 in a tree like fashion or in a tabular form or both.
7 Unlike
\helpref{wxListCtrl
}{wxlistctrl
} wxDataViewCtrl doesn't
8 get its data from the user through virtual functions or by
9 setting it directly. Instead you need to write your own
10 \helpref{wxDataViewModel
}{wxdataviewmodel
} and associate
11 it with this control. Then you need to add a number of
12 \helpref{wxDataViewColumn
}{wxdataviewcolumn
} to this control to
13 define what each column shall display. Each wxDataViewColumn
14 in turn owns
1 instance of a
15 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} to render its
16 cells. A number of standard renderers for rendering text, dates,
17 images, toggle, a progress bar etc. are provided. Additionally,
18 the user can write custom renderes deriving from
19 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}
20 for displaying anything.
22 All data transfer from the control to the model and the user
23 code is done through
\helpref{wxVariant
}{wxvariant
} which can
24 be extended to support more data formats as necessary.
25 Accordingly, all type information uses the strings returned
26 from
\helpref{wxVariant::GetType
}{wxvariantgettype
}.
28 \wxheading{Window styles
}
31 \begin{twocollist
}\itemsep=
0pt
32 \twocolitem{\windowstyle{wxDV
\_SINGLE}}{Single selection mode. This is the default.
}
33 \twocolitem{\windowstyle{wxDV
\_MULTIPLE}}{Multiple selection mode.
}
37 \wxheading{Event handling
}
39 To process input from a dataview control, use the following event handler
40 macros to direct input to member functions that take a
41 \helpref{wxDataViewEvent
}{wxdataviewevent
} argument.
44 \begin{twocollist
}\itemsep=
0pt
46 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_SELECTED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_SELECTED event.
}
47 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_ACTIVATED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_ACTIVATED event.
}
48 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.
}
49 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.
}
50 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_SORTED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_SORTED event.
}
55 \wxheading{Derived from
}
57 \helpref{wxControl
}{wxcontrol
}\\
58 \helpref{wxWindow
}{wxwindow
}\\
59 \helpref{wxEvtHandler
}{wxevthandler
}\\
60 \helpref{wxObject
}{wxobject
}
62 \wxheading{Include files
}
68 \helpref{wxAdv
}{librarieslist
}
71 \latexignore{\rtfignore{\wxheading{Members
}}}
73 \membersection{wxDataViewCtrl::wxDataViewCtrl
}\label{wxdataviewctrlwxdataviewctrl
}
75 \func{}{wxDataViewCtrl
}{\void}
77 \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 Constructor. Calls
\helpref{Create
}{wxdataviewctrlcreate
}.
81 \membersection{wxDataViewCtrl::
\destruct{wxDataViewCtrl
}}\label{wxdataviewctrldtor
}
83 \func{}{\destruct{wxDataViewCtrl
}}{\void}
87 \membersection{wxDataViewCtrl::AppendColumn
}\label{wxdataviewctrlappendcolumn
}
89 \func{virtual bool
}{AppendColumn
}{\param{wxDataViewColumn*
}{col
}}
91 Add a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} to the control. Returns
92 {\it true
} on success.
94 Note that there is a number of short cut methods which implicitly create
95 a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} and a
96 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} for it (see below).
98 \membersection{wxDataViewCtrl::AppendBitmapColumn
}\label{wxdataviewctrlappendbitmapcolumn
}
100 \func{wxDataViewColumn*
}{AppendBitmapColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
102 \func{wxDataViewColumn*
}{AppendBitmapColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
104 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
105 created in the function or NULL on failure.
107 \membersection{wxDataViewCtrl::AppendDateColumn
}\label{wxdataviewctrlappenddatecolumn
}
109 \func{wxDataViewColumn*
}{AppendDateColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE},
\param{int
}{width = -
1}}
111 \func{wxDataViewColumn*
}{AppendDateColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE},
\param{int
}{width = -
1}}
113 Appends a column for rendering a date. Returns the wxDataViewColumn
114 created in the function or NULL on failure.
116 \membersection{wxDataViewCtrl::AppendProgressColumn
}\label{wxdataviewctrlappendprogresscolumn
}
118 \func{wxDataViewColumn*
}{AppendProgressColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
80}}
120 \func{wxDataViewColumn*
}{AppendProgressColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
80}}
122 Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
123 created in the function or NULL on failure.
125 \membersection{wxDataViewCtrl::AppendTextColumn
}\label{wxdataviewctrlappendtextcolumn
}
127 \func{wxDataViewColumn*
}{AppendTextColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
129 \func{wxDataViewColumn*
}{AppendTextColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
131 Appends a column for rendering text. Returns the wxDataViewColumn
132 created in the function or NULL on failure.
134 \membersection{wxDataViewCtrl::AppendToggleColumn
}\label{wxdataviewctrlappendtogglecolumn
}
136 \func{wxDataViewColumn*
}{AppendToggleColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
30}}
138 \func{wxDataViewColumn*
}{AppendToggleColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
30}}
140 Appends a column for rendering a toggle. Returns the wxDataViewColumn
141 created in the function or NULL on failure.
143 \membersection{wxDataViewCtrl::AssociateModel
}\label{wxdataviewctrlassociatemodel
}
145 \func{virtual bool
}{AssociateModel
}{\param{wxDataViewModel*
}{model
}}
147 Associates a
\helpref{wxDataViewModel
}{wxdataviewmodel
} with the
150 \membersection{wxDataViewCtrl::Create
}\label{wxdataviewctrlcreate
}
152 \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
}}
154 Create the control. Useful for two step creation.
156 \membersection{wxDataViewCtrl::ClearColumns
}\label{wxdataviewctrlclearcolumns
}
158 \func{virtual bool
}{ClearColumns
}{\void}
162 \membersection{wxDataViewCtrl::ClearSelection
}\label{wxdataviewctrlclearselection
}
164 \func{void
}{ClearSelection
}{\void}
168 \membersection{wxDataViewCtrl::DeleteColumn
}\label{wxdataviewctrldeletecolumn
}
170 \func{virtual bool
}{DeleteColumn
}{\param{unsigned int
}{pos
}}
172 Deletes given column.
174 \membersection{wxDataViewCtrl::GetColumn
}\label{wxdataviewctrlgetcolumn
}
176 \func{virtual wxDataViewColumn*
}{GetColumn
}{\param{unsigned int
}{pos
}}
178 Returns pointer to the column.
180 \membersection{wxDataViewCtrl::GetModel
}\label{wxdataviewctrlgetmodel
}
182 \func{virtual wxDataViewModel*
}{GetModel
}{\void}
184 Returns pointer to the data model associated with the
187 \membersection{wxDataViewCtrl::GetColumnCount
}\label{wxdataviewctrlgetcolumncount
}
189 \func{virtual unsigned int
}{GetColumnCount
}{\void}
191 Returns the number of columns.
193 \membersection{wxDataViewCtrl::EnsureVisible
}\label{wxdataviewctrlensurevisible
}
195 \func{void
}{EnsureVisible
}{\param{const wxDataViewItem \&
}{item
},
\param{wxDataViewColumn*
}{column = NULL
}}
197 Call this to ensure that the given item is visible.
199 \membersection{wxDataViewCtrl::GetExpanderColumn
}\label{wxdataviewctrlgetexpandercolumn
}
201 \constfunc{unsigned int
}{GetExpanderColumn
}{\void}
203 Returns column containing the expanders.
205 \membersection{wxDataViewCtrl::GetIndent
}\label{wxdataviewctrlgetindent
}
207 \constfunc{int
}{GetIndent
}{\void}
211 \membersection{wxDataViewCtrl::GetItemRect
}\label{wxdataviewctrlgetitemrect
}
213 \constfunc{wxRect
}{GetItemRect
}{\param{const wxDataViewItem\&
}{item
},
\param{unsigned int
}{column
}}
217 \membersection{wxDataViewCtrl::GetSelection
}\label{wxdataviewctrlgetselection
}
219 \func{wxDataViewItem
}{GetSelection
}{\void}
221 Returns first selected item or an invalid item if none is selected.
223 \membersection{wxDataViewCtrl::GetSelections
}\label{wxdataviewctrlgetselections
}
225 \constfunc{int
}{GetSelections
}{\param{wxDataViewItemArray \&
}{sel
}}
227 Fills
{\it sel
} with currently selected items and returns
230 \membersection{wxDataViewCtrl::HitTest
}\label{wxdataviewctrlhittest
}
232 \constfunc{void
}{HitTest
}{\param{const wxPoint\&
}{point
},
\param{wxDataViewItem\&
}{item
},
\param{unsigned int\&
}{column
}}
236 \membersection{wxDataViewCtrl::IsSelected
}\label{wxdataviewctrlisselected
}
238 \constfunc{bool
}{IsSelected
}{\param{const wxDataViewItem \&
}{item
}}
240 Return true if the item is selected.
242 \membersection{wxDataViewCtrl::Select
}\label{wxdataviewctrlselect
}
244 \func{void
}{Select
}{\param{const wxDataViewItem \&
}{item
}}
246 Select the given item.
248 \membersection{wxDataViewCtrl::SelectAll
}\label{wxdataviewctrlselectall
}
250 \func{void
}{SelectAll
}{\void}
254 \membersection{wxDataViewCtrl::SetExpanderColumn
}\label{wxdataviewctrlsetexpandercolumn
}
256 \func{void
}{SetExpanderColumn
}{\param{unsigned int
}{col
}}
258 Set which column shall contain the tree-like expanders.
260 \membersection{wxDataViewCtrl::SetIndent
}\label{wxdataviewctrlsetindent
}
262 \func{void
}{SetIndent
}{\param{int
}{indent
}}
264 Sets the indendation.
266 \membersection{wxDataViewCtrl::SetSelections
}\label{wxdataviewctrlsetselections
}
268 \func{void
}{SetSelections
}{\param{const wxDataViewItemArray \&
}{sel
}}
270 Sets the selection to the array of wxDataViewItems.
272 \membersection{wxDataViewCtrl::Unselect
}\label{wxdataviewctrlunselect
}
274 \func{void
}{Unselect
}{\param{const wxDataViewItem \&
}{item
}}
276 Unselect the given item.
278 \membersection{wxDataViewCtrl::UnselectAll
}\label{wxdataviewctrlunselectall
}
280 \func{void
}{UnselectAll
}{\void}
282 Unselect all item. This method only has effect if multiple
283 selections are allowed.