Version: 2.9.4
Public Member Functions
wxDataViewListCtrl Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/dataview.h>

Inheritance diagram for wxDataViewListCtrl:

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.
wxDataViewListStoreGetStore ()
 Returns the store.
const wxDataViewListStoreGetStore () 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.
wxDataViewColumnAppendTextColumn (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.
wxDataViewColumnAppendToggleColumn (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.
wxDataViewColumnAppendProgressColumn (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.
wxDataViewColumnAppendIconTextColumn (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.

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

void wxDataViewListCtrl::AppendItem ( const wxVector< wxVariant > &  values,
wxUIntPtr  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.

unsigned int wxDataViewListCtrl::GetItemCount ( ) const

Returns the number of items (=rows) in the control.

Since:
2.9.4
wxUIntPtr wxDataViewListCtrl::GetItemData ( const wxDataViewItem item) const

Returns the client data associated with the item.

参照:
SetItemData()
Since:
2.9.4
int wxDataViewListCtrl::GetSelectedRow ( ) const

Returns index of the selected row or wxNOT_FOUND.

参照:
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 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

Returns true if row is selected.

参照:
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 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.

Since:
2.9.2
void wxDataViewListCtrl::SelectRow ( unsigned  row)

Selects given row.

参照:
wxDataViewCtrl::Select()
Since:
2.9.2
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.

参照:
GetItemData()
Since:
2.9.4
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.

参照:
wxDataViewCtrl::Unselect()
Since:
2.9.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines