#include </home/zeitlin/src/wx/github/interface/wx/dataview.h>
This class is a wxDataViewCtrl which internally uses a wxDataViewListStore and forwards most of its API to that class.
The purpose of this class is to offer a simple way to display and edit a small table of data without having to write your own wxDataViewModel.
wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY ); listctrl->AppendToggleColumn( "Toggle" ); listctrl->AppendTextColumn( "Text" ); wxVector<wxVariant> data; data.push_back( wxVariant(true) ); data.push_back( wxVariant("row 1") ); listctrl->AppendItem( data ); data.clear(); data.push_back( wxVariant(false) ); data.push_back( wxVariant("row 3") ); listctrl->AppendItem( data );
This class supports the following styles:
Event macros for events emitted by this class:
Public Member Functions | |
wxDataViewListCtrl () | |
Default ctor. | |
wxDataViewListCtrl (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDV_ROW_LINES, const wxValidator &validator=wxDefaultValidator) | |
Constructor. | |
~wxDataViewListCtrl () | |
Destructor. | |
bool | Create (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDV_ROW_LINES, const wxValidator &validator=wxDefaultValidator) |
Creates the control and a wxDataViewListStore as its internal model. | |
int | ItemToRow (const wxDataViewItem &item) const |
Returns the position of given item or wxNOT_FOUND if it's not a valid item. | |
wxDataViewItem | RowToItem (int row) const |
Returns the wxDataViewItem at the given row. | |
wxDataViewListStore * | GetStore () |
Returns the store. | |
const wxDataViewListStore * | GetStore () const |
Returns the store. | |
Selection handling functions | |
int | GetSelectedRow () const |
Returns index of the selected row or wxNOT_FOUND. | |
void | SelectRow (unsigned row) |
Selects given row. | |
void | UnselectRow (unsigned row) |
Unselects given row. | |
bool | IsRowSelected (unsigned row) const |
Returns true if row is selected. | |
Column management functions | |
virtual bool | AppendColumn (wxDataViewColumn *column) |
Appends a column to the control and additionally appends a column to the store with the type string. | |
void | AppendColumn (wxDataViewColumn *column, const wxString &varianttype) |
Appends a column to the control and additionally appends a column to the list store with the type varianttype. | |
wxDataViewColumn * | AppendTextColumn (const wxString &label, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int width=-1, wxAlignment align=wxALIGN_LEFT, int flags=wxDATAVIEW_COL_RESIZABLE) |
Appends a text column to the control and the store. | |
wxDataViewColumn * | AppendToggleColumn (const wxString &label, wxDataViewCellMode mode=wxDATAVIEW_CELL_ACTIVATABLE, int width=-1, wxAlignment align=wxALIGN_LEFT, int flags=wxDATAVIEW_COL_RESIZABLE) |
Appends a toggle column to the control and the store. | |
wxDataViewColumn * | AppendProgressColumn (const wxString &label, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int width=-1, wxAlignment align=wxALIGN_LEFT, int flags=wxDATAVIEW_COL_RESIZABLE) |
Appends a progress column to the control and the store. | |
wxDataViewColumn * | AppendIconTextColumn (const wxString &label, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int width=-1, wxAlignment align=wxALIGN_LEFT, int flags=wxDATAVIEW_COL_RESIZABLE) |
Appends an icon-and-text column to the control and the store. | |
virtual bool | InsertColumn (unsigned int pos, wxDataViewColumn *column) |
Inserts a column to the control and additionally inserts a column to the store with the type string. | |
void | InsertColumn (unsigned int pos, wxDataViewColumn *column, const wxString &varianttype) |
Inserts a column to the control and additionally inserts a column to the list store with the type varianttype. | |
virtual bool | PrependColumn (wxDataViewColumn *column) |
Prepends a column to the control and additionally prepends a column to the store with the type string. | |
void | PrependColumn (wxDataViewColumn *column, const wxString &varianttype) |
Prepends a column to the control and additionally prepends a column to the list store with the type varianttype. | |
Item management functions | |
void | AppendItem (const wxVector< wxVariant > &values, wxUIntPtr data=NULL) |
Appends an item (=row) to the control and store. | |
void | PrependItem (const wxVector< wxVariant > &values, wxUIntPtr data=NULL) |
Prepends an item (=row) to the control and store. | |
void | InsertItem (unsigned int row, const wxVector< wxVariant > &values, wxUIntPtr data=NULL) |
Inserts an item (=row) to the control and store. | |
void | DeleteItem (unsigned row) |
Delete the row at position row. | |
void | DeleteAllItems () |
Delete all items (= all rows). | |
unsigned int | GetItemCount () const |
Returns the number of items (=rows) in the control. | |
wxUIntPtr | GetItemData (const wxDataViewItem &item) const |
Returns the client data associated with the item. | |
void | SetValue (const wxVariant &value, unsigned int row, unsigned int col) |
Sets the value in the store and update the control. | |
void | GetValue (wxVariant &value, unsigned int row, unsigned int col) |
Returns the value from the store. | |
void | SetTextValue (const wxString &value, unsigned int row, unsigned int col) |
Sets the value in the store and update the control. | |
wxString | GetTextValue (unsigned int row, unsigned int col) const |
Returns the value from the store. | |
void | SetToggleValue (bool value, unsigned int row, unsigned int col) |
Sets the value in the store and update the control. | |
bool | GetToggleValue (unsigned int row, unsigned int col) const |
Returns the value from the store. | |
void | SetItemData (const wxDataViewItem &item, wxUIntPtr data) |
Associates a client data pointer with the given item. |
wxDataViewListCtrl::wxDataViewListCtrl | ( | ) |
Default ctor.
wxDataViewListCtrl::wxDataViewListCtrl | ( | wxWindow * | parent, |
wxWindowID | id, | ||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxDV_ROW_LINES , |
||
const wxValidator & | validator = wxDefaultValidator |
||
) |
Constructor.
Calls Create().
wxDataViewListCtrl::~wxDataViewListCtrl | ( | ) |
Destructor.
Deletes the image list if any.
virtual bool wxDataViewListCtrl::AppendColumn | ( | wxDataViewColumn * | column | ) | [virtual] |
Appends a column to the control and additionally appends a column to the store with the type string.
Reimplemented from wxDataViewCtrl.
void wxDataViewListCtrl::AppendColumn | ( | wxDataViewColumn * | column, |
const wxString & | varianttype | ||
) |
Appends a column to the control and additionally appends a column to the list store with the type varianttype.
wxDataViewColumn* wxDataViewListCtrl::AppendIconTextColumn | ( | const wxString & | label, |
wxDataViewCellMode | mode = wxDATAVIEW_CELL_INERT , |
||
int | width = -1 , |
||
wxAlignment | align = wxALIGN_LEFT , |
||
int | flags = wxDATAVIEW_COL_RESIZABLE |
||
) |
Appends an icon-and-text column to the control and the store.
See wxDataViewColumn::wxDataViewColumn for more info about the parameters.
Appends an item (=row) to the control and store.
wxDataViewColumn* wxDataViewListCtrl::AppendProgressColumn | ( | const wxString & | label, |
wxDataViewCellMode | mode = wxDATAVIEW_CELL_INERT , |
||
int | width = -1 , |
||
wxAlignment | align = wxALIGN_LEFT , |
||
int | flags = wxDATAVIEW_COL_RESIZABLE |
||
) |
Appends a progress column to the control and the store.
See wxDataViewColumn::wxDataViewColumn for more info about the parameters.
wxDataViewColumn* wxDataViewListCtrl::AppendTextColumn | ( | const wxString & | label, |
wxDataViewCellMode | mode = wxDATAVIEW_CELL_INERT , |
||
int | width = -1 , |
||
wxAlignment | align = wxALIGN_LEFT , |
||
int | flags = wxDATAVIEW_COL_RESIZABLE |
||
) |
Appends a text column to the control and the store.
See wxDataViewColumn::wxDataViewColumn for more info about the parameters.
wxDataViewColumn* wxDataViewListCtrl::AppendToggleColumn | ( | const wxString & | label, |
wxDataViewCellMode | mode = wxDATAVIEW_CELL_ACTIVATABLE , |
||
int | width = -1 , |
||
wxAlignment | align = wxALIGN_LEFT , |
||
int | flags = wxDATAVIEW_COL_RESIZABLE |
||
) |
Appends a toggle column to the control and the store.
See wxDataViewColumn::wxDataViewColumn for more info about the parameters.
bool wxDataViewListCtrl::Create | ( | wxWindow * | parent, |
wxWindowID | id, | ||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxDV_ROW_LINES , |
||
const wxValidator & | validator = wxDefaultValidator |
||
) |
Creates the control and a wxDataViewListStore as its internal model.
void wxDataViewListCtrl::DeleteAllItems | ( | ) |
Delete all items (= all rows).
void wxDataViewListCtrl::DeleteItem | ( | unsigned | row | ) |
Delete the row at position row.
unsigned int wxDataViewListCtrl::GetItemCount | ( | ) | const |
Returns the number of items (=rows) in the control.
wxUIntPtr wxDataViewListCtrl::GetItemData | ( | const wxDataViewItem & | item | ) | const |
int wxDataViewListCtrl::GetSelectedRow | ( | ) | const |
wxDataViewListStore* wxDataViewListCtrl::GetStore | ( | ) |
Returns the store.
const wxDataViewListStore* wxDataViewListCtrl::GetStore | ( | ) | const |
Returns the store.
wxString wxDataViewListCtrl::GetTextValue | ( | unsigned int | row, |
unsigned int | col | ||
) | const |
Returns the value from the store.
This method assumes that the string is stored in respective column.
bool wxDataViewListCtrl::GetToggleValue | ( | unsigned int | row, |
unsigned int | col | ||
) | const |
Returns the value from the store.
This method assumes that the boolean value is stored in respective column.
void wxDataViewListCtrl::GetValue | ( | wxVariant & | value, |
unsigned int | row, | ||
unsigned int | col | ||
) |
Returns the value from the store.
virtual bool wxDataViewListCtrl::InsertColumn | ( | unsigned int | pos, |
wxDataViewColumn * | column | ||
) | [virtual] |
Inserts a column to the control and additionally inserts a column to the store with the type string.
Reimplemented from wxDataViewCtrl.
void wxDataViewListCtrl::InsertColumn | ( | unsigned int | pos, |
wxDataViewColumn * | column, | ||
const wxString & | varianttype | ||
) |
Inserts a column to the control and additionally inserts a column to the list store with the type varianttype.
void wxDataViewListCtrl::InsertItem | ( | unsigned int | row, |
const wxVector< wxVariant > & | values, | ||
wxUIntPtr | data = NULL |
||
) |
Inserts an item (=row) to the control and store.
bool wxDataViewListCtrl::IsRowSelected | ( | unsigned | row | ) | const |
int wxDataViewListCtrl::ItemToRow | ( | const wxDataViewItem & | item | ) | const |
Returns the position of given item or wxNOT_FOUND if it's not a valid item.
virtual bool wxDataViewListCtrl::PrependColumn | ( | wxDataViewColumn * | column | ) | [virtual] |
Prepends a column to the control and additionally prepends a column to the store with the type string.
Reimplemented from wxDataViewCtrl.
void wxDataViewListCtrl::PrependColumn | ( | wxDataViewColumn * | column, |
const wxString & | varianttype | ||
) |
Prepends a column to the control and additionally prepends a column to the list store with the type varianttype.
void wxDataViewListCtrl::PrependItem | ( | const wxVector< wxVariant > & | values, |
wxUIntPtr | data = NULL |
||
) |
Prepends an item (=row) to the control and store.
wxDataViewItem wxDataViewListCtrl::RowToItem | ( | int | row | ) | const |
Returns the wxDataViewItem at the given row.
void wxDataViewListCtrl::SelectRow | ( | unsigned | row | ) |
void wxDataViewListCtrl::SetItemData | ( | const wxDataViewItem & | item, |
wxUIntPtr | data | ||
) |
Associates a client data pointer with the given item.
Notice that the control does not take ownership of the pointer for compatibility with wxListCtrl. I.e. it will not delete the pointer (if it is a pointer and not a number) itself, it is up to you to do it.
void wxDataViewListCtrl::SetTextValue | ( | const wxString & | value, |
unsigned int | row, | ||
unsigned int | col | ||
) |
Sets the value in the store and update the control.
This method assumes that the string is stored in respective column.
void wxDataViewListCtrl::SetToggleValue | ( | bool | value, |
unsigned int | row, | ||
unsigned int | col | ||
) |
Sets the value in the store and update the control.
This method assumes that the boolean value is stored in respective column.
void wxDataViewListCtrl::SetValue | ( | const wxVariant & | value, |
unsigned int | row, | ||
unsigned int | col | ||
) |
Sets the value in the store and update the control.
void wxDataViewListCtrl::UnselectRow | ( | unsigned | row | ) |