# wxDataViewListCtrl Class Reference
[Controls, wxDataViewCtrl Related Classes]

`#include </home/work/projects/wx/2.9/wx/interface/wx/dataview.h>`

Inheritance diagram for wxDataViewListCtrl:
[legend]

## Detailed Description

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 );

## Styles

This class supports the following styles:

See wxDataViewCtrl for the list of supported styles.

## Events emitted by this class

Event macros for events emitted by this class:

See wxDataViewCtrl for the list of events emitted by this class.

##

Library: wxAdvanced
Category: Controls, wxDataViewCtrl Related Classes

## 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 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.

List of all members.

## Constructor & Destructor Documentation

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.

## Member Function Documentation

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.

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.

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.

void wxDataViewListCtrl::DeleteAllItems | ( |  | ) |

Delete all items (= all rows).

void wxDataViewListCtrl::DeleteItem | ( | unsigned | row | ) |

Delete the row at position row.

int wxDataViewListCtrl::GetSelectedRow | ( |  | ) | const

Returns index of the selected row or wxNOT_FOUND.

See also:
  wxDataViewCtrl::GetSelection()

Since:
  2.9.2

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 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::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,
|  | wxClientData * | data = `NULL` |
| ) |  |  |

Inserts an item (=row) to the control and store.

bool wxDataViewListCtrl::IsRowSelected | ( | unsigned | row | ) | const

Returns true if row is selected.

See also:
  wxDataViewCtrl::IsSelected()

Since:
  2.9.2

int wxDataViewListCtrl::ItemToRow | ( | const wxDataViewItem & | item | ) | const

Returns the position of given item or wxNOT_FOUND if it's not a valid item.

Since:
  2.9.2

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::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,
|  | wxClientData * | data = `NULL` |
| ) |  |  |

Prepends an item (=row) to the control and store.

wxDataViewItem wxDataViewListCtrl::RowToItem | ( | int | row | ) | const

Returns the wxDataViewItem at the given row.

Since:
  2.9.2

void wxDataViewListCtrl::SelectRow | ( | unsigned | row | ) |

Selects given row.

See also:
  wxDataViewCtrl::Select()

Since:
  2.9.2

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 | ) |

Unselects given row.

See also:
  wxDataViewCtrl::Unselect()

Since:
  2.9.2

|  | [ top ]