wxDataViewCtrlThis class and its documentation are work in progress and certainly subject to change. wxDataViewCtrl is planned to be a control to display data either in a tree like fashion or in a tabular form or both. Currently, only the tabular form is implemented. wxDataViewCtrl doesn't get its data from the user through virtual functions or events, instead you need to write your own wxDataViewListModel and associate it with this control. Then you need to add a number of wxDataViewColumn to this control to define what each column shall display. Each wxDataViewColumn in turn owns 1 instance of a wxDataViewRenderer to render its cells. A number of standard renderers for rendering text, dates, images, toggle, a progress bar etc. are provided. Additionally, the user can write custom renderes deriving from wxDataViewCustomRenderer for displaying anything. All data transfer from the control to the model and the user code is done through wxVariant which can be extended to support more data formats as necessary. Accordingly, all type information uses the strings returned from wxVariant::GetType. So far, this control has only be implemented for GTK+ and there are only barely working stubs for a generic implementation. It is planned to implement the control natively under OS X and use generic code under Windows (and elsewhere). Window styles
Event handling To process input from a dataview control, use the following event handler macros to direct input to member functions that take a wxDataViewEvent argument.
Derived from Include files <wx/dataview.h>
wxDataViewCtrl::wxDataViewCtrl
wxDataViewCtrl::wxDataViewCtrlwxDataViewCtrl() wxDataViewCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator) Constructor. Calls Create.
wxDataViewCtrl::~wxDataViewCtrl~wxDataViewCtrl() Destructor.
wxDataViewCtrl::AppendColumnvirtual bool AppendColumn(wxDataViewColumn* col) Add a wxDataViewColumn to the control. Note that there is a number of short cut methods which implicitly create a wxDataViewColumn and a wxDataViewRenderer for it (see below).
wxDataViewCtrl::AppendBitmapColumnbool AppendBitmapColumn(const wxString& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1) bool AppendBitmapColumn(const wxBitmap& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1) Appends a column for rendering a bitmap.
wxDataViewCtrl::AppendDateColumnbool AppendDateColumn(const wxString& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1) bool AppendDateColumn(const wxBitmap& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1) Appends a column for rendering a date.
wxDataViewCtrl::AppendProgressColumnbool AppendProgressColumn(const wxString& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80) bool AppendProgressColumn(const wxBitmap& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80) Appends a column for rendering a progress indicator.
wxDataViewCtrl::AppendTextColumnbool AppendTextColumn(const wxString& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1) bool AppendTextColumn(const wxBitmap& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1) Appends a column for rendering text.
wxDataViewCtrl::AppendToggleColumnbool AppendToggleColumn(const wxString& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30) bool AppendToggleColumn(const wxBitmap& label, unsigned int model_column, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30) Appends a column for rendering a toggle.
wxDataViewCtrl::AssociateModelvirtual bool AssociateModel(wxDataViewListModel* model) Associates a wxDataViewListModel with the control. In the future this should be changed to supporting any data model including a to-be-written wxDataViewTreeModel.
wxDataViewCtrl::Createbool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator) Create the control. Useful for two step creation.
wxDataViewCtrl::ClearColumnsvirtual bool ClearColumns() Removes all columns.
wxDataViewCtrl::ClearSelectionvoid ClearSelection() Unselects all rows.
wxDataViewCtrl::DeleteColumnvirtual bool DeleteColumn(unsigned int pos) Deletes given column.
wxDataViewCtrl::GetColumnvirtual wxDataViewColumn* GetColumn(unsigned int pos) Returns pointer to the column.
wxDataViewCtrl::GetModelvirtual wxDataViewListModel* GetModel() Returns pointer to the data model associated with the control (if any).
wxDataViewCtrl::GetNumberOfColumnsvirtual unsigned int GetNumberOfColumns() Returns the number of columns.
wxDataViewCtrl::GetSelectionvirtual int GetSelection() const Returns the index of the currently selected row. It will return -1 if no row is selected and the index of the first selected row if more than one row are selected.
wxDataViewCtrl::GetSelectionsvirtual int GetSelections(wxArrayInt& aSelections) const Returns the number of selected rows and fills an array of int with the indeces of the selected rows.
wxDataViewCtrl::IsSelectedvirtual bool IsSelected(unsigned int row) const Returns true if the row is selected, false otherwise.
wxDataViewCtrl::SetSelectionvirtual void SetSelection(int row) Sets the selection. Use -1 to unselect all rows.
wxDataViewCtrl::SetSelectionRangevirtual void SetSelectionRange(unsigned int from, unsigned int to) Set a range of selection.
wxDataViewCtrl::SetSelectionsvirtual void SetSelections(const wxArrayInt& aSelections) Set the selection to the array of int.
wxDataViewCtrl::Unselectvirtual void Unselect(unsigned int row) Unselect a particular row.
|