$szTitle = "wxdataviewctrl"; include "./_header.inc"; ?>
this 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
wxdv_single | single selection mode. this is the default. |
wxdv_multiple | multiple selection mode. |
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.
evt_dataview_row_selected(id, func) | processes a wxevt_command_dataview_row_selected event. |
evt_dataview_row_activated(id, func) | processes a wxevt_command_dataview_row_activated event. |
evt_dataview_column_header_click(id, func) | processes a wxevt_command_dataview_column_header_clicked event. |
evt_dataview_column_header_right_click(id, func) | processes a wxevt_command_dataview_column_header_right_clicked event. |
derived from
include files
<wx/dataview.h>
wxdataviewctrl::wxdataviewctrl
wxdataviewctrl::~wxdataviewctrl
wxdataviewctrl::appendcolumn
wxdataviewctrl::appendbitmapcolumn
wxdataviewctrl::appenddatecolumn
wxdataviewctrl::appendprogresscolumn
wxdataviewctrl::appendtextcolumn
wxdataviewctrl::appendtogglecolumn
wxdataviewctrl::associatemodel
wxdataviewctrl::create
wxdataviewctrl::clearcolumns
wxdataviewctrl::clearselection
wxdataviewctrl::deletecolumn
wxdataviewctrl::getcolumn
wxdataviewctrl::getmodel
wxdataviewctrl::getnumberofcolumns
wxdataviewctrl::getselection
wxdataviewctrl::getselections
wxdataviewctrl::isselected
wxdataviewctrl::setselection
wxdataviewctrl::setselectionrange
wxdataviewctrl::setselections
wxdataviewctrl::unselect
wxdataviewctrl()
wxdataviewctrl(wxwindow* parent, wxwindowid id, const wxpoint& pos = wxdefaultposition, const wxsize& size = wxdefaultsize, long style = 0, const wxvalidator& validator = wxdefaultvalidator)
constructor. calls create.
~wxdataviewctrl()
destructor.
virtual 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).
bool 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.
bool 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.
bool 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.
bool 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.
bool 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.
virtual 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.
bool 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.
virtual bool clearcolumns()
removes all columns.
void clearselection()
unselects all rows.
virtual bool deletecolumn(unsigned int pos)
deletes given column.
virtual wxdataviewcolumn* getcolumn(unsigned int pos)
returns pointer to the column.
virtual wxdataviewlistmodel* getmodel()
returns pointer to the data model associated with the control (if any).
virtual unsigned int getnumberofcolumns()
returns the number of columns.
virtual 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.
virtual int getselections(wxarrayint& aselections) const
returns the number of selected rows and fills an array of int with the indeces of the selected rows.
virtual bool isselected(unsigned int row) const
returns true if the row is selected, false otherwise.
virtual void setselection(int row)
sets the selection. use -1 to unselect all rows.
virtual void setselectionrange(unsigned int from, unsigned int to)
set a range of selection.
virtual void setselections(const wxarrayint& aselections)
set the selection to the array of int.
virtual void unselect(unsigned int row)
unselect a particular row.
include "./_footer.inc"; ?>