2 \section{\class{wxDataViewCtrl
}}\label{wxdataviewctrl
}
4 This class and its documentation are work in progress and
5 therefore subject to change.
7 wxDataViewCtrl is planned to be a control to display data either
8 in a tree like fashion or in a tabular form or both. So far,
9 only the tabular form is implemented.
11 Unlike
\helpref{wxListCtrl
}{wxlistctrl
} wxDataViewCtrl doesn't
12 get its data from the user through virtual functions or events,
13 instead you need to write your own
14 \helpref{wxDataViewListModel
}{wxdataviewlistmodel
} and associate
15 it with this control. Then you need to add a number of
16 \helpref{wxDataViewColumn
}{wxdataviewcolumn
} to this control to
17 define what each column shall display. Each wxDataViewColumn
18 in turn owns
1 instance of a
19 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} to render its
20 cells. A number of standard renderers for rendering text, dates,
21 images, toggle, a progress bar etc. are provided. Additionally,
22 the user can write custom renderes deriving from
23 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}
24 for displaying anything.
26 All data transfer from the control to the model and the user
27 code is done through
\helpref{wxVariant
}{wxvariant
} which can
28 be extended to support more data formats as necessary.
29 Accordingly, all type information uses the strings returned
30 from
\helpref{wxVariant::GetType
}{wxvariantgettype
}.
32 So far, this control has been implemented for GTK+ and there
33 is an almost complete generic implementation including several
34 additions for a native Windows look and feel (in particular
35 concerning the header). It is planned to implement the control
38 \wxheading{Window styles
}
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.
}
47 \wxheading{Event handling
}
49 To process input from a dataview control, use the following event handler
50 macros to direct input to member functions that take a
51 \helpref{wxDataViewEvent
}{wxdataviewevent
} argument.
54 \begin{twocollist
}\itemsep=
0pt
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.
}
65 \wxheading{Derived from
}
67 \helpref{wxControl
}{wxcontrol
}
69 \wxheading{Include files
}
74 \membersection{wxDataViewCtrl::wxDataViewCtrl
}\label{wxdataviewctrlwxdataviewctrl
}
76 \func{}{wxDataViewCtrl
}{\void}
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
}}
80 Constructor. Calls
\helpref{Create
}{wxdataviewctrlcreate
}.
82 \membersection{wxDataViewCtrl::
\destruct{wxDataViewCtrl
}}\label{wxdataviewctrldtor
}
84 \func{}{\destruct{wxDataViewCtrl
}}{\void}
88 \membersection{wxDataViewCtrl::AppendColumn
}\label{wxdataviewctrlappendcolumn
}
90 \func{virtual bool
}{AppendColumn
}{\param{wxDataViewColumn*
}{col
}}
92 Add a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} to the control. Note
93 that there is a number of short cut methods which implicitly create
94 a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} and a
95 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} for it (see below).
98 \membersection{wxDataViewCtrl::AppendBitmapColumn
}\label{wxdataviewctrlappendbitmapcolumn
}
100 \func{bool
}{AppendBitmapColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
102 \func{bool
}{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.
106 \membersection{wxDataViewCtrl::AppendDateColumn
}\label{wxdataviewctrlappenddatecolumn
}
108 \func{bool
}{AppendDateColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE},
\param{int
}{width = -
1}}
110 \func{bool
}{AppendDateColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE},
\param{int
}{width = -
1}}
112 Appends a column for rendering a date.
114 \membersection{wxDataViewCtrl::AppendProgressColumn
}\label{wxdataviewctrlappendprogresscolumn
}
116 \func{bool
}{AppendProgressColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
80}}
118 \func{bool
}{AppendProgressColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
80}}
120 Appends a column for rendering a progress indicator.
122 \membersection{wxDataViewCtrl::AppendTextColumn
}\label{wxdataviewctrlappendtextcolumn
}
124 \func{bool
}{AppendTextColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
126 \func{bool
}{AppendTextColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width = -
1}}
128 Appends a column for rendering text.
130 \membersection{wxDataViewCtrl::AppendToggleColumn
}\label{wxdataviewctrlappendtogglecolumn
}
132 \func{bool
}{AppendToggleColumn
}{\param{const wxString\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
30}}
134 \func{bool
}{AppendToggleColumn
}{\param{const wxBitmap\&
}{label
},
\param{unsigned int
}{model
\_column},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{width =
30}}
136 Appends a column for rendering a toggle.
138 \membersection{wxDataViewCtrl::AssociateModel
}\label{wxdataviewctrlassociatemodel
}
140 \func{virtual bool
}{AssociateModel
}{\param{wxDataViewListModel*
}{model
}}
142 Associates a
\helpref{wxDataViewListModel
}{wxdataviewlistmodel
} with the
143 control. In the future this should be changed to supporting any data
144 model including a to-be-written wxDataViewTreeModel.
146 \membersection{wxDataViewCtrl::Create
}\label{wxdataviewctrlcreate
}
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
}}
150 Create the control. Useful for two step creation.
152 \membersection{wxDataViewCtrl::ClearColumns
}\label{wxdataviewctrlclearcolumns
}
154 \func{virtual bool
}{ClearColumns
}{\void}
158 \membersection{wxDataViewCtrl::ClearSelection
}\label{wxdataviewctrlclearselection
}
160 \func{void
}{ClearSelection
}{\void}
164 \membersection{wxDataViewCtrl::DeleteColumn
}\label{wxdataviewctrldeletecolumn
}
166 \func{virtual bool
}{DeleteColumn
}{\param{unsigned int
}{pos
}}
168 Deletes given column.
170 \membersection{wxDataViewCtrl::GetColumn
}\label{wxdataviewctrlgetcolumn
}
172 \func{virtual wxDataViewColumn*
}{GetColumn
}{\param{unsigned int
}{pos
}}
174 Returns pointer to the column.
176 \membersection{wxDataViewCtrl::GetModel
}\label{wxdataviewctrlgetmodel
}
178 \func{virtual wxDataViewListModel*
}{GetModel
}{\void}
180 Returns pointer to the data model associated with the
183 \membersection{wxDataViewCtrl::GetNumberOfColumns
}\label{wxdataviewctrlgetnumberofcolumns
}
185 \func{virtual unsigned int
}{GetNumberOfColumns
}{\void}
187 Returns the number of columns.
189 \membersection{wxDataViewCtrl::GetSelection
}\label{wxdataviewctrlgetselection
}
191 \constfunc{virtual int
}{GetSelection
}{\void}
193 Returns the index of the currently selected row. It will
194 return -
1 if no row is selected and the index of the first
195 selected row if more than one row are selected.
197 \membersection{wxDataViewCtrl::GetSelections
}\label{wxdataviewctrlgetselections
}
199 \constfunc{virtual int
}{GetSelections
}{\param{wxArrayInt\&
}{aSelections
}}
201 Returns the number of selected rows and fills an array of int
202 with the indeces of the selected rows.
204 \membersection{wxDataViewCtrl::IsSelected
}\label{wxdataviewctrlisselected
}
206 \constfunc{virtual bool
}{IsSelected
}{\param{unsigned int
}{row
}}
208 Returns
{\it true
} if the row is selected,
{\it false
} otherwise.
210 \membersection{wxDataViewCtrl::SetSelection
}\label{wxdataviewctrlsetselection
}
212 \func{virtual void
}{SetSelection
}{\param{int
}{row
}}
214 Sets the selection. Use -
1 to unselect all rows.
216 \membersection{wxDataViewCtrl::SetSelectionRange
}\label{wxdataviewctrlsetselectionrange
}
218 \func{virtual void
}{SetSelectionRange
}{\param{unsigned int
}{from
},
\param{unsigned int
}{to
}}
220 Set a range of selection.
222 \membersection{wxDataViewCtrl::SetSelections
}\label{wxdataviewctrlsetselections
}
224 \func{virtual void
}{SetSelections
}{\param{const wxArrayInt\&
}{aSelections
}}
226 Set the selection to the array of int.
228 \membersection{wxDataViewCtrl::Unselect
}\label{wxdataviewctrlunselect
}
230 \func{virtual void
}{Unselect
}{\param{unsigned int
}{row
}}
232 Unselect a particular row.