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