2 \section{\class{wxDataViewCtrl
}}\label{wxdataviewctrl
}
4 This class and its documentation are work in progress and
5 certainly 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. Currently,
9 only the tabular form is implemented. wxDataViewCtrl doesn't
10 get its data from the user through virtual functions or events,
11 instead you need to write your own
12 \helpref{wxDataViewListModel
}{wxdataviewlistmodel
} and associate
13 it with this control. Then you need to add a number of
14 \helpref{wxDataViewColumn
}{wxdataviewcolumn
} to this control to
15 define what each column shall display. Each wxDataViewColumn
16 in turn owns
1 instance of a
17 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} to render its
18 cells. A number of standard renderers for rendering text, dates,
19 images, toggle, a progress bar etc. are provided. Additionally,
20 the user can write custom renderes deriving from
21 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}
22 for displaying anything.
24 All data transfer from the control to the model and the user
25 code is done through
\helpref{wxVariant
}{wxvariant
} which can
26 be extended to support more data formats as necessary.
27 Accordingly, all type information uses the strings returned
28 from
\helpref{wxVariant::GetType
}{wxvariantgettype
}.
30 So far, this control has only be implemented for GTK+ and
31 there are only barely working stubs for a generic implementation.
32 It is planned to implement the control natively under OS X
33 and use generic code under Windows (and elsewhere).
35 \wxheading{Window styles
}
38 \begin{twocollist
}\itemsep=
0pt
39 \twocolitem{\windowstyle{wxDV
\_SINGLE}}{Single selection mode. This is the default.
}
40 \twocolitem{\windowstyle{wxDV
\_MULTIPLE}}{Multiple selection mode.
}
44 \wxheading{Event handling
}
46 To process input from a dataview control, use the following event handler
47 macros to direct input to member functions that take a
48 \helpref{wxDataViewEvent
}{wxdataviewevent
} argument.
51 \begin{twocollist
}\itemsep=
0pt
53 \twocolitem{{\bf EVT
\_DATAVIEW\_ROW\_SELECTED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ROW\_SELECTED event.
}
54 \twocolitem{{\bf EVT
\_DATAVIEW\_ROW\_ACTIVATED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ROW\_ACTIVATED event.
}
55 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.
}
56 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.
}
62 \wxheading{Derived from
}
64 \helpref{wxControl
}{wxcontrol
}
66 \wxheading{Include files
}
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{wxDataViewListModel*
}{model
}}
139 Associates a
\helpref{wxDataViewListModel
}{wxdataviewlistmodel
} with the
140 control. In the future this should be changed to supporting any data
141 model including a to-be-written wxDataViewTreeModel.
143 \membersection{wxDataViewCtrl::Create
}\label{wxdataviewctrlcreate
}
145 \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
}}
147 Create the control. Useful for two step creation.
149 \membersection{wxDataViewCtrl::ClearColumns
}\label{wxdataviewctrlclearcolumns
}
151 \func{virtual bool
}{ClearColumns
}{\void}
155 \membersection{wxDataViewCtrl::ClearSelection
}\label{wxdataviewctrlclearselection
}
157 \func{void
}{ClearSelection
}{\void}
161 \membersection{wxDataViewCtrl::DeleteColumn
}\label{wxdataviewctrldeletecolumn
}
163 \func{virtual bool
}{DeleteColumn
}{\param{unsigned int
}{pos
}}
165 Deletes given column.
167 \membersection{wxDataViewCtrl::GetColumn
}\label{wxdataviewctrlgetcolumn
}
169 \func{virtual wxDataViewColumn*
}{GetColumn
}{\param{unsigned int
}{pos
}}
171 Returns pointer to the column.
173 \membersection{wxDataViewCtrl::GetModel
}\label{wxdataviewctrlgetmodel
}
175 \func{virtual wxDataViewListModel*
}{GetModel
}{\void}
177 Returns pointer to the data model associated with the
180 \membersection{wxDataViewCtrl::GetNumberOfColumns
}\label{wxdataviewctrlgetnumberofcolumns
}
182 \func{virtual unsigned int
}{GetNumberOfColumns
}{\void}
184 Returns the number of columns.
186 \membersection{wxDataViewCtrl::GetSelection
}\label{wxdataviewctrlgetselection
}
188 \constfunc{virtual int
}{GetSelection
}{\void}
190 Returns the index of the currently selected row. It will
191 return -
1 if no row is selected and the index of the first
192 selected row if more than one row are selected.
194 \membersection{wxDataViewCtrl::GetSelections
}\label{wxdataviewctrlgetselections
}
196 \constfunc{virtual int
}{GetSelections
}{\param{wxArrayInt\&
}{aSelections
}}
198 Returns the number of selected rows and fills an array of int
199 with the indeces of the selected rows.
201 \membersection{wxDataViewCtrl::IsSelected
}\label{wxdataviewctrlisselected
}
203 \constfunc{virtual bool
}{IsSelected
}{\param{unsigned int
}{row
}}
205 Returns
{\it true
} if the row is selected,
{\it false
} otherwise.
207 \membersection{wxDataViewCtrl::SetSelection
}\label{wxdataviewctrlsetselection
}
209 \func{virtual void
}{SetSelection
}{\param{int
}{row
}}
211 Sets the selection. Use -
1 to unselect all rows.
213 \membersection{wxDataViewCtrl::SetSelectionRange
}\label{wxdataviewctrlsetselectionrange
}
215 \func{virtual void
}{SetSelectionRange
}{\param{unsigned int
}{from
},
\param{unsigned int
}{to
}}
217 Set a range of selection.
219 \membersection{wxDataViewCtrl::SetSelections
}\label{wxdataviewctrlsetselections
}
221 \func{virtual void
}{SetSelections
}{\param{const wxArrayInt\&
}{aSelections
}}
223 Set the selection to the array of int.
225 \membersection{wxDataViewCtrl::Unselect
}\label{wxdataviewctrlunselect
}
227 \func{virtual void
}{Unselect
}{\param{unsigned int
}{row
}}
229 Unselect a particular row.