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. Note
92 that there is a number of short cut methods which implicitly create
93 a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} and a
94 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} for it (see below).
97 \membersection{wxDataViewCtrl::AppendBitmapColumn
}\label{wxdataviewctrlappendbitmapcolumn
}
99 \func{bool
}{AppendBitmapColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
101 \func{bool
}{AppendBitmapColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
103 Appends a column for rendering a bitmap.
105 \membersection{wxDataViewCtrl::AppendDateColumn
}\label{wxdataviewctrlappenddatecolumn
}
107 \func{bool
}{AppendDateColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE},
\param{int
}{width = -
1}}
109 \func{bool
}{AppendDateColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE},
\param{int
}{width = -
1}}
111 Appends a column for rendering a date.
113 \membersection{wxDataViewCtrl::AppendProgressColumn
}\label{wxdataviewctrlappendprogresscolumn
}
115 \func{bool
}{AppendProgressColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
80}}
117 \func{bool
}{AppendProgressColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
80}}
119 Appends a column for rendering a progress indicator.
121 \membersection{wxDataViewCtrl::AppendTextColumn
}\label{wxdataviewctrlappendtextcolumn
}
123 \func{bool
}{AppendTextColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
125 \func{bool
}{AppendTextColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
127 Appends a column for rendering text.
129 \membersection{wxDataViewCtrl::AppendToggleColumn
}\label{wxdataviewctrlappendtogglecolumn
}
131 \func{bool
}{AppendToggleColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
30}}
133 \func{bool
}{AppendToggleColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
30}}
135 Appends a column for rendering a toggle.
137 \membersection{wxDataViewCtrl::AssociateModel
}\label{wxdataviewctrlassociatemodel
}
139 \func{virtual bool
}{AssociateModel
}{\param{wxDataViewModel*
}{model
}}
141 Associates a
\helpref{wxDataViewModel
}{wxdataviewmodel
} with the
144 \membersection{wxDataViewCtrl::Create
}\label{wxdataviewctrlcreate
}
146 \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
}}
148 Create the control. Useful for two step creation.
150 \membersection{wxDataViewCtrl::ClearColumns
}\label{wxdataviewctrlclearcolumns
}
152 \func{virtual bool
}{ClearColumns
}{\void}
156 \membersection{wxDataViewCtrl::ClearSelection
}\label{wxdataviewctrlclearselection
}
158 \func{void
}{ClearSelection
}{\void}
162 \membersection{wxDataViewCtrl::DeleteColumn
}\label{wxdataviewctrldeletecolumn
}
164 \func{virtual bool
}{DeleteColumn
}{\param{unsigned int
}{pos
}}
166 Deletes given column.
168 \membersection{wxDataViewCtrl::GetColumn
}\label{wxdataviewctrlgetcolumn
}
170 \func{virtual wxDataViewColumn*
}{GetColumn
}{\param{unsigned int
}{pos
}}
172 Returns pointer to the column.
174 \membersection{wxDataViewCtrl::GetModel
}\label{wxdataviewctrlgetmodel
}
176 \func{virtual wxDataViewModel*
}{GetModel
}{\void}
178 Returns pointer to the data model associated with the
181 \membersection{wxDataViewCtrl::GetColumnCount
}\label{wxdataviewctrlgetcolumncount
}
183 \func{virtual unsigned int
}{GetColumnCount
}{\void}
185 Returns the number of columns.
187 \membersection{wxDataViewCtrl::EnsureVisible
}\label{wxdataviewctrlensurevisible
}
189 \func{void
}{EnsureVisible
}{\param{const wxDataViewItem \&
}{item
},
\param{wxDataViewColumn*
}{column = NULL
}}
191 Call this to ensure that the given item is visible.
193 \membersection{wxDataViewCtrl::GetExpanderColumn
}\label{wxdataviewctrlgetexpandercolumn
}
195 \constfunc{unsigned int
}{GetExpanderColumn
}{\void}
197 Returns column containing the expanders.
199 \membersection{wxDataViewCtrl::GetIndent
}\label{wxdataviewctrlgetindent
}
201 \constfunc{int
}{GetIndent
}{\void}
205 \membersection{wxDataViewCtrl::GetItemRect
}\label{wxdataviewctrlgetitemrect
}
207 \constfunc{wxRect
}{GetItemRect
}{\param{const wxDataViewItem\&
}{item
},
\param{unsigned int
}{column
}}
211 \membersection{wxDataViewCtrl::GetSelection
}\label{wxdataviewctrlgetselection
}
213 \func{wxDataViewItem
}{GetSelection
}{\void}
215 Returns first selected item or an invalid item if none is selected.
217 \membersection{wxDataViewCtrl::GetSelections
}\label{wxdataviewctrlgetselections
}
219 \constfunc{int
}{GetSelections
}{\param{wxDataViewItemArray \&
}{sel
}}
221 Fills
{\it sel
} with currently selected items and returns
224 \membersection{wxDataViewCtrl::HitTest
}\label{wxdataviewctrlhittest
}
226 \constfunc{void
}{HitTest
}{\param{const wxPoint\&
}{point
},
\param{wxDataViewItem\&
}{item
},
\param{unsigned int\&
}{column
}}
230 \membersection{wxDataViewCtrl::IsSelected
}\label{wxdataviewctrlisselected
}
232 \constfunc{bool
}{IsSelected
}{\param{const wxDataViewItem \&
}{item
}}
234 Return true if the item is selected.
236 \membersection{wxDataViewCtrl::Select
}\label{wxdataviewctrlselect
}
238 \func{void
}{Select
}{\param{const wxDataViewItem \&
}{item
}}
240 Select the given item.
242 \membersection{wxDataViewCtrl::SelectAll
}\label{wxdataviewctrlselectall
}
244 \func{void
}{SelectAll
}{\void}
248 \membersection{wxDataViewCtrl::SetExpanderColumn
}\label{wxdataviewctrlsetexpandercolumn
}
250 \func{void
}{SetExpanderColumn
}{\param{unsigned int
}{col
}}
252 Set which column shall contain the tree-like expanders.
254 \membersection{wxDataViewCtrl::SetIndent
}\label{wxdataviewctrlsetindent
}
256 \func{void
}{SetIndent
}{\param{int
}{indent
}}
258 Sets the indendation.
260 \membersection{wxDataViewCtrl::SetSelections
}\label{wxdataviewctrlsetselections
}
262 \func{void
}{SetSelections
}{\param{const wxDataViewItemArray \&
}{sel
}}
264 Sets the selection to the array of wxDataViewItems.
266 \membersection{wxDataViewCtrl::Unselect
}\label{wxdataviewctrlunselect
}
268 \func{void
}{Unselect
}{\param{const wxDataViewItem \&
}{item
}}
270 Unselect the given item.
272 \membersection{wxDataViewCtrl::UnselectAll
}\label{wxdataviewctrlunselectall
}
274 \func{void
}{UnselectAll
}{\void}
276 Unselect all item. This method only has effect if multiple
277 selections are allowed.