#include <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. | |
wxDataViewListStore * | GetStore () |
Returns the store. | |
const wxDataViewListStore * | GetStore () const |
Returns the store. | |
Column management functions | |
virtual void | 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 void | 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 void | 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, wxClientData *data=NULL) |
Appends an item (=row) to the control and store. | |
void | PrependItem (const wxVector< wxVariant > &values, wxClientData *data=NULL) |
Prepends an item (=row) to the control and store. | |
void | InsertItem (unsigned int row, const wxVector< wxVariant > &values, wxClientData *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). | |
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. |
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.
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.
virtual void 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.
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.
void wxDataViewListCtrl::AppendItem | ( | const wxVector< wxVariant > & | values, | |
wxClientData * | data = NULL | |||
) |
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.
Reimplemented from wxDataViewCtrl.
void wxDataViewListCtrl::DeleteAllItems | ( | ) |
Delete all items (= all rows).
void wxDataViewListCtrl::DeleteItem | ( | unsigned | row | ) |
Delete the row at position row.
const wxDataViewListStore* wxDataViewListCtrl::GetStore | ( | ) | const |
Returns the store.
wxDataViewListStore* wxDataViewListCtrl::GetStore | ( | ) |
Returns the store.
wxString wxDataViewListCtrl::GetTextValue | ( | unsigned int | row, | |
unsigned int | col | |||
) | const |
Returns the value from the store.
This method assumes that the a 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 a boolean value is stored in respective column.
void wxDataViewListCtrl::GetValue | ( | wxVariant & | value, | |
unsigned int | row, | |||
unsigned int | col | |||
) |
Returns the value from the store.
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.
virtual void 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::InsertItem | ( | unsigned int | row, | |
const wxVector< wxVariant > & | values, | |||
wxClientData * | data = NULL | |||
) |
Inserts an item (=row) to the control and store.
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.
virtual void 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::PrependItem | ( | const wxVector< wxVariant > & | values, | |
wxClientData * | data = NULL | |||
) |
Prepends an item (=row) to the control and store.
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 a 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 a 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.
![]() |
[ top ] |